File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
examples/agents-researcher/app/components Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ const CollapsibleText = ({
16
16
} ) => {
17
17
const [ isExpanded , setIsExpanded ] = useState ( false ) ;
18
18
19
+ // Ensure text starts on a new line by adding a newline if it doesn't already have one
20
+ const formattedText = text && ! text . startsWith ( '\n' ) ? `\n${ text } ` : text ;
21
+
19
22
if ( ! text || text . length <= maxLength )
20
23
return (
21
24
< div className = "border-gray-300 border-2 p-3 rounded-xl text-md font-mono break-words" >
@@ -36,12 +39,12 @@ const CollapsibleText = ({
36
39
} ,
37
40
} }
38
41
>
39
- { text }
42
+ { formattedText }
40
43
</ Markdown >
41
44
</ div >
42
45
) ;
43
46
44
- const displayText = isExpanded ? text : text . slice ( 0 , maxLength ) + "..." ;
47
+ const displayText = isExpanded ? formattedText : formattedText . slice ( 0 , maxLength ) + "..." ;
45
48
46
49
return (
47
50
< div className = "border-gray-300 border-2 p-3 rounded-xl text-md font-mono break-words" >
You can’t perform that action at this time.
0 commit comments