An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
Fix feedback button not showing after streaming completes
Yoshiki Miura3fd4add56fe6
diff --git a/lib/streaming/create-chat-stream-response.ts b/lib/streaming/create-chat-stream-response.tsindex 670ca214..a32fac41 100644--- a/lib/streaming/create-chat-stream-response.ts+++ b/lib/streaming/create-chat-stream-response.ts@@ -163,8 +163,19 @@ export async function createChatStreamResponse(const result = researchAgent.stream({ messages: modelMessages })result.consumeStream()- // Stream with the research agent- writer.merge(result.toUIMessageStream())+ // Stream with the research agent, including metadata+ writer.merge(result.toUIMessageStream({+ messageMetadata: ({ part }) => {+ // Send metadata when streaming starts+ if (part.type === 'start') {+ return {+ traceId: parentTraceId,+ searchMode,+ modelId: context.modelId+ }+ }+ }+ }))const responseMessages = (await result.response).messages// Generate related questions