feat: enhance search_image

This commit is contained in:
Henry Li
2026-01-29 09:19:43 +08:00
parent 8359d842b5
commit c700bd6841

View File

@@ -222,22 +222,37 @@ function ToolCall({
if (typeof args.query === "string") { if (typeof args.query === "string") {
label = t.toolCalls.searchForRelatedImagesFor(args.query); label = t.toolCalls.searchForRelatedImagesFor(args.query);
} }
const results = (
result as {
results: {
source_url: string;
thumbnail_url: string;
image_url: string;
title: string;
}[];
}
)?.results;
return ( return (
<ChainOfThoughtStep key={id} label={label} icon={SearchIcon}> <ChainOfThoughtStep key={id} label={label} icon={SearchIcon}>
{Array.isArray(result) && ( {Array.isArray(results) && (
<ChainOfThoughtSearchResults> <ChainOfThoughtSearchResults>
{result.map((item) => ( {Array.isArray(results) &&
<ChainOfThoughtSearchResult key={item.url}> results.map((item) => (
<a href={item.url} target="_blank" rel="noreferrer"> <a
className="size-24 overflow-hidden rounded-lg object-cover"
key={item.image_url}
href={item.source_url}
target="_blank"
rel="noreferrer"
>
<img <img
className="size-24 rounded-md object-cover" className="size-24 object-cover"
src={item.url} src={item.thumbnail_url}
alt={item.title} alt={item.title}
width={100} width={100}
height={100} height={100}
/> />
</a> </a>
</ChainOfThoughtSearchResult>
))} ))}
</ChainOfThoughtSearchResults> </ChainOfThoughtSearchResults>
)} )}