Skip to content

fix(demo): name the sites Perplexity cites for the prompts it misses, from the demo's data - #2098

Merged
gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/demo-chat
Nov 3, 2026
Merged

gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:feature/demo-chat

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The demo brand's Chat has sample chats, instead of the real Chat locked and empty (#1999). This is part 1 of "demo shows Chat and Agent Center one-to-one" (priority 4 after launch); Agent Center is the PR stacked on this one. No migration.

What the demo builds (server/src/lib/demo/chat.js, DEMO_VERSION 4):

  • Five chats for each person of the organization, on the demo brand:
    • How visible is Brewline in AI answers this week? (with a follow-up: "And on Perplexity?")
    • What should I work on first?
    • Which sites do AI answers cite for our prompts? (asked from the Citations page's side panel)
    • Compare us with Northbound Roasters
    • Which subscription questions don't name us?
  • Each answer has the reads Chat made as steps ("Read Visibility · Last 7 days · … · 216 rows"), the "Data used" chips, Generated / Data as of, and next moves under the chat's latest answer.
  • Every figure is counted from the demo's own answers (stats.js), so it matches the pages the chat links to: the Action Center's actions (with their Priority Score) and the Content Editor's drafts. A test checks every link points at a demo action or draft, and that every site named is a .example domain.
  • The chats are read (last_read_at), so they list as chats in the menu, not as news in the Inbox.
  • A chat is its author's (CHAT-20 §16c): each person gets their own copy. Someone who joins later gets theirs at the next rebuild (at most 3 days).

Nothing runs on them:

  • POST /api/chat/runs refuses a message in a chat on the demo brand, or a new chat on it, with the server's demo_brand 402 before anything is kept or run.
  • The page opens the plans (SAVE50) on it, as for a read-only workspace.
  • This matters beyond the gate: an answer on the demo brand would still use the workspace's AI if its plan is active (an admin showed the demo again after buying).

Hiding the demo brand deletes its chats, since Chat's menu lists a person's chats of every brand:

  • in the brand menu (setDemoHidden);
  • after a purchase (hideDemoBrandAfterPurchase).

Showing it again marks it stale, so the next visit rebuilds it with them.

Coverage:

  • chat_conversations is now built by the demo.
  • agent_conversations (the old Agent chat, 00009) is skipped with its reason.

Not in this PR:

Related issue

None. Priority queue item 4 (demo shows Chat and Agent Center one-to-one).

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

Unit tests:

  • Server lib/demo/chat.test.js:
    • each person's chats;
    • question before answer, with its run, steps and end;
    • dates before now, and read;
    • next moves only under the latest answer, ≤ 80 characters;
    • figures from the demo's answers;
    • links only to demo actions and drafts, .example domains only;
    • the build's write order;
    • no people, at most MAX_PEOPLE sets;
    • hideDemoChats.
  • Server index.test.js: hiding deletes the chats; showing again marks the demo stale.
  • Server coverage.test.js: chat_conversations built, agent_conversations skipped.
  • Web app/api/chat/runs/route.test.ts: a message in a demo brand's chat, or a new chat on it, is a 402 demo_brand and the engine isn't called; another brand's goes on.
  • Web chat-thread-view.test.tsx: a demo_brand 402 opens the plans, not a toast.
  • Web lib/demo/hide-after-purchase.test.ts: the purchase hides the demo brand and deletes its chats.

Manually:

  1. Open the demo brand (Brewline Coffee) and Chat. The menu lists the five chats under Today and Previous 7 days, labelled Brewline Coffee.
  2. Open "How visible is Brewline…": steps, table, follow-up, Data used, next moves.
  3. Click a next move or send a message: the plan dialog opens and nothing runs.
  4. Open "What should I work on first?": the action links open the Action Center's actions, and the Content Editor link opens the draft.

Screenshots: .claude/mockups/demo-chat/, at 1024 px:

  • the Chat menu (light);
  • the visibility chat (light and dark);
  • the follow-up with next moves (light and dark);
  • a next move opening the plans;
  • the priorities chat (dark).

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

CI passed on this branch (acf29d6), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41680854166): schema is up to date; web format:check, lint, typecheck, all tests and yarn build pass; server lint, format:check and all tests pass.

🤖 Generated with Claude Code

cihan-gyk and others added 3 commits November 3, 2026 16:03
The demo brand showed the real Chat, locked and empty (ansvisor#1999). A new demo
module (lib/demo/chat.js, DEMO_VERSION 4) now gives each person of the
organization five chats on the demo brand, as if they had asked them: the
questions, the reads Chat made as steps, the "Data used" chips, next moves
under the latest answer, and answers whose figures are counted from the
demo's own answers (stats.js) and link to its Action Center actions and
Content Editor drafts. A chat is its author's, so each person gets their
own copy; someone who joins later gets theirs at the next rebuild.

Sending in one, or starting a chat on the demo brand, is refused with the
server's demo_brand 402 before anything is kept or run (POST
/api/chat/runs), and the page opens the plans, as for a read-only
workspace: an answer on the demo brand would still use the workspace's AI.

Hiding the demo brand (the brand menu, or the purchase) deletes its chats,
since Chat's menu lists a person's chats of every brand; showing it again
marks it stale, so the next visit rebuilds it with them.

chat_conversations is now built by the demo; agent_conversations (the old
Agent chat) is skipped with its reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 522ed84.

Approve preview

gkhngyk
gkhngyk previously approved these changes Nov 3, 2026
@gkhngyk

gkhngyk commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Conflicts with main. Please merge main in; #2102 needs the same after it.

@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main in (one conflict in chat-home.tsx, now on the shared startChatRun) and a skill's Run on the demo brand opens the plans too.

@gkhngyk
gkhngyk merged commit d6124e9 into ansvisor:main Nov 3, 2026
6 checks passed
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.

2 participants