Skip to content

feat(prompts): manage prompts in one place, on the Prompts page - #2473

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feat/prompts-manage-in-page
Nov 17, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:feat/prompts-manage-in-page

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Stacked on #2472. Until it lands, this diff also shows its commits.

Summary

People now manage prompts in one place: the Prompts page. The three features only the brand's Manage prompts page had are moved in, and the Manage prompts links are gone.

  • Generate by topic is on Prompt Suggestions.
  • Edit before adding works for every suggestion.
  • Track now is on Tracked Prompts.

Changes

Prompt Suggestions

  • New By topic button (and Generate by topic on an empty list). It opens a picker with the brand's topics, all ticked, and says how many prompts that makes (5 a topic).
  • It uses the brand page's own call (generatePromptsFromTopics), so the same limits, batching and day limit apply. Admins and managers only; a read-only plan opens the upgrade dialog.
  • The prompts show at the top of the suggestions, grouped by topic. Each has a checkbox (on) and editable text. Add selected, Regenerate and Dismiss work as on the old page.
  • Add selected saves through importPrompts, the call Add prompt's list uses. Each prompt goes under the topic it was written for, with every engine the plan allows and the brand's location. Past the plan's limit, the rest wait for a spot (the usual toast). Duplicates are skipped and counted.
  • One difference from the old page: because importPrompts starts a first tracking run when it can, prompts added this way start tracking at once, as prompts added with Add prompt already do. The old page only saved them.
  • Every suggestion has a pencil: Enter or the tick keeps the edit, Esc or the cross drops it. + and Add All save the edited text. acceptSuggestion takes an optional text, and trackSuggestions takes optional texts by id. Both are checked on the server (1 to 500 characters) after the plan guard.

Tracked Prompts

  • Track now: a quiet line in the table's status line, "● 3 prompts have no answers yet · Track now". The bulk bar also gets Track now (or Track N now) for the selected prompts with no answers yet.
  • It uses the brand page's own API calls: GET /api/tracking/unanalyzed/:brandId to find the prompts, and POST /api/tracking/analyze-new to start them. The read only runs for admins and managers, and only when the table has an active prompt with no answers in its window. No new server action, no prompt_results scan of our own.
  • On success it saves the tracking job (same job store), stays on the page and says "Tracking 3 prompts now · See answers" (links to Visibility, which shows the run). Refusals show the API's words; a 402 opens the upgrade dialog.
  • Plan guard: "Tracking prompts needs a plan".

Manage prompts removed

  • Gone from the "…" menu. The menu now shows on the Prompts tab only: on Query Fan-out and Insights it held nothing else.
  • Gone from the empty state. Admins and managers keep Add prompt; others read "Ask an admin or a manager to add prompts."

Other links

  • Brand card: the prompts row and its + open Tracked Prompts for that brand (the card selects the brand first). The Prompts page has no address that opens Add prompt, so + lands where Add prompt is.
  • Mobile menu: the extra "Prompts" link to the brand page is removed. The menu's own Prompts item already opens the Prompts page, as the desktop sidebar does. Pointing the extra link there would have shown two "Prompts" rows.
  • Old route /dashboard/brands/[id]/prompts is unchanged. The Prompts page has no way to open for a given brand (no brand search param or redirect pattern), so there is no redirect. The brand layout's own Prompts tab still links to it.

Help

  • Updated Add prompts, Prompt Suggestions and Tracked Prompts. Regenerated approved-articles.json.

Moved, not changed

  • useAllowedEngines and brandLocation moved from page.tsx to _prompt-defaults.ts, so Generate by topic uses the same defaults.

How to test

  1. As an admin, open Prompts › Suggestions. Click By topic, untick a topic, click Generate.
  2. Check the prompts are grouped by topic, 5 each, all ticked. Untick one, edit one (pencil, type, Enter), and try Esc on another.
  3. Click Add selected. Check the prompts appear in Tracked under the right topics, with the plan's engines and the brand's location.
  4. Generate again and try Regenerate and Dismiss.
  5. Edit a normal suggestion's text and click +. Check the tracked prompt has the edited text. Repeat with Add All.
  6. On Tracked, add a prompt. Check the "no answers yet · Track now" line. Click Track now: the page stays, the line says the run started, and See answers opens Visibility with the run.
  7. Tick a prompt with no answers and one with answers: the bar says Track 1 now.
  8. As a member: no By topic, no pencils, no Track now line. On a read-only plan, each button opens the upgrade dialog.
  9. Check the "…" menu has no Manage prompts, and Query Fan-out and Insights show no "…".
  10. On the brands page, click a card's prompts row and +: both open Tracked Prompts for that brand.

Checks


Generated by Claude Code

The owner's simpler header for Prompts › Tracked Prompts:

- Title only: the subtitle sentence is gone; the AI meter and Ask Chat
  stay at the right.
- Beside the tabs: Add prompt and a "…" (More actions) menu with Export
  CSV, Manage prompts, Plan & usage and Show usage. Query Fan-out and
  Insights keep Manage prompts in "…"; Topics keeps its own buttons.
- Tracked | Suggestions is one compact switch (links with
  aria-current, same routes and in-place move as the old sub-tabs),
  Tracked with its count, and the date range at the right of the same
  row without its label.
- The Tracked Prompts card is gone. Its Show opened the usage cards;
  "…" › Show usage opens them now, with Hide to fold them, and says
  when the prompt locations are nearly or fully used.
- Location moves into the table's filter row, with no label.
- The not-analyzed banner is one quiet line under the filter row:
  "● 1 prompt not analyzed yet · Analyze", which runs the same volume
  analysis.

Help: tracked-prompts, prompt-suggestions, add-prompts and
prompt-insights updated; approved articles regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The folded usage cards used to say "46 / 50 prompt locations" in amber
or red in the Tracked Prompts bar; with the bar gone that warning was
only inside the "…" menu. The table's status line now also says
"● 46 / 50 prompt locations used · Plan & usage" when the plan's prompt
locations are nearly (amber) or fully (red) used, beside the
not-analyzed line, wrapping when both show. Plan & usage goes where the
menu's does. The menu keeps its copy.

Help: tracked-prompts says where the warning shows. Its last "Export
CSV downloads the list" line is back as it was (the new section says
where Export CSV is), which keeps it clear of ansvisor#2471's paragraph next to
it. Approved articles regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Bring the last features of the brand's Manage prompts page into the
Prompts page, and take the Manage prompts links away:

- Prompt Suggestions: By topic picks some of the brand's topics and the
  brand page's generation call writes 5 prompts for each. They are listed
  at the top of the suggestions, grouped by topic, ticked and editable,
  with Add selected (saved under their topic, with the plan's engines and
  the brand's location, as Add prompt's list saves them), Regenerate and
  Dismiss. Admins and managers; the plan guard as before.
- Every suggestion's text can be edited before it is added (pencil, Enter
  keeps it, Esc drops it); + and Add All save the edited text.
  acceptSuggestion and trackSuggestions take the edited text.
- Tracked Prompts: Track now, in the status line and the bulk bar, for
  the active prompts with no answers yet, read and started with the
  brand page's own API calls; the run is saved as the brand's tracking
  job and the line links to Visibility. No navigation away.
- Manage prompts leaves the "..." menu (which now shows on the Prompts
  tab only) and the empty state; a member's empty state says whom to ask.
- The brand card's prompts row opens Tracked Prompts for that brand; the
  mobile menu's second Prompts link goes, the menu's own Prompts item
  opening the page.
- Help: Add prompts, Prompt Suggestions and Tracked Prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
gkhngyk previously approved these changes Nov 17, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor: _topic-prompts.tsx addSelected sends the topic name though item.topicId is there; passing topicId would survive a rename between generating and adding.

@cihan-gyk
cihan-gyk dismissed gkhngyk’s stale review November 17, 2026 18:04

The merge-base changed after approval.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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