fix: context-aware web search query when PDF files are uploaded#259
Closed
YizukiAme wants to merge 5 commits intoTHU-MAIC:mainfrom
Closed
fix: context-aware web search query when PDF files are uploaded#259YizukiAme wants to merge 5 commits intoTHU-MAIC:mainfrom
YizukiAme wants to merge 5 commits intoTHU-MAIC:mainfrom
Conversation
- Extract enhanceSearchQuery into shared module lib/web-search/query-enhancer.ts - Update /api/web-search route to accept pdfText and enhance query - Pass pdfText from generation-preview client to web search API - Refactor classroom-generation.ts to use shared module
…ments
The query enhancer was silently failing because resolveModel({}) requires
server-configured env vars. In client-configured mode (no server model),
the LLM call would throw, get caught by try/catch, and fall back to
the original query - making enhancement never work.
Now the client passes its model config through the API, and the enhancer
uses it to make the LLM call.
04fa1c1 to
d27f858
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was developed in parallel with #258 to address the same issue (#246) — making web search queries context-aware when a PDF is uploaded. Both PRs independently identified the core problem: vague requirements were being sent directly to Tavily, resulting in poor search results.
Our implementation was still being iterated on while #258 has already landed a complete, tested solution covering both the preview and server generation paths. Closing in favor of #258 to avoid duplicate effort. Nice work @nkmohit!