Overview

AI Client Chat is a comprehensive extension that enables AI-powered document-based conversations with your clients using OpenAI's Assistants API or Google's Gemini API. Upload client documents, chat with an AI assistant that has access to those documents, and maintain complete conversation history for each client. The system features persistent AI assistants that remember all conversations across all chat sessions for each client.

Why it matters: AI Client Chat transforms how you interact with client documents. Instead of manually searching through files, you can ask specific questions and get instant, accurate answers based on all uploaded client documents. The AI assistant remembers previous conversations, providing context-aware responses that build on past interactions. Perfect for analyzing loan agreements, contracts, financial documents, and any client-related paperwork.

Automatic Client Detection: You can upload documents without creating a client first. The system will automatically scan each document for client names, create new clients when names are found, extract relevant information, and save it. This streamlines your workflow when processing multiple documents.

Document-Aware AI

The AI assistant has access to all uploaded client documents and can search through them semantically to provide accurate, context-aware answers.

Persistent Conversations & Memory

All conversations are stored permanently with full context. The AI assistant remembers all previous conversations for each client, maintaining complete conversation history across all chat sessions.

Key Features

Client Management

Create, edit, and manage clients with full CRUD operations. Each client has their own document library and chat history.

Document Upload

Upload multiple document types with drag-and-drop or file picker. Automatic processing and status tracking.

Multiple Chat Sessions

Create multiple chat sessions per client. Pin important chats, switch between conversations, and maintain separate contexts.

Export Conversations

Export conversations as PDF, TXT, or CSV files. Perfect for record-keeping, sharing with team members, or client documentation.

Client Isolation

Complete data privacy. Each client's documents and conversations are isolated. Team sharing is optional and controlled.

Audit Logging

Complete audit trail for all document operations. Track who uploaded, deleted, or accessed documents for compliance.

AI Provider Support

Supports both OpenAI and Google Gemini AI providers. Switch between providers in admin settings. Each client's assistant is provider-specific and remembers conversations regardless of which provider is used.

Persistent Assistant Memory

Each client has a dedicated AI assistant that persists across all conversations. The assistant remembers all previous chats, providing context-aware responses that build on past interactions.

Getting Started

Follow these steps to start using AI Client Chat. You can either create clients manually or use the automatic client detection feature:

Step 1: Create a Client

Navigate to AI Client Chat and click "Create Client". Fill in client information (name, email, phone, optional notes). Alternatively, upload documents first and the system will automatically detect client names and create clients for you.

Step 2: Upload Documents

Upload documents for your client. The system processes each file individually: it scans for client names, automatically creates clients if names are found, extracts information, and saves it. You can upload multiple files sequentially - each is processed immediately after upload.

Step 3: Start Chatting

Select your client from the sidebar and start asking questions. The AI assistant remembers all previous conversations with this client and will search through all uploaded documents to provide accurate, context-aware answers.

Tip: Access AI Client Chat from your dashboard at /dashboard/ai-client-chat. You can also access it directly from the navigation menu.

Client Management

Manage your clients efficiently with full CRUD operations:

Search Clients

Search clients by name, email, or phone number. The sidebar search updates in real-time as you type.

Edit Client Information

Update client details at any time. Changes are saved immediately and reflected across all client views.

Client Isolation: Each user can only access their own clients by default. Team sharing can be enabled to allow team members to access shared clients. This ensures complete data privacy and security.

Document Management

Upload and manage client documents with comprehensive validation and processing:

File Validation

Three-layer validation (frontend, backend, service) ensures only supported file types and sizes are uploaded. Maximum file size: 100MB.

Status Tracking

Documents progress through statuses: pending → processing → ready → error. Status updates automatically as processing completes.

S3 Storage Support

Files can be stored locally or in Amazon S3/Cloudflare R2. Configure storage in admin settings. Files are moved to S3 after OpenAI processing.

Rejected File Types: Google shortcuts (`.gdoc`, `.gsheet`, `.gslides`) and archive files (`.zip`, `.rar`, `.7z`, `.tar`, `.gz`) are explicitly rejected for security and processing reasons.

Chat Features

AI Client Chat provides a comprehensive chat experience with advanced features:

Message Timestamps

Every message (sent and received) includes a date and time timestamp for complete conversation history tracking.

Long Response Handling

Prevents duplicate message sends, includes timeout handling, and provides a resend option for failed or timed-out messages.

Chat Switching Warning

System warns you if you try to switch chats while an AI response is still in progress, preventing accidental interruption.

Markdown Support

AI responses support markdown formatting with syntax highlighting for code blocks. Copy-to-clipboard functionality included.

Export Functionality

Export conversations in multiple formats for record-keeping and sharing:

PDF Export

Formatted PDF with client information, messages, and timestamps. Perfect for official documentation and record-keeping.

TXT Export

Plain text format with structured conversation. Easy to read, search, and share. Includes client info and all messages.

CSV Export

Spreadsheet-compatible format with columns: Timestamp, Role, Content. Perfect for data analysis and reporting.

Export Features: All exports include client information (name, email, phone), chat start date, total message count, all messages with timestamps and role labels (User/AI Assistant), and the export date. Content is cleaned to remove HTML tags and citation markers for readability.

File Support

AI Client Chat supports a wide range of document formats:

Supported Formats

Documents: PDF, DOC, DOCX, TXT, MD, RTF
Presentations: PPTX
Data Files: CSV
Code/Text: JSON, HTML

Rejected Formats

Google Shortcuts: .gdoc, .gsheet, .gslides
Archives: .zip, .rar, .7z, .tar, .gz
File Size Limit: 100MB per file

Security & Access Control

AI Client Chat implements multiple security layers to protect your client data:

Client Isolation

Users can only access clients they created. Complete data privacy with optional team sharing.

CSRF Protection

All forms include CSRF tokens to prevent cross-site request forgery attacks.

Authorization Checks

Every operation verifies client ownership before allowing access. Unauthorized access attempts are blocked.

Audit Logging: All document operations (upload, delete) are logged in the audit log table, providing a complete history of who did what and when. This is essential for compliance and security tracking.

Common Questions

How does the AI remember previous messages in a conversation?

The system uses persistent assistants and conversation threads to maintain context. Each client has a dedicated AI assistant that remembers all conversations across all chat sessions. Each individual chat maintains its own thread ID that preserves conversation history, allowing the AI to reference previous messages and maintain context throughout the conversation. This means the assistant remembers not just messages within a single chat, but can recall information from previous chats with the same client.

Can I have multiple chat sessions with the same client?

Yes, you can create multiple chat sessions per client. Each chat maintains its own conversation history and context. However, the AI assistant is shared across all chats for the same client, meaning it can reference information from other chat sessions when relevant. This is useful for organizing different topics or discussions with the same client while maintaining overall context.

What happens if a document fails to process?

The document status will be set to "error" and you'll see an error indicator. You can try uploading the file again, or check if the file format is correct and not corrupted. Ensure the file is in a supported format and under 100MB.

Does the AI have access to all my clients' documents?

No, the AI only has access to documents uploaded for the specific client you're chatting with. Client isolation ensures that documents from one client are never accessible when chatting with another client.

Can I delete documents?

Yes, you can delete documents at any time. When deleted, the file is removed from both local storage (or S3) and OpenAI's servers, ensuring complete removal. The deletion is logged in the audit trail.

How long does it take for a document to be processed?

Processing time varies depending on file size and OpenAI's processing queue. The system automatically checks the status and updates when processing is complete. Typically, small files process in seconds, while larger files may take a few minutes.

Can multiple users access the same client?

Yes, if team sharing is enabled. Clients can be shared with team members, allowing multiple users to chat with the same client and access the same documents. Team sharing is optional and controlled by team settings.

What's the best way to structure my questions for best results?

Be specific and provide context. Good questions: "What is the interest rate mentioned in the loan agreement for John's mortgage?" Poor questions: "What's the rate?" The more specific and contextual your questions, the better the AI can search through documents and provide accurate answers. Since the assistant remembers previous conversations, you can also reference earlier discussions: "Based on our previous conversation about the mortgage terms, what was the final interest rate?"

Can I use the system without creating clients manually?

Yes! You can upload documents directly without creating a client first. The system will automatically scan each document for client names, create new clients when names are found, extract relevant information, and save it. This is especially useful when processing multiple documents at once. Each file is processed individually: upload → scan/extract → create client (if name found) → save info → repeat for next file.

Does the AI remember conversations from previous sessions?

Yes! Each client has a persistent AI assistant that remembers all conversations across all chat sessions. This means if you ask about something in one chat session, the assistant can recall that information in future sessions. The assistant maintains context and builds on previous interactions, making conversations more natural and efficient over time.

Can I switch between OpenAI and Gemini?

Yes, you can switch between OpenAI and Gemini AI providers in the admin settings. However, each client's assistant is provider-specific. If you switch providers, new conversations will use the new provider, but existing assistants and their conversation history remain with their original provider. This ensures conversation continuity and prevents data loss.