本页还没有译文
本页 5 段还没译成日本語,下面显示的是英文原文。useChat No Response
还没翻译译自英文(ai-sdk.dev)本页 5 段都还没译
Issue
I am using useChat.
When I log the incoming messages on the server, I can see the tool call and the tool result, but the model does not respond with anything.
Solution
To resolve this issue, convert the incoming messages to the ModelMessage format using the convertToModelMessages function.
import { openai } from '@ai-sdk/openai';
import {
convertToModelMessages,
createUIMessageStreamResponse,
streamText,
toUIMessageStream,
} from 'ai';
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: 'anthropic/claude-sonnet-5.5',
messages: await convertToModelMessages(messages),
});
return createUIMessageStreamResponse({
stream: toUIMessageStream({ stream: result.stream }),
});
}AI 翻译查看英文原文