本页还没有译文
本页 10 段还没译成Español,下面显示的是英文原文。readUIMessageStream
还没翻译译自英文(ai-sdk.dev)本页 10 段都还没译
Transforms a stream of UIMessageChunks into an AsyncIterableStream of UIMessages.
UI message streams are useful outside of Chat use cases, e.g. for terminal UIs, custom stream consumption on the client, or RSC (React Server Components).
Import
import { readUIMessageStream } from 'ai';API Signature
Parameters
message?(UIMessage): The last assistant message to use as a starting point when the conversation is resumed. Otherwise undefined.stream(ReadableStream<UIMessageChunk>): The stream of UIMessageChunk objects to read.onError?((error: unknown) => void): A function that is called when an error occurs during stream processing.terminateOnError?(boolean): Whether to terminate the stream if an error occurs. Defaults to false.
Returns
An AsyncIterableStream of UIMessages. Each stream part represents a different state of the same message as it is being completed.
For comprehensive examples and use cases, see Reading UI Message Streams.
AI 翻译查看英文原文