From 18b4dabf12ed9f84aad85bf1fdc789a3b2c8cb91 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Fri, 8 May 2026 19:18:21 -0700 Subject: [PATCH] fix(examples-chat): use Pandoc citation refs ([^id]) so inline markers link The chat-streaming-md component renders citation references via @cacheplane/partial-markdown, which recognises Pandoc-style [^refId] syntax. The previous system prompt instructed the model to emit plain [1], [2] markers, which render as plain text and don't link to the sources panel. Live smoke (post Phase 2B merge) confirmed the issue: chat-message showed plain [1] in the body with the Sources panel rendered below, but inlineRefs (chat-md-citation-reference elements) was 0. System prompt + welcome suggestion now instruct the model to use [^doc-id] with the document id field returned by the search tool. Server-side probe confirms the model emits 17 markers across 3 unique document ids per response, and 0 plain [N] markers. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../chat/angular/src/app/modes/welcome-suggestions.ts | 2 +- examples/chat/python/src/graph.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/chat/angular/src/app/modes/welcome-suggestions.ts b/examples/chat/angular/src/app/modes/welcome-suggestions.ts index 04088a8ea..cae9db704 100644 --- a/examples/chat/angular/src/app/modes/welcome-suggestions.ts +++ b/examples/chat/angular/src/app/modes/welcome-suggestions.ts @@ -32,6 +32,6 @@ export const WELCOME_SUGGESTIONS: readonly WelcomeSuggestion[] = [ { label: 'What are Angular signals? (search + cite sources)', value: - 'Use the search tool to find authoritative information about Angular signals, then explain what they are and when to use them. Cite your sources inline using [1], [2] etc.', + 'Use the search tool to find authoritative information about Angular signals, then explain what they are and when to use them. Cite each source inline as [^doc-id] using the document `id` field returned by the tool.', }, ]; diff --git a/examples/chat/python/src/graph.py b/examples/chat/python/src/graph.py index c2efcfae6..fe39a9acc 100644 --- a/examples/chat/python/src/graph.py +++ b/examples/chat/python/src/graph.py @@ -41,8 +41,13 @@ "You are a helpful, concise assistant. " "Format responses with markdown when useful (headings, lists, code blocks, tables). " "When the user asks about specific Angular topics or technical questions, " - "use the `search_documents` tool to find authoritative information before answering, " - "and cite the sources inline using [1], [2], etc." + "use the `search_documents` tool to find authoritative information before answering. " + "Cite sources inline using Pandoc-style citation references with the " + "document `id` field as the refId, e.g. `[^ng-signals-overview]` or " + "`[^ng-control-flow]`. Each first-use of a document gets an auto-numbered " + "marker; subsequent references to the same document share the number. " + "Do not write `[1]` or `[1, 2]` — those are plain text and won't link to " + "the sources panel." ) # Reasoning-capable model prefixes. We only attach the ``reasoning``