An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
style: apply prettier formatting
Yoshiki Miuraf9d5a3e031d6
diff --git a/lib/streaming/create-chat-stream-response.ts b/lib/streaming/create-chat-stream-response.tsindex 682404bc..7704744e 100644--- a/lib/streaming/create-chat-stream-response.ts+++ b/lib/streaming/create-chat-stream-response.ts@@ -139,7 +139,7 @@ export async function createChatStreamResponse(let relatedQuestionsMessage: UIMessage | null = null// Create a promise to track when research finishes- const researchPromise = new Promise<void>((resolve) => {+ const researchPromise = new Promise<void>(resolve => {writer.merge(researchResult.toUIMessageStream({sendFinish: false,@@ -218,7 +218,7 @@ export async function createChatStreamResponse(})// Create a promise to track when related questions finish- const relatedQuestionsPromise = new Promise<void>((resolve) => {+ const relatedQuestionsPromise = new Promise<void>(resolve => {writer.merge(relatedQuestionsResult.toUIMessageStream({sendStart: false,diff --git a/lib/streaming/message-preparation.ts b/lib/streaming/message-preparation.tsindex 57dcc2cf..72a20d14 100644--- a/lib/streaming/message-preparation.ts+++ b/lib/streaming/message-preparation.ts@@ -36,7 +36,7 @@ export async function prepareMessagesForRegeneration(}const targetMessage = currentChat.messages[messageIndex]-+if (targetMessage.role === 'assistant') {// Delete from this assistant message onwardsawait deleteMessagesFromIndex(chatId, messageId)@@ -97,4 +97,4 @@ export async function prepareMessagesForSubmission(// Get all messages including the one just savedconst updatedChat = await getChatAction(chatId, userId)return updatedChat?.messages || [messageWithId]-}\ No newline at end of file+}diff --git a/lib/utils/message-utils.ts b/lib/utils/message-utils.tsindex 3cf8aa72..e1d0910b 100644--- a/lib/utils/message-utils.ts+++ b/lib/utils/message-utils.ts@@ -123,10 +123,9 @@ export function mergeUIMessages(*/export function hasToolCalls(message: UIMessage | null): boolean {if (!message || !message.parts) return false-+return message.parts.some((part: any) =>- part.type &&- (part.type.startsWith('tool-') || part.type === 'tool-call')+ part.type && (part.type.startsWith('tool-') || part.type === 'tool-call'))}