Skip to content

Commit 23dc5b1

Browse files
committed
feat(chat): make ThinkingBlock title support i18n via label prop
Add optional label prop to ThinkingBlock with default value 'Thinking', and pass the translated string from web layer using thinking.thinkingProcess key.
1 parent 809e242 commit 23dc5b1

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/ui/src/chat/thinking-block.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type ThinkingBlockProps = {
1313
children: React.ReactNode;
1414
defaultOpen?: boolean;
1515
className?: string;
16+
label?: string;
1617
};
1718

1819
function ThinkingBlock({
@@ -21,6 +22,7 @@ function ThinkingBlock({
2122
children,
2223
defaultOpen = false,
2324
className,
25+
label = 'Thinking',
2426
}: ThinkingBlockProps) {
2527
const [open, setOpen] = React.useState(defaultOpen);
2628
const contentRef = React.useRef<HTMLDivElement>(null);
@@ -65,7 +67,7 @@ function ThinkingBlock({
6567
open && 'rotate-90'
6668
)}
6769
/>
68-
<span>Thinking</span>
70+
<span>{label}</span>
6971
{duration != null && (
7072
<span className="text-foreground-ghost ml-0.5">
7173
&middot; {duration}s

packages/web/src/components/chat/message-item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ function AssistantContent({ parts }: { readonly parts: UIMessage['parts'] }) {
189189
key={`reasoning-${i}`}
190190
isStreaming={rp.state !== 'done'}
191191
defaultOpen={rp.state !== 'done'}
192+
label={t('thinking.thinkingProcess')}
192193
>
193194
<div className="whitespace-pre-wrap">{rp.text || '...'}</div>
194195
</ThinkingBlock>

0 commit comments

Comments
 (0)