Skip to content

Migration loan-decision-copilot to Tinyfish SDK #176

Open
KrishnaAgarwal7531 wants to merge 1 commit intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-loan-decision-copilot
Open

Migration loan-decision-copilot to Tinyfish SDK #176
KrishnaAgarwal7531 wants to merge 1 commit intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-loan-decision-copilot

Conversation

@KrishnaAgarwal7531
Copy link
Copy Markdown
Contributor

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0851a60c-25ff-4d42-8a6a-0307c29507e3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@simantak-dabhade simantak-dabhade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/sdk usage (client.agent.stream, client.search.query)
  • No Mino references (old docs file deleted)
  • .env.example with 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants