diff --git a/ui/desktop/src/ChatWindow.tsx b/ui/desktop/src/ChatWindow.tsx index 5d7c6ce1..e3e81a24 100644 --- a/ui/desktop/src/ChatWindow.tsx +++ b/ui/desktop/src/ChatWindow.tsx @@ -111,8 +111,6 @@ function ChatContent({ const fetchResponses = await askAi(promptTemplates); setMessageMetadata((prev) => ({ ...prev, [message.id]: fetchResponses })); - - console.log('All responses:', fetchResponses); }, }); @@ -302,7 +300,6 @@ export default function ChatWindow() { * Utility to ask the LLM any question to clarify without wider context. */ async function askAi(promptTemplates: string[]) { - console.log('askAi called...'); const responses = await Promise.all( promptTemplates.map(async (template) => { const response = await fetch(getApiUrl('/ask'), { @@ -318,7 +315,6 @@ async function askAi(promptTemplates: string[]) { } const data = await response.json(); - console.log('ask Response:', data.response); return data.response; }) diff --git a/ui/desktop/src/components/GooseResponseForm.tsx b/ui/desktop/src/components/GooseResponseForm.tsx index 9c93f966..d2e7723d 100644 --- a/ui/desktop/src/components/GooseResponseForm.tsx +++ b/ui/desktop/src/components/GooseResponseForm.tsx @@ -19,8 +19,6 @@ export default function GooseResponseForm({ message, metadata, append }: GooseRe let isOptions = false; let options = []; - console.log('metadata:', metadata[0]); - if (metadata) { isReady = metadata[0] === "READY"; isQuestion = metadata[0] === "QUESTION"; diff --git a/ui/desktop/src/components/ToolInvocations.tsx b/ui/desktop/src/components/ToolInvocations.tsx index 3a63e506..199f6fa4 100644 --- a/ui/desktop/src/components/ToolInvocations.tsx +++ b/ui/desktop/src/components/ToolInvocations.tsx @@ -64,16 +64,17 @@ function ToolCall({ call }: ToolCallProps) { interface ResultItem { - text?: string - type: 'text' | 'image' - mimeType?: string - data?: string // Base64 encoded image data + text?: string; + type: 'text' | 'image'; + mimeType?: string; + data?: string; // Base64 encoded image data + audience?: string[]; // Array of audience types } interface ToolResultProps { result: { message?: string - result?: ResultItem[] | string + result?: ResultItem[] state?: string toolCallId?: string toolName?: string @@ -83,46 +84,55 @@ interface ToolResultProps { } function ToolResult({ result }: ToolResultProps) { - if (!result || !result.result) return null + // If no result info, don't show anything + if (!result || !result.result) return null; - return ( + // Normalize to an array + const results = Array.isArray(result.result) + ? result.result + : [result.result]; + + // Find results where either audience is not set, or it's set to a list that contains user + const filteredResults = results + .filter((item: ResultItem) => !item.audience || item.audience?.includes('user')) + + if (filteredResults.length === 0) return null; + + return (
Tool Result: {result.toolName.substring(result.toolName.lastIndexOf("__") + 2)}
- {Array.isArray(result.result) ? ( -
- {result.result.map((item: ResultItem, index: number) => ( -
- {item.type === 'text' && item.text && ( - - {item.text} - - )} - {item.type === 'image' && item.data && item.mimeType && ( - Tool result { - console.error('Failed to load image: Invalid MIME-type encoded image data'); - e.currentTarget.style.display = 'none'; - }} - /> - )} -
- ))} -
- ) : ( - - {result.result} - - )} +
+ {filteredResults.map((item: ResultItem, index: number) => ( +
+ {item.type === 'text' && item.text && ( + + {item.text} + + )} + {item.type === 'image' && item.data && item.mimeType && ( + Tool result { + console.error('Failed to load image: Invalid MIME-type encoded image data'); + e.currentTarget.style.display = 'none'; + }} + /> + )} +
+ ))} +
- ) + ); } + + + // Utils const convertArgsToMarkdown = (args: Record): string => { diff --git a/ui/desktop/src/utils/urlUtils.ts b/ui/desktop/src/utils/urlUtils.ts index d4f2a066..9b8df9ad 100644 --- a/ui/desktop/src/utils/urlUtils.ts +++ b/ui/desktop/src/utils/urlUtils.ts @@ -28,7 +28,6 @@ export function extractUrls(content: string, previousUrls: string[] = []): strin const normalizedPreviousUrls = previousUrls.map(normalizeUrl); const normalizedCurrentUrls = currentUrls.map(url => { const normalized = normalizeUrl(url); - console.log('Normalizing URL:', { original: url, normalized }); return normalized; }); @@ -38,18 +37,8 @@ export function extractUrls(content: string, previousUrls: string[] = []): strin const isDuplicate = normalizedPreviousUrls.some(prevUrl => normalizeUrl(prevUrl) === normalized ); - console.log('URL comparison:', { - url, - normalized, - previousUrls: normalizedPreviousUrls, - isDuplicate - }); return !isDuplicate; }); - - console.log('Content:', content); - console.log('Found URLs:', uniqueUrls); - console.log('Previous URLs:', previousUrls); - + return uniqueUrls; } \ No newline at end of file