feat: wrap path and command in Tooltip for enhanced user experience

This commit is contained in:
Henry Li
2026-02-02 09:23:36 +08:00
parent 33e82a7abe
commit 076c1f0985

View File

@@ -283,9 +283,11 @@ function ToolCall({
> >
<ChainOfThoughtSearchResult> <ChainOfThoughtSearchResult>
{url && ( {url && (
<a href={url} target="_blank" rel="noreferrer"> <Tooltip content={<pre>{result as string}</pre>}>
{title} <a href={url} target="_blank" rel="noreferrer">
</a> {title}
</a>
</Tooltip>
)} )}
</ChainOfThoughtSearchResult> </ChainOfThoughtSearchResult>
</ChainOfThoughtStep> </ChainOfThoughtStep>
@@ -300,7 +302,11 @@ function ToolCall({
return ( return (
<ChainOfThoughtStep key={id} label={description} icon={FolderOpenIcon}> <ChainOfThoughtStep key={id} label={description} icon={FolderOpenIcon}>
{path && ( {path && (
<ChainOfThoughtSearchResult>{path}</ChainOfThoughtSearchResult> <Tooltip content={<pre>{result as string}</pre>}>
<ChainOfThoughtSearchResult className="cursor-pointer">
{path}
</ChainOfThoughtSearchResult>
</Tooltip>
)} )}
</ChainOfThoughtStep> </ChainOfThoughtStep>
); );
@@ -310,11 +316,15 @@ function ToolCall({
if (!description) { if (!description) {
description = t.toolCalls.readFile; description = t.toolCalls.readFile;
} }
const path: string | undefined = (args as { path: string })?.path; const { path } = args as { path: string; content: string };
return ( return (
<ChainOfThoughtStep key={id} label={description} icon={BookOpenTextIcon}> <ChainOfThoughtStep key={id} label={description} icon={BookOpenTextIcon}>
{path && ( {path && (
<ChainOfThoughtSearchResult>{path}</ChainOfThoughtSearchResult> <Tooltip content={<pre>{result as string}</pre>}>
<ChainOfThoughtSearchResult className="cursor-pointer">
{path}
</ChainOfThoughtSearchResult>
</Tooltip>
)} )}
</ChainOfThoughtStep> </ChainOfThoughtStep>
); );
@@ -371,12 +381,14 @@ function ToolCall({
icon={SquareTerminalIcon} icon={SquareTerminalIcon}
> >
{command && ( {command && (
<CodeBlock <Tooltip content={<pre>{result as string}</pre>}>
className="mx-0 border-none px-0" <CodeBlock
showLineNumbers={false} className="mx-0 cursor-pointer border-none px-0"
language="bash" showLineNumbers={false}
code={command} language="bash"
/> code={command}
/>
</Tooltip>
)} )}
</ChainOfThoughtStep> </ChainOfThoughtStep>
); );