feat: support image_search

This commit is contained in:
Henry Li
2026-01-29 08:59:55 +08:00
parent 946031b79f
commit d787b1ca54
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;

View File

@@ -101,6 +101,9 @@ export const enUS: Translations = {
needYourHelp: "Need your help",
useTool: (toolName: string) => `Use "${toolName}" tool`,
searchForRelatedInfo: "Search for related information",
searchForRelatedImages: "Search for related images",
searchForRelatedImagesFor: (query: string) =>
`Search for related images for "${query}"`,
searchOnWebFor: (query: string) => `Search on the web for "${query}"`,
viewWebPage: "View web page",
listFolder: "List folder",

View File

@@ -96,6 +96,8 @@ export interface Translations {
needYourHelp: string;
useTool: (toolName: string) => string;
searchForRelatedInfo: string;
searchForRelatedImages: string;
searchForRelatedImagesFor: (query: string) => string;
searchOnWebFor: (query: string) => string;
viewWebPage: string;
listFolder: string;

View File

@@ -99,6 +99,8 @@ export const zhCN: Translations = {
needYourHelp: "需要你的协助",
useTool: (toolName: string) => `使用 “${toolName}” 工具`,
searchForRelatedInfo: "搜索相关信息",
searchForRelatedImages: "搜索相关图片",
searchForRelatedImagesFor: (query: string) => `搜索相关图片 “${query}`,
searchOnWebFor: (query: string) => `在网络上搜索 “${query}`,
viewWebPage: "查看网页",
listFolder: "列出文件夹",