Skip to content

Commit fb97b6b

Browse files
fix: await convertToModelMessages in docs chat API route (#1526)
convertToModelMessages is async but was not being awaited, so a Promise was passed to streamText instead of the resolved ModelMessage array. This caused Zod validation to fail on every chat request with: "Invalid prompt: The messages do not match the ModelMessage[] schema."
1 parent d1391e1 commit fb97b6b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ User question: ${userQuestion}`,
8181

8282
const stream = createUIMessageStream({
8383
originalMessages: messages,
84-
execute: ({ writer }) => {
84+
execute: async ({ writer }) => {
8585
const result = streamText({
8686
model: 'openai/gpt-4.1-mini',
87-
messages: convertToModelMessages(processedMessages),
87+
messages: await convertToModelMessages(processedMessages),
8888
stopWhen: stepCountIs(10),
8989
tools: createTools(writer),
9090
system: createSystemPrompt(currentRoute),

0 commit comments

Comments
 (0)