222 feat enhance ai analyzer providers power user prompt versioning and swapping#225
Conversation
… order and locales
|
🚀 Preview: https://pr-225--openscan.netlify.app |
PR #225 Review — AI Analyzer EnhancementOverall: Well-structured PR with solid architecture decisions. The Issues1. Naming inconsistency:
2. const primaryAIProviderId = "groq"; // hardcodedThis should be 3. Anthropic model ID is outdated In defaultModel: "claude-sonnet-4-5-20250929",The current model is 4. Protocol detection false positives
5. The type includes 6. A few things worth verifying in the service:
Summary
|
Aligns the UserSettings field name with the derived boolean exposed by SettingsContext, so consumers reading directly from settings and those using the context hook see the same identifier.
…thropic model Replace the hardcoded "groq" primaryAIProviderId in the Settings UI with AI_PROVIDER_ORDER[0] so the displayed primary card stays in sync if the priority order ever changes. Also updates the Anthropic default model from the outdated claude-sonnet-4-5-20250929 to claude-sonnet-4-6.
AIService.doFetch now uses an AbortController with a 30s hard timeout so a slow or unresponsive provider cannot hang the UI indefinitely. extractProtocolHints now strips filenames before pattern matching so only directory segments are tested, preventing contracts whose names happen to contain a protocol name (e.g. MyUniswapFork.sol) from producing false hints.
Description
Enhance the AI Analyzer with new provider support (Perplexity and Gemini), a prompt versioning system with power/regular user modes, and improved contract analysis context with smarter ABI summarization.
Related Issue
Closes #222
Type of Change
Changes Made
AI Providers
callGemini) with its native REST API formatMAX_TOKENSfrom 1024 to 4096Prompt Versioning & User Modes
PromptVersiontype ("stable"|"latest") to support prompt experimentationPROMPT_REGISTRYfor O(1) lookup by version → mode → typeSmarter Contract Context (
aiContext.ts)Transaction Context
i18n
Screenshots (if applicable)
Checklist
npm run format:fixandnpm run lint:fixnpm run typecheckwith no errorsnpm run test:runAdditional Notes
latestprompt configs are initially clones ofstable— they serve as an experimentation sandbox for prompt iteration without risking regression on the stable path.callGeminimethod was added.