Skip to content

Chat Panel

Copilot-style assistant side panel with message list, tool call cards, model badge, and composer with send/stop states.

Copilotgpt-4.1

Add input validation to the signup form

AI

I will update the validators and add error messages.

read_filesrc/forms/signup.ts
edit_filesrc/forms/signup.ts
run_testsnpm test -- signup

Installation

bash
npx @galaxy-stack/nebula-cli@latest add chat-panel

Usage

tsx
import { ChatPanel, type AssistantChatMessage } from '@/components/assistant/chat-panel';

const messages: AssistantChatMessage[] = [
  { id: '1', role: 'user', content: 'Refactor the auth module' },
  {
    id: '2',
    role: 'assistant',
    content: 'I found 3 files to update. Starting with auth.service.ts…',
    toolCalls: [
      {
        id: 't1',
        name: 'read_file',
        args: 'src/auth/auth.service.ts',
        result: '142 lines',
        status: 'completed',
      },
      { id: 't2', name: 'edit_file', args: 'src/auth/auth.service.ts', status: 'running' },
    ],
  },
];

<ChatPanel
  title="Copilot"
  model="gpt-4.1"
  messages={messages}
  onSendMessage={(content) => sendMessage(content)}
  onStop={cancel}
/>

Features

  • Streaming state — blinking cursor + pulse status while generating
  • Tool call cards — collapsible args/result with running/completed/error states
  • Model badge — display active model in the header
  • Send/Stop toggle — composer switches to destructive Stop while busy
  • Auto-scroll — follows new messages
  • Keyboard friendly — Enter sends, Shift+Enter for newline

API Reference

ChatPanelProps

PropTypeDefaultDescription
titlestring'Assistant'Panel header title
modelstringModel name badge
messagesAssistantChatMessage[]requiredMessage list
placeholderstring'Ask anything…'Composer placeholder
disabledbooleanfalseDisable composer
onSendMessage(content: string) => voidSend handler
onStop() => voidStop handler (busy state)

AssistantChatMessage

FieldTypeDescription
idstringUnique id
role'user' | 'assistant' | 'system'Message role
contentstringText content
streamingboolean?Show streaming indicator
toolCallsChatToolCall[]?Tool invocations attached to this message

Released under the MIT License.