Chat Component¶
Located at src/components/chatbox/EnhancedChatWithLabeeb.tsx.
Purpose¶
Provides an AI chat experience that supports evidence gathering, conflict detection, and quick follow-up actions. It renders the full chat UI and manages streaming responses from the backend.
Props¶
| Name | Type | Description |
|---|---|---|
isMaximized |
boolean | Expands the interface to show the sidebar with evidence and conflicts. |
State and events¶
- Maintains message history, input value, loading and streaming flags.
- Tracks evidence, conflicts, highlighted citations, and optional AI features (auto‑summarize, smart reply, sentiment, topic detection, translation).
- Exposes handlers for sending messages, starting a new chat, exporting history, toggling depth and evidence-only modes, and deleting messages.
Data flow¶
User input flows from the composer to the streamChat helper, which streams assistant responses. Messages update in place while evidence and conflict panels receive parsed documents. Sidebar interactions can highlight citations or pin sources, and exported transcripts are emitted through the header controls.
UI states¶
- Empty – shows contextual tips when no conversation exists.
- Loading –
TypingIndicatordisplays during streamed replies. - Errors – surfaced through toast notifications and a short fallback message in the thread.
Testing notes¶
No unit tests currently cover the component. Suggested scenarios:
- Rendering with and without the sidebar (isMaximized).
- Handling API errors and verifying toast output.
- Preserving message history across rapid consecutive sends.
Usage¶
Render the component within a ChatProvider. Pass isMaximized when embedding it in pages that should display the sidebar; omit or set it to false for compact placements.