add exa research search, use category in search card title, update readme

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Arjun 2026-02-14 14:07:24 +05:30
parent d1a2446cb3
commit 8ef538b8c8
5 changed files with 141 additions and 4 deletions

View file

@ -2216,6 +2216,27 @@ function App() {
/>
)
}
if (item.name === 'research-search') {
const input = normalizeToolInput(item.input) as Record<string, unknown> | undefined
const result = item.result as Record<string, unknown> | undefined
const rawResults = (result?.results as Array<{ title: string; url: string; highlights?: string[]; text?: string }>) || []
const mapped = rawResults.map(r => ({
title: r.title,
url: r.url,
description: r.highlights?.[0] || (r.text ? r.text.slice(0, 200) : ''),
}))
const category = input?.category as string | undefined
const cardTitle = category ? `${category.charAt(0).toUpperCase() + category.slice(1)} search` : 'Researched the web'
return (
<WebSearchResult
key={item.id}
query={(input?.query as string) || ''}
results={mapped}
status={item.status}
title={cardTitle}
/>
)
}
const errorText = item.status === 'error' ? 'Tool error' : ''
const output = normalizeToolOutput(item.result, item.status)
const input = normalizeToolInput(item.input)

View file

@ -16,6 +16,7 @@ interface WebSearchResultProps {
query: string;
results: Array<{ title: string; url: string; description: string }>;
status: "pending" | "running" | "completed" | "error";
title?: string;
}
function getDomain(url: string): string {
@ -26,7 +27,7 @@ function getDomain(url: string): string {
}
}
export function WebSearchResult({ query, results, status }: WebSearchResultProps) {
export function WebSearchResult({ query, results, status, title = "Searched the web" }: WebSearchResultProps) {
const isRunning = status === "pending" || status === "running";
return (
@ -34,7 +35,7 @@ export function WebSearchResult({ query, results, status }: WebSearchResultProps
<CollapsibleTrigger className="flex w-full items-center justify-between gap-4 p-3">
<div className="flex items-center gap-2">
<GlobeIcon className="size-4 text-muted-foreground" />
<span className="font-medium text-sm">Searched the web</span>
<span className="font-medium text-sm">{title}</span>
</div>
<ChevronDownIcon className="size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
</CollapsibleTrigger>