AI SDK

Free · MIT

Convert a whole useChat message list.

Markdown

Preview

It's types and helpers, listed below.

Install

With the Candor CLI

First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/ai-sdk

Brings in: chat, safe-markdown, status · npm: ai@^7.0.162

Functions

fromAiSdkMessages(messages: UIMessage[], options: FromAiSdkOptions)

Convert a whole useChat message list.

fromAiSdkMessage(message: UIMessage, options: FromAiSdkOptions & { last?: boolean | undefined })

Convert one message. last marks the reply the chat status applies to.

Types

FromAiSdkOptions
{ /** Who the assistant is. Candor always names the agent. */ agent: AgentIdentity /** The chat's status from useChat, so the last reply can show as streaming or failed. */ chatStatus?: "submitted" | "streaming" | "ready" | "error" | undefined /** When a message was sent, if your metadata says. Without it, no time is shown. */ createdAt?: ((message: UIMessage) => string | undefined) | undefined /*