Migration loan-decision-copilot to Tinyfish SDK #176
Migration loan-decision-copilot to Tinyfish SDK #176KrishnaAgarwal7531 wants to merge 1 commit intotinyfish-io:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
simantak-dabhade
left a comment
There was a problem hiding this comment.
Hey @KrishnaAgarwal7531, nice migration — the SDK integration pattern is solid (search + parallel stream agents, proper event handling, no module-level instantiation).
Blocker: build fails
npm run build fails with a type error:
src/app/api/analyze-loan/route.ts:89-92
const raw = event.result;
let result =
typeof raw === "string"
? JSON.parse(raw.replace(/```json|```/g, "").trim())
: raw;The SDK types CompleteEvent.result as Record<string, unknown> | null, never string. TypeScript narrows raw to never in the string branch, causing:
Type error: Property 'replace' does not exist on type 'never'.
Please fix so the build passes.
What looks good ✓
@tiny-fish/sdkusage (client.agent.stream,client.search.query)- No Mino references (old docs file deleted)
.env.examplewith correct canonical URL- README is accurate and thorough
- No groq-sdk, no hardcoded secrets
- No shadcn boilerplate dump — only 4 UI components and all are used
- SDK instantiation inside functions, not module-level
Full rewrite from a Vite + Supabase Edge Functions app to Next.js App Router. Supabase is completely removed — no client, no Edge Functions, no VITE_SUPABASE_* env vars. Everything routes through Next.js API routes directly.
The biggest improvement is in discovery: the original discover-banks function called Lovable's AI gateway (Gemini) to hallucinate bank URLs from training data — results were often wrong or outdated. The new /api/discover-banks runs two parallel TinyFish Search queries targeted at the user's specific location, deduplicates by domain, and filters out aggregator sites so only real bank pages reach the agents.
/api/analyze-loan replaces the raw Mino SSE fetch with client.agent.stream — typed EventType.STREAMING_URL, EventType.PROGRESS, EventType.COMPLETE + RunStatus.COMPLETED, with result content validation (COMPLETED status alone is not treated as success). Agents run in parallel via Promise.allSettled and stream results back as each bank finishes.