File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ describe("ReasoningBlock", () => {
7070 idle . unmount ( ) ;
7171 } ) ;
7272
73+ test ( "summary wording is overridable" , ( ) => {
74+ const streaming = mount ( { text : "Going." , streaming : true , streamingLabel : "Working…" } ) ;
75+ expect ( streaming . summary ( ) ?. textContent ) . toBe ( "Working…" ) ;
76+ streaming . unmount ( ) ;
77+
78+ const idle = mount ( { text : "Done." , idleLabel : "Reasoning" } ) ;
79+ expect ( idle . summary ( ) ?. textContent ) . toBe ( "Reasoning" ) ;
80+ idle . unmount ( ) ;
81+ } ) ;
82+
7383 test ( "streaming-to-idle on the same instance updates the summary and busy state" , ( ) => {
7484 const handle = mount ( { text : "Reasoning." , streaming : true } ) ;
7585 expect ( handle . summary ( ) ?. textContent ) . toBe ( "Thinking…" ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ export type ReasoningBlockProps = {
88 readonly text : string ;
99 /** Still streaming. Changes the summary wording and marks the body busy. */
1010 readonly streaming ?: boolean ;
11+ /** Summary while streaming. Defaults to "Thinking…". */
12+ readonly streamingLabel ?: string ;
13+ /** Summary once idle when no `durationLabel` is supplied. Defaults to "Thinking". */
14+ readonly idleLabel ?: string ;
1115 /** e.g. "Thought for 4s". Becomes the summary once reasoning has stopped streaming. */
1216 readonly durationLabel ?: string ;
1317 readonly defaultOpen ?: boolean ;
@@ -37,6 +41,8 @@ export type ReasoningBlockProps = {
3741export function ReasoningBlock ( {
3842 text,
3943 streaming = false ,
44+ streamingLabel = "Thinking…" ,
45+ idleLabel = "Thinking" ,
4046 durationLabel,
4147 defaultOpen = false ,
4248 open : openProp ,
@@ -52,7 +58,7 @@ export function ReasoningBlock({
5258
5359 if ( text . trim ( ) . length === 0 ) return null ;
5460
55- const summary = streaming ? "Thinking…" : ( durationLabel ?? "Thinking" ) ;
61+ const summary = streaming ? streamingLabel : ( durationLabel ?? idleLabel ) ;
5662
5763 return (
5864 < details
You can’t perform that action at this time.
0 commit comments