Skip to content

An AI-powered search engine with a generative UI

Fix fetch tool display issue when loading saved data

Yoshiki Miurab67bf70adf2f
diff --git a/app/search/loading.tsx b/app/search/loading.tsx
index 8f4de58b..13df6486 100644
--- a/app/search/loading.tsx
+++ b/app/search/loading.tsx
@@ -4,7 +4,7 @@ import { DefaultSkeleton } from '../../components/default-skeleton'
export default function Loading() {
return (
- <div className="flex min-w-0 flex-1 flex-col items-center justify-center">
+ <div className="flex min-w-0 flex-1 flex-col items-center">
<div className="w-full max-w-3xl px-4 pt-12">
<DefaultSkeleton />
</div>
diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json
index c0c98cf0..38cda8ce 100644
--- a/drizzle/meta/0001_snapshot.json
+++ b/drizzle/meta/0001_snapshot.json
@@ -122,12 +122,8 @@
"name": "messages_chat_id_chats_id_fk",
"tableFrom": "messages",
"tableTo": "chats",
- "columnsFrom": [
- "chat_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -415,12 +411,8 @@
"name": "parts_message_id_messages_id_fk",
"tableFrom": "parts",
"tableTo": "messages",
- "columnsFrom": [
- "message_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["message_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -464,4 +456,4 @@
"schemas": {},
"tables": {}
}
-}
\ No newline at end of file
+}
diff --git a/drizzle/meta/0003_snapshot.json b/drizzle/meta/0003_snapshot.json
index c0c98cf0..38cda8ce 100644
--- a/drizzle/meta/0003_snapshot.json
+++ b/drizzle/meta/0003_snapshot.json
@@ -122,12 +122,8 @@
"name": "messages_chat_id_chats_id_fk",
"tableFrom": "messages",
"tableTo": "chats",
- "columnsFrom": [
- "chat_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -415,12 +411,8 @@
"name": "parts_message_id_messages_id_fk",
"tableFrom": "parts",
"tableTo": "messages",
- "columnsFrom": [
- "message_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["message_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -464,4 +456,4 @@
"schemas": {},
"tables": {}
}
-}
\ No newline at end of file
+}
diff --git a/drizzle/meta/0005_snapshot.json b/drizzle/meta/0005_snapshot.json
index c0c98cf0..38cda8ce 100644
--- a/drizzle/meta/0005_snapshot.json
+++ b/drizzle/meta/0005_snapshot.json
@@ -122,12 +122,8 @@
"name": "messages_chat_id_chats_id_fk",
"tableFrom": "messages",
"tableTo": "chats",
- "columnsFrom": [
- "chat_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -415,12 +411,8 @@
"name": "parts_message_id_messages_id_fk",
"tableFrom": "parts",
"tableTo": "messages",
- "columnsFrom": [
- "message_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["message_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -464,4 +456,4 @@
"schemas": {},
"tables": {}
}
-}
\ No newline at end of file
+}
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 6b623909..d46f3fc9 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -31,4 +31,4 @@
"breakpoints": true
}
]
-}
\ No newline at end of file
+}
diff --git a/lib/utils/message-mapping.ts b/lib/utils/message-mapping.ts
index 2e19904b..567033aa 100644
--- a/lib/utils/message-mapping.ts
+++ b/lib/utils/message-mapping.ts
@@ -369,9 +369,7 @@ export function mapDBPartToUIMessagePart(
// Special handling for tool parts that maintain their type
if (
- ['search', 'retrieve', 'question', 'relatedQuestions'].includes(
- toolName
- )
+ ['search', 'fetch', 'question', 'relatedQuestions'].includes(toolName)
) {
return {
type: part.type as any,
@@ -435,7 +433,7 @@ function getToolNameFromType(toolName: string): string {
// Map original tool names to DB column names
const toolNameMap: Record<string, string> = {
search: 'search',
- retrieve: 'retrieve',
+ fetch: 'fetch',
askQuestion: 'question',
question: 'question',
relatedQuestions: 'relatedQuestions'
@@ -475,7 +473,7 @@ function getToolNameFromCallId(
function getOriginalToolName(dbToolName: string): string {
const reverseMap: Record<string, string> = {
search: 'search',
- retrieve: 'retrieve',
+ fetch: 'fetch',
question: 'askQuestion',
dynamic: 'dynamic' // For dynamic tools, the actual tool name is stored separately
}