Skip to content

Extra-Chill/chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@extrachill/chat

React chat UI components with a built-in REST API client. Speaks the standard chat message format natively — no adapters, no wrappers.

Install

npm install @extrachill/chat

Quick Start

import { Chat } from '@extrachill/chat';
import '@extrachill/chat/css';
import apiFetch from '@wordpress/api-fetch';

function StudioChat() {
  return (
    <Chat
      basePath="/datamachine/v1/chat"
      fetchFn={apiFetch}
      agentId={5}
    />
  );
}

What's Included

ComponentsChat, ChatMessages, ChatMessage, ChatInput, TypingIndicator, ToolMessage, SessionSwitcher, ErrorBoundary, AvailabilityGate

HookuseChat manages messages, sessions, multi-turn continuation loops, and availability state

API clientsendMessage, continueResponse, listSessions, loadSession, deleteSession

NormalizernormalizeMessage, normalizeConversation, normalizeSession for mapping raw backend messages into the UI model

CSS@extrachill/chat/css provides base styles with 30+ CSS custom properties (--ec-chat-*) for theming

REST Contract

The package expects these endpoints at basePath:

Method Path Purpose
POST / Send a message (creates or continues session)
POST /continue Continue a multi-turn response
GET /sessions List sessions for the current user
GET /{session_id} Load a single session's conversation
DELETE /{session_id} Delete a session

Any backend implementing this contract works. The fetchFn prop accepts any function matching (options: { path, method?, data? }) => Promise<json>@wordpress/api-fetch works directly.

Theming

Override CSS custom properties on .ec-chat to match your design system:

.my-chat .ec-chat {
  --ec-chat-user-bg: var(--accent);
  --ec-chat-assistant-bg: var(--card-background);
  --ec-chat-font-family: var(--font-family-body);
  --ec-chat-border-radius: var(--border-radius-md);
}

Consumers

  • extrachill-studio — Studio Chat tab (agent_id=5)
  • extrachill-chat — chat.extrachill.com frontend
  • data-machine — Admin chat sidebar

License

GPL-2.0-or-later

About

React chat UI components with built-in REST API client. No adapters, no wrappers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages