@tmf/chat-front (6.1.0)
Published 2026-07-30 12:41:10 -03:00 by tarcisio
Installation
@tmf:registry=npm install @tmf/chat-front@6.1.0"@tmf/chat-front": "6.1.0"About this package
@tmf/chat-front
Módulo Chat de time plug-and-play da plataforma TMF. Instale 1 pacote e monte
<ChatProvider baseUrl getToken ai={...}> — canais, mensagens, reações, threads,
presença, WebSocket e copiloto de IA configurável (AIPort agnóstico).
Instalação
npm install @tmf/chat-front
Uso
import { ChatProvider, FloatingChatWidget, ChatApp } from '@tmf/chat-front'
<ChatProvider
baseUrl={hubUrl}
getToken={getToken}
ai={{
enabled: true,
getToken: getAiToken,
model: 'claude-opus-4-8',
rag: { endpoint: '/api/rag' }, // OU rag: { tool: myRagTool }
}}
>
<FloatingChatWidget /> {/* widget flutuante */}
{/* ou <ChatApp /> — página dedicada full-page */}
</ChatProvider>
- Plug-and-play: no modo simples basta
baseUrl+getToken. O Provider monta o contrato, o QueryClient e os ports sozinho (não precisa de@tmf/platform-core). - IA agnóstica: o copiloto (
CopilotPanel, aba IA do widget) consome o endpoint SSE/api/chat/aidotmf-chat-back. O provedor (Claude/Ollama/OpenAI) e o RAG são resolvidos no service (host-injected) — a lib nunca fixa provedor. - Slot pattern: o pacote não faz HTTP direto — tudo via
ChatApiClientinjetado (o host pode sobrescrever a propclient).
Exports
ChatProvider, useChatContext, useChatAI, ChatApp, FloatingChatWidget,
CopilotPanel, createDefaultChatClient, chatQueryKeys, PACKAGE_VERSION +
tipos wire (Channel, ChatMessage, Reaction, AIConfig, RagConfig, …).
Ver INTEGRATION.md (implantação), FUNCIONALIDADES.md (features) e
CONFORMANCE.md (contrato/gates).
Dependencies
Dependencies
| ID | Version |
|---|---|
| @tanstack/react-query | ^5.0.0 |
| lucide-react | ^0.400.0 |
Development dependencies
| ID | Version |
|---|---|
| @tmf/platform-core | file:../../platform-core |
| @types/react | ^18.2.47 |
| @types/react-dom | ^18.2.18 |
| tsup | ^8.5.1 |
| typescript | ^5.3.3 |
Peer dependencies
| ID | Version |
|---|---|
| react | >=18.0.0 |
| react-dom | >=18.0.0 |
Keywords
tmf
chat
react
components
plug-and-play
ai