mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 07:45:52 +00:00
纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
import type {
|
|
ThinkingBlock,
|
|
ThinkingBlockParam,
|
|
} from '@anthropic-ai/sdk/resources/index.mjs'
|
|
import React from 'react'
|
|
import { Box, Text } from '../../ink.js'
|
|
import { CtrlOToExpand } from '../CtrlOToExpand.js'
|
|
import { Markdown } from '../Markdown.js'
|
|
|
|
type Props = {
|
|
// Accept either full ThinkingBlock/ThinkingBlockParam or a minimal shape with just type and thinking
|
|
param:
|
|
| ThinkingBlock
|
|
| ThinkingBlockParam
|
|
| { type: 'thinking'; thinking: string }
|
|
addMargin: boolean
|
|
isTranscriptMode: boolean
|
|
verbose: boolean
|
|
/** When true, hide this thinking block entirely (used for past thinking in transcript mode) */
|
|
hideInTranscript?: boolean
|
|
}
|
|
|
|
export function AssistantThinkingMessage({
|
|
param: { thinking },
|
|
addMargin = false,
|
|
isTranscriptMode,
|
|
verbose,
|
|
hideInTranscript = false,
|
|
}: Props): React.ReactNode {
|
|
if (!thinking) {
|
|
return null
|
|
}
|
|
|
|
if (hideInTranscript) {
|
|
return null
|
|
}
|
|
|
|
const shouldShowFullThinking = isTranscriptMode || verbose
|
|
const label = '∴ Thinking'
|
|
|
|
if (!shouldShowFullThinking) {
|
|
return (
|
|
<Box marginTop={addMargin ? 1 : 0}>
|
|
<Text dimColor italic>
|
|
{label} <CtrlOToExpand />
|
|
</Text>
|
|
</Box>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Box
|
|
flexDirection="column"
|
|
gap={1}
|
|
marginTop={addMargin ? 1 : 0}
|
|
width="100%"
|
|
>
|
|
<Text dimColor italic>
|
|
{label}…
|
|
</Text>
|
|
<Box paddingLeft={2}>
|
|
<Markdown dimColor>{thinking}</Markdown>
|
|
</Box>
|
|
</Box>
|
|
)
|
|
}
|