diff --git a/frontend/src/lib/components/chat/ToolCallDisplay.svelte b/frontend/src/lib/components/chat/ToolCallDisplay.svelte index 86dd9c6..e66d37a 100644 --- a/frontend/src/lib/components/chat/ToolCallDisplay.svelte +++ b/frontend/src/lib/components/chat/ToolCallDisplay.svelte @@ -90,10 +90,27 @@ return labels[key] || key; } + /** Search result item */ + interface SearchResultItem { + rank: number; + title: string; + url: string; + snippet: string; + } + + /** Parsed result with structured data */ + interface ParsedResult { + type: 'search' | 'location' | 'fetch' | 'json' | 'text' | 'empty'; + summary: string; + full: string; + searchResults?: SearchResultItem[]; + query?: string; + } + /** * Parse result content (could be JSON or plain text) */ - function parseResult(result: string | undefined): { type: string; summary: string; full: string } { + function parseResult(result: string | undefined): ParsedResult { if (!result) return { type: 'empty', summary: 'No result', full: '' }; try { @@ -105,7 +122,9 @@ return { type: 'search', summary: `Found ${count} results for "${json.query}"`, - full: result + full: result, + searchResults: json.results as SearchResultItem[], + query: json.query }; } @@ -295,7 +314,35 @@ {#if isResultExpanded && hasResult && parsed.full}
{parsed.full.length > 10000 ? parsed.full.substring(0, 10000) + '\n\n... (truncated)' : parsed.full}
+ {#if parsed.type === 'search' && parsed.searchResults}
+
+ {result.title}
+{result.url}
+ {#if result.snippet && result.snippet !== '(no snippet available)'} +{result.snippet}
+ {/if} +{parsed.full.length > 10000 ? parsed.full.substring(0, 10000) + '\n\n... (truncated)' : parsed.full}
+ {/if}