本页还没有译文
本页 10 段还没译成简体中文,下面显示的是英文原文。Custom Chat UI Adapters
还没翻译译自英文(tanstack.com)本页 10 段都还没译
Import @tanstack/ai-client/ui. Do not import it from the main client entry.
The subpath gives you:
selectChatUIto match tool results and split list vs inline interruptspartTypeToKeyto turntool-callintotoolCall- Option types for tools, generic interrupts, and
outputSchema
Your adapter owns:
- Native components and context
- Native reactivity
- Render callbacks, slots, or snippets
- Development warnings for missing mapped keys
Do not add default markup. Do not add a new store. The app owns useAppChat from createChatHook, or useChat / createChat.
Call selectChatUI({ messages, interrupts, inlineToolNames }). Automatic traversal skips a tool-result only when matched is true. Keep unmatched results.
Warn once per missing runtime key in development. Each build tool detects development mode differently, so the adapter prints the warning.
See the React, Solid, Vue, Svelte, and Remix adapters for the public names to match: Chat, Provider, Messages, Message, Part, Interrupts, Interrupt, useChatContext, and createChatHookContexts.