diff --git a/app/page.tsx b/app/page.tsx index 9b69292..44d9fc9 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1361,7 +1361,7 @@ export default function Home() { )}
- {msg.role === 'user' ? '>' : '#'} + {msg.role === 'user' && >}
{msg.images && msg.images.length > 0 && (
@@ -1405,7 +1405,6 @@ export default function Home() { [OUTPUT]
- # {streamingContent ? {msg.role === 'assistant' ? '[OUTPUT]' : '[INPUT]'}
- {msg.role === 'user' ? '>' : '#'} + {msg.role === 'user' && >}
{msg.images && msg.images.length > 0 && (
diff --git a/tests/unit.test.ts b/tests/unit.test.ts index 2911460..1f20977 100644 --- a/tests/unit.test.ts +++ b/tests/unit.test.ts @@ -341,6 +341,24 @@ test('page source uses friendly client error formatting instead of raw String(er ); }); +test('assistant messages do not render a leading role hash', () => { + const pageSource = readFileSync(join(import.meta.dirname, '../app/page.tsx'), 'utf8'); + const sharePageSource = readFileSync(join(import.meta.dirname, '../app/share/[id]/page.tsx'), 'utf8'); + + assert.ok( + pageSource.includes(`{msg.role === 'user' && >}`), + 'live chat should only render the role gutter for user messages', + ); + assert.ok( + !pageSource.includes('#'), + 'live chat should not render a leading hash for assistant messages, including streaming output', + ); + assert.ok( + sharePageSource.includes(`{msg.role === 'user' && >}`), + 'shared chat should only render the role gutter for user messages', + ); +}); + test('followup UI wiring hides XML in assistant messages and submits the selected followup', () => { const pageSource = readFileSync(join(import.meta.dirname, '../app/page.tsx'), 'utf8'); const renderedMarkdownSource = readFileSync(join(import.meta.dirname, '../app/rendered-markdown.tsx'), 'utf8');