Skip to content

Commit 688ff38

Browse files
fix: new line issue in output
1 parent a694ea2 commit 688ff38

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/agents-researcher/app/components/agent-info.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ const CollapsibleText = ({
1616
}) => {
1717
const [isExpanded, setIsExpanded] = useState(false);
1818

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+
1922
if (!text || text.length <= maxLength)
2023
return (
2124
<div className="border-gray-300 border-2 p-3 rounded-xl text-md font-mono break-words">
@@ -36,12 +39,12 @@ const CollapsibleText = ({
3639
},
3740
}}
3841
>
39-
{text}
42+
{formattedText}
4043
</Markdown>
4144
</div>
4245
);
4346

44-
const displayText = isExpanded ? text : text.slice(0, maxLength) + "...";
47+
const displayText = isExpanded ? formattedText : formattedText.slice(0, maxLength) + "...";
4548

4649
return (
4750
<div className="border-gray-300 border-2 p-3 rounded-xl text-md font-mono break-words">

0 commit comments

Comments
 (0)