fix: hide duplicate StreamingIndicator during thinking, fix plain text color in code blocks

- StreamingIndicator now only shows during 'tool_executing' state
  (ThinkingBlock already animates during 'thinking')
- Plain text code blocks force dark color (#24292f) instead of prism's
  default faded gray which was invisible on our beige background

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
程序员阿江(Relakkes) 2026-04-06 22:45:07 +08:00
parent 8cc38f6979
commit 905d4216a5
2 changed files with 15 additions and 5 deletions

View File

@ -40,6 +40,7 @@ export function CodeViewer({ code, language, maxLines = 20, showLineNumbers = tr
<pre className="m-0 bg-white p-0 font-[var(--font-mono)] text-[12px] leading-[1.3]">
{tokens.map((line, i) => {
const lineProps = getLineProps({ line })
const hasLanguage = !!language && language !== 'text'
return effectiveShowLineNumbers ? (
<div
key={i}
@ -63,10 +64,16 @@ export function CodeViewer({ code, language, maxLines = 20, showLineNumbers = tr
className="hover:bg-[#f6f8fa]/50"
style={undefined}
>
<span className="block px-3 py-px whitespace-pre-wrap break-words">
{line.map((token, key) => (
<span key={key} {...getTokenProps({ token })} />
))}
<span className={`block px-3 py-px whitespace-pre-wrap break-words ${!hasLanguage ? 'text-[#24292f]' : ''}`}>
{hasLanguage ? (
line.map((token, key) => (
<span key={key} {...getTokenProps({ token })} />
))
) : (
line.map((token, key) => (
<span key={key} {...getTokenProps({ token })} style={{ color: '#24292f' }} />
))
)}
</span>
</div>
)

View File

@ -117,7 +117,10 @@ export function MessageList() {
<AssistantMessage content={streamingText} isStreaming />
)}
{chatState !== 'idle' && chatState !== 'streaming' && chatState !== 'permission_pending' && (
{/* Only show StreamingIndicator for tool_executing state.
During 'thinking', the active ThinkingBlock already shows animation.
During 'streaming', the AssistantMessage shows the cursor. */}
{chatState === 'tool_executing' && (
<StreamingIndicator />
)}