AI Chat

A Mac OS 9 chat window for an AI assistant: streaming replies behind an insertion caret, the watch while it thinks, tool calls with Show Details, approval alerts, suggested prompts and a model picker. Drive it from the AI SDK's useChat, or leave the messages out to run a scripted demo.

Installation

npx shadcn@latest add "https://nostalgia-ui.com/r/ai-chat.json"

Import

import { AiChatBlock } from "@/components/ai-chat"
Assistant

How can I help?

With the AI SDK

Messages use the AI SDK's part shapes (text, reasoning, tool calls), so useChat plugs straight in. Try the demo: ask it to tidy your desktop, write a Read Me, or why your Mac is slow.

"use client"
import { useChat } from "@ai-sdk/react"
import { AiChatBlock } from "@/components/ai-chat"

export function Chat() {
  const { messages, status, sendMessage, stop, addToolApprovalResponse } = useChat()
  return (
    <AiChatBlock
      messages={messages}
      status={status}
      onSubmit={(text) => sendMessage({ text })}
      onStop={stop}
      onToolApproval={(part, approved) =>
        addToolApprovalResponse({ id: part.approval!.id, approved })
      }
    />
  )
}