Skip to content

Commit 1669bbd

Browse files
authored
Fix/analysis groq fallback (#47)
* feat(visualizer): add zero-latency static analysis suite - Implement circular dependency detection on adjacency list - Add percentile-based file complexity heatmap to graph nodes - Introduce orphan file detection for dead code identification - Update node state interfaces and UI legends * refactor(analyze): decompose page.tsx into modular hooks and UI components - Extract state management, LLM streaming, and graph traversal into custom hooks - Modularize UI into dedicated layout components (Visualizer, Doctor, Risk Radar) - Isolate static configurations and types into constants.ts - Strip page.tsx down to act strictly as a layout orchestrator * fix: restore clean refactored page.tsx, remove merge pollution * feat(visualizer): implement multi-source reverse BFS for PR blast radius - Extract changed files from existing PR analysis route - Add 'pr-blast' highlight mode to React Flow ArchitectureMap - Implement automatic tab switching and state lifting for seamless UX * fix: restore missing AiGate import in DoctorPanel * feat(analysis): implement pure DSA architecture insights and interactive dashboard - **Algorithms**: Shipped zero-latency, pure math static analysis features including Articulation Points (Bridge Detection), Dead Code Reachability (BFS), Dependency PageRank, and Robert C. Martin's Instability Matrix (Ca/Ce coupling). - **Architecture Insights UI**: Built the new `ArchInsightsPanel` and `InfoTooltip` to visualize critical single-points-of-failure, unreachable code chunks, and codebase stability metrics directly over the React Flow canvas. - **Pipeline Integration**: Upgraded `ast-pipeline.ts` and `analyze.ts` types to support the new graph theory outputs without triggering external API calls. - **Command Center Dashboard**: Extracted flat dashboard list into a client-side `DashboardGrid` component. Added interactive grouping by repository, analysis count badges, and chronological sorting with formatted timestamps. * feat: add Lemon Squeezy payment integration - Add checkout API route (/api/checkout) - Add webhook handler (/api/webhooks/lemonsqueezy) - Update usage.ts to support pro tier (100/day limit) - Update analyze route to use ratelimitPro for pro users - Update chat route to bypass limit for pro users - Update analyze-pr route to bypass limit for pro users - Add ratelimitPro to ratelimit.ts - Supabase profiles table created with plan_tier column * fix: replace auth-helpers-nextjs with supabase/ssr in checkout route * fix: use correct SUPABASE_SERVICE_KEY env var in webhook * feat: wire up Specialist tier on pricing page - Add handleUpgrade function calling /api/checkout - Update tier names: Student→Intern, Architect→Specialist, Surgical→Chief Surgeon - Specialist tier now live with ₹99/mo and amber styling - Add loading state and login redirect for unauthenticated users - Remove Coming Soon badge from Specialist tier * fix: update free tier limit from 10 to 5 autopsies per day * feat: update pricing constants - Specialist tier live at ₹99/mo * feat: reduce token usage and add deepseek-r1 for pro chat tier - Free tier: context 20k -> 6k chars, max_tokens 1024 -> 512 - Pro tier: context 14k chars, max_tokens 1024, deepseek-r1 model - Reduces token usage by ~70% for free tier chat * fix: add missing isPro and diagnosticCount props to DebugInterface in view page * feat: gate Auto-Patch behind pro tier in RiskDashboard * fix: replace amber pro accents with project-native slate/white palette Amber color tokens felt out of place against the dark technical aesthetic. Replaced all amber instances in RiskDashboard with the existing slate/white/transparent vocabulary used throughout the component. - Pro banner: amber border/bg → white/5 glass surface - Upgrade button: amber fills → slate-300/white hover - Locked Auto-Patch button: amber tint → desaturated slate-500 - FileCode icon: amber-400 → slate-300 with white hover - Traffic light middle dot: amber-500 → slate-500 * fix: replace amber pro accents with project-native slate/white palette Amber color tokens felt out of place against the dark technical aesthetic. Replaced all amber instances in RiskDashboard with the existing slate/white/transparent vocabulary used throughout the component. - Pro banner: amber border/bg → white/5 glass surface - Upgrade button: amber fills → slate-300/white hover - Locked Auto-Patch button: amber tint → desaturated slate-500 - FileCode icon: amber-400 → slate-300 with white hover - Traffic light middle dot: amber-500 → slate-500 * refactor(debug): optimise engine pipeline - fix: dynamic analysis_version query instead of hardcoded v3 - fix: separate visited sets for upstream/downstream BFS traversal - fix: node ID collision in mermaid sanitizer (path-aware) - fix: opacity replaced with stroke-width in mermaid styles - fix: JSON.parse wrapped in try/catch in cache and groq-debug - fix: requiresRuntimeCheck narrowed to specific runtime patterns - fix: at async removed from framework noise filter in stack-parser - fix: findMatchingFile disambiguates same-name files by path score - perf: parallel file fetching via Promise.allSettled - perf: reverse graph memoized via WeakMap - perf: BFS queue uses head pointer instead of array.shift() - refactor: rename gemini-debug to groq-debug with backward alias - refactor: confidence removed from AI prompt, heuristics only - remove: dead code generateErrorGraph and extractAllCrashNodes - add: cache invalidation via invalidateRepoCache() - add: server-side rate limiting with 429 response * refactor(arch-insights): fix AP algorithm, types, tests, and Pro gate UI * The graph computation layer — wherever computePageRank / findSCCs live The React Flow node/edge renderer — wherever node styles and badges are applied The right analysis panel — wherever CIRCULAR DEPS / ORPHANS / NERVE CENTER are rendered The Risk Radar tab — its current state * fix(blueprint-map): compute PageRank internally when scores not passed as prop - Add computePageRank() helper using damped iteration (20 passes, 0.85 factor) - Normalize scores to 0-100 range for consistent tier thresholds - Add computedPageRankScores useMemo that falls back to internal computation - Replace all pageRankScores references with computedPageRankScores - Nerve Center panel now works out of the box without parent wiring * merge: use fix/nerve-center-pagerank version of ArchitectureMap * fix: always insert new row for logged-in users on re-analysis - Logged-in users now get a fresh DB row on every analysis (cached or not) so the dashboard always reflects the latest activity with correct timestamp - RAG storage still skipped for cached results to avoid redundant processing - Anon users retain original behavior (insert only on fresh analyses) Fixes: dashboard showing stale May 29 dates after re-analyzing existing repos * perf: reduce groq token spend with caching and model switch - Switch all routes from llama-3.3-70b-versatile to llama-3.1-8b-instant (5x higher token limit: 100K -> 500K TPD, same free tier) - Cache AI response in analyses.ai_response column after first run so repeat analysis of same repo costs 0 tokens - Tee live stream to store response without breaking streaming UX - Cap fileContents to top 20 files in gemini.ts to prevent token blowout on large repos (was sending all files unbounded) * feat: integrate lemon squeezy, semantic caching, betweenness centrality, and cfg builder * seo: og-image, sitemap, robots.txt, schema markup * seo: add google search console verification * changed pricing section * feat: complete razorpay checkout and webhook integration * feat: hardened razorpay subscription route * ci: retrigger build with env vars * fix: sync usage limits with shared constants, add pro tier support * fix: resolve isPro crash, import diagnostic limit from constants * fix: tighten pricing page spacing, fix TS errors, swap decommissioned Pro model * fix: rename gemini/groq refs to cerebras, fix chat runtime and pro model * changed cerebras to groq
1 parent 2ba9a76 commit 1669bbd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎lib/cerebras.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Tracer, wrapOpenAI } from "0xtrace";
55
// Wrapped per-call inside streamAnalyzeWithCerebras so each repo analysis
66
// gets its own session in the 0xtrace dashboard.
77
const baseCerebras = new OpenAI({
8-
apiKey: process.env.CEREBRAS_API_KEY!,
9-
baseURL: "https://api.cerebras.ai/v1",
8+
apiKey: process.env.GROQ_API_KEY!,
9+
baseURL: "https://api.groq.com/openai/v1",
1010
});
1111

1212
// ── Main Streaming Function ───────────────────────────────────────────────────

0 commit comments

Comments
 (0)