本页还没有译文
本页 11 段还没译成Español,下面显示的是英文原文。createAI
还没翻译译自英文(ai-sdk.dev)本页 11 段都还没译
Warning
AI SDK RSC is currently experimental. We recommend using AI SDK UI for production. For guidance on migrating from RSC to UI, see our migration guide.
Creates a client-server context provider that can be used to wrap parts of your application tree to easily manage both UI and AI states of your application.
Import
import { createAI } from "@ai-sdk/rsc"API Signature
Parameters
actions(Record<string, Action>): Server side actions that can be called from the client.initialAIState(any): Initial AI state to be used in the client.initialUIState(any): Initial UI state to be used in the client.onGetUIState(() => Promise<UIState | undefined>): is called during SSR to compare and update UI state.onSetAIState((Event) => void): is triggered whenever an update() or done() is called by the mutable AI state in your action, so you can safely store your AI state in the database.Eventstate(AIState): The resulting AI state after the update.done(boolean): Whether the AI state updates have been finalized or not.
Returns
It returns an <AI/> context provider.
Examples
AI 翻译查看英文原文