Skip to content

Migration lego-hunter to Tinyfish SDK #177

Open
KrishnaAgarwal7531 wants to merge 1 commit intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-lego-hunter
Open

Migration lego-hunter to Tinyfish SDK #177
KrishnaAgarwal7531 wants to merge 1 commit intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-lego-hunter

Conversation

@KrishnaAgarwal7531
Copy link
Copy Markdown
Contributor

Migrates Lego Restock Hunter from OpenAI-based URL generation to the TinyFish SDK, removing the @ai-sdk/openai and ai dependencies entirely.
The original generate-urls route used GPT-4o-mini to hallucinate search URLs for 15 hardcoded retailers — results were often wrong or outdated. The new /api/discover-retailers runs two parallel TinyFish Search queries targeted at the specific LEGO set name, finding real current product pages across retailers without any LLM involvement.
/api/search-lego replaces the raw Mino SSE fetch with client.agent.stream — typed EventType.STREAMING_URL, EventType.PROGRESS, EventType.COMPLETE + RunStatus.COMPLETED, with result content validation. Deal analysis is now built-in price sorting logic rather than a second GPT-4o-mini call — no LLM needed to determine which price is lower.

@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: a470ed9c-10cf-4812-b75a-69a3b4e6191c

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.

Thanks for the migration @KrishnaAgarwal7531! SDK integration looks solid — client.agent.stream() with parallel Promise.allSettled, client.search.query() for retailer discovery.

Blocker: build fails — TypeScript error

npm run build fails:

./app/api/search-lego/route.ts:98:49
Type error: Property 'replace' does not exist on type 'never'.

The SDK types CompleteEvent.result as Record<string, unknown> | null (never string). The typeof raw === "string" branch on line 96 narrows to never, and .replace() fails. Please fix so the build passes.

Minor (non-blocking)

  1. Stale commentroute.ts:141 says // Analyze best deal from results using Groq but the code is pure in-memory price comparison (no Groq involved).

What looks good ✓

  • SDK usage: client.agent.stream(), client.search.query(), proper EventType/RunStatus
  • SDK instantiated inside handlers, not module-level
  • .env.example correct with canonical URL
  • README accurate
  • No Groq, no Mino, no hardcoded secrets
  • Clean UI — no shadcn boilerplate dump

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