Repository navigation
Description
Summary
The prompt result detail page (/dashboard/insights/[id]) shows a single AI answer — its response and the citations for that answer. We now also capture the observed query fan-out per result (prompt_results.search_queries, from #332/#341): the sub-queries the engine actually ran to build that specific answer. Surface it on this page, under the Citations section, so a user reading one answer can see exactly which sub-queries produced it.
Today the fan-out is only shown aggregated brand-wide in the Query Fan-out tab (#333). This adds the per-answer view where it's most contextual.
What to change
1. Carry search_queries through to the result type — web/src/lib/actions/tracking.ts
getPromptResultByIdalready doesselect('*'), sosearch_queriesis fetched from the DB — it's just dropped bymapResultRow.- Add a
searchQueriesfield to thePromptResulttype (array of{ query: string; engine?: string; source_platform: string }), and map it inmapResultRow:searchQueries: (row.search_queries as …) ?? [].
2. Render a "Query fan-out" section — web/src/app/[locale]/(dashboard)/dashboard/insights/[id]/page.tsx
- Below the existing Citations block, add a Query fan-out section, rendered only when
result.searchQueries.length > 0. - List each observed sub-query with its engine/source chip (reuse
PLATFORM_LABELS[source_platform] ?? source_platform; keep Perplexity'senginelabel if present). Read-only.
Explicit non-goals (v1)
- No aggregation / "times searched" /
+ trackhere — those belong to the brand-wide Query Fan-out tab (feat(prompts): Query Fan-out tab — observed engine sub-queries with times-searched + one-click track #333). This is just the observed sub-queries for this one answer. - No LLM / intent classification needed — keep it a plain list.
Notes
- Fan-out is sparse and mostly emitted by Copilot and Perplexity (per feat(tracking): capture & store observed query fan-out (Cloro searchQueries / search_model_queries) #332), so most answers will have none — only render the section when
search_queriesis non-empty (no empty header). - Depends on feat(tracking): capture & store observed query fan-out (Cloro searchQueries / search_model_queries) #332/feat(tracking): capture & store observed query fan-out (Cloro searchQueries) #341 (the
search_queriescolumn, already merged).
How to test
- Open a result detail page (
/dashboard/insights/[id]) for a Copilot or Perplexity answer that has fan-out → a Query fan-out section appears under Citations listing the observed sub-queries with their engine chips. - A ChatGPT / Google answer (no fan-out) shows no fan-out section — no empty block.
- The response and citations are unchanged.
Activity
waynedeng01 commentedon Jul 7, 2026
Hi, I'd like to work on this. I'll keep the change focused on carrying search_queries into PromptResult and rendering the query fan-out below Citations with the requested platform/engine labels.
Maqbool61 commentedon Jul 7, 2026
Hi @gkhngyk 👋 — I'd like to take this one. Here's my exact plan after reading the code:
web/src/types/index.tsAdd
searchQueriestoPromptResult:web/src/lib/actions/tracking.ts—mapResultRowMap the new field:
web/src/app/[locale]/(dashboard)/dashboard/insights/[id]/page.tsxAdd a new Card section after Citations, only when
result.searchQueries?.length > 0:Networkicon from lucide-reactPLATFORM_LABELSmap already in the fileNo new dependencies, no backend changes, no aggregation. Three file touches total.