Skip to content

An AI-powered search engine with a generative UI

fix: display search results from manual tool calls

Yoshiki Miurab75a7547be1e
diff --git a/components/chat-messages.tsx b/components/chat-messages.tsx
index be999337..5b032c33 100644
--- a/components/chat-messages.tsx
+++ b/components/chat-messages.tsx
@@ -77,6 +77,9 @@ export function ChatMessages({
const showLoading = isLoading && messages[messages.length - 1].role === 'user'
const getIsOpen = (id: string) => {
+ if (id.includes('call')) {
+ return openStates[id] ?? true
+ }
const baseId = id.endsWith('-related') ? id.slice(0, -8) : id
const index = messages.findIndex(msg => msg.id === baseId)
return openStates[id] ?? index >= lastUserIndex
diff --git a/components/render-message.tsx b/components/render-message.tsx
index d5cf36b8..3549a347 100644
--- a/components/render-message.tsx
+++ b/components/render-message.tsx
@@ -95,6 +95,14 @@ export function RenderMessage({
// New way: Use parts instead of toolInvocations
return (
<>
+ {toolData.map(tool => (
+ <ToolSection
+ key={tool.toolCallId}
+ tool={tool}
+ isOpen={getIsOpen(tool.toolCallId)}
+ onOpenChange={open => onOpenChange(tool.toolCallId, open)}
+ />
+ ))}
{message.parts?.map((part, index) => {
switch (part.type) {
case 'tool-invocation':