feat: support image_search

This commit is contained in:
Henry Li
2026-01-29 08:59:55 +08:00
parent 7decdbcc83
commit 8359d842b5
4 changed files with 33 additions and 0 deletions

View File

@@ -217,6 +217,32 @@ function ToolCall({
)}
</ChainOfThoughtStep>
);
} else if (name === "image_search") {
let label: React.ReactNode = t.toolCalls.searchForRelatedImages;
if (typeof args.query === "string") {
label = t.toolCalls.searchForRelatedImagesFor(args.query);
}
return (
<ChainOfThoughtStep key={id} label={label} icon={SearchIcon}>
{Array.isArray(result) && (
<ChainOfThoughtSearchResults>
{result.map((item) => (
<ChainOfThoughtSearchResult key={item.url}>
<a href={item.url} target="_blank" rel="noreferrer">
<img
className="size-24 rounded-md object-cover"
src={item.url}
alt={item.title}
width={100}
height={100}
/>
</a>
</ChainOfThoughtSearchResult>
))}
</ChainOfThoughtSearchResults>
)}
</ChainOfThoughtStep>
);
} else if (name === "web_fetch") {
const url = (args as { url: string })?.url;
let title = url;