Repository navigation
Closed
Labels
Description
Summary
Add a second view to the Query Fan-out tab — Query Fanouts by Prompts — that shows the same observed fan-out data, but grouped by the prompt it came from instead of one flat list. At the top is a table of the brand's prompts; clicking the expand arrow on a prompt reveals the sub-queries that prompt's answers actually ran.
It's the same data as the "High frequency" list (#349), just pivoted: instead of "sub-query → which prompts sourced it", this is "prompt → which sub-queries it fanned out into".
What to change
- A Query Fanouts by Prompts table: one row per prompt (that has any observed fan-out), showing the prompt text and a count of its distinct sub-queries.
- Each row is expandable via a chevron/arrow; expanding reveals that prompt's sub-queries, reusing the same columns as the flat table (sub-query, engine chip, times searched, +/Tracked).
- Empty state when a brand has no fan-out yet (same clear notice as the flat view).
Where
web/src/app/[locale]/(dashboard)/dashboard/prompts/_fanout-tab.tsx— the grouped/expandable table.web/src/lib/actions/fanout.ts— the data can be derived from the existinggetQueryFanoutresult (eachsubQueryalready carries itssourcedPrompts, so invert sub-query→prompts into prompt→sub-queries client-side), or add a dedicatedgetQueryFanoutByPrompt(brandId, { days })action if a server-shaped grouping is cleaner. Either way, no new columns — the sub-query rows reuse the existing shape.
Layout
- Recommend a toggle on the Query Fan-out tab between High frequency (feat(prompts): paginate the Query Fan-out "High frequency" table (10 per page) #349, the flat paginated list) and By prompt (this view), so the two lenses share the tab.
Notes
- Depends on the Query Fan-out feature (feat(prompts): Query Fan-out tab — observed sub-queries with times-searched + one-click track #342 / feat(prompts): Query Fan-out tab — observed engine sub-queries with times-searched + one-click track #333) and pairs with feat(prompts): paginate the Query Fan-out "High frequency" table (10 per page) #349.
- The "+"/Tracked action inside an expanded prompt behaves exactly like the flat list (promote a sub-query to a tracked prompt).
How to test
/dashboard/prompts?tab=fanout→ By prompt view: a table of prompts that produced fan-out, each with its sub-query count.- Click a prompt's expand arrow → its observed sub-queries appear (engine, times searched, +/Tracked), matching what the flat "High frequency" list shows for the same sub-queries.
- A prompt with no fan-out isn't listed; a brand with no fan-out shows the empty state.
- Tracking a sub-query from inside an expanded prompt works the same as from the flat list.
Activity