feat: enhance search_image

This commit is contained in:
Henry Li
2026-01-29 09:19:43 +08:00
parent d787b1ca54
commit f7ec116c26

View File

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