Repository navigation
feat(ui): show and copy the prompt a refresh would send; fix web search count - #54
Merged
Merged
Conversation
A Prompt button on the Read next and Discover tabs opens the exact system and user messages a refresh would send right now, built from the library as it is, with the model, an approximate token count and whether web search is on. Copy prompt copies both messages; Copy full request copies the JSON body OpenRouter gets, with the answer schema and the web search tool. GET /api/recommendations/prompt?kind=read_next|discover builds it with the same code as a refresh (shared buildRecPrompt), so the preview can't drift from what is sent. It needs no API key.
Chat completions report OpenRouter's web searches under usage.server_tool_use_details.web_search_requests (checked with a real request), not server_tool_use, so every Discover run showed 0 searches. Both names are read now.
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.
What
A Prompt button on the For You page's Read next and Discover tabs. It opens the exact prompt a refresh would send right now, built from the library as it is:
require_parametersand the web search tool). A collapsible section shows the full request in the dialog too.Copying falls back to
execCommand('copy')where the Clipboard API is missing (plain http).How
GET /api/recommendations/prompt?kind=read_next|discoverbuilds the request withbuildRecPrompt. The refresh now uses that same function, so the preview and what is actually sent can't drift apart. It doesn't call OpenRouter and works without a key.Testing
Fix: web search count
Discover runs always showed 0 web searches. A real chat completion with the web search tool (one tiny request, 2026-10-13) reports the count under
usage.server_tool_use_details.web_search_requests, notserver_tool_use. Both are read now, and the tests use the real response shape. The recorded cost was already right.