Back
Conversational AI & Chatbots

A File-Aware AI Chat Platform With Project-Based Conversation Organization

How Pfactorial Technologies built a chat application that reads uploaded documents and images as conversational context, organized around persistent, resumable projects.

August 21, 2026
Share
ENGAGEMENT SNAPSHOT

Pfactorial_Case_Study_File_Aware_Chat_Platform image 1
Figure 1 - Key figures from this engagement, at a glance.
EXECUTIVE SUMMARY
Our client wanted an AI chat product that could do more than hold a conversation - users needed to upload a document or image, have the assistant actually use its content, and pick up past conversations later without losing context.
A generic chatbot answers what's typed; it doesn't answer what's in an attached PDF or scanned image unless that content is explicitly extracted and given to the model as context. And a conversation with no persistence or organization becomes unusable the moment a user has more than a handful of chats going.
Pfactorial built a full-stack chat platform that extracts text from PDFs, Word documents, plain text and images (via OCR) and injects it as context before every model call, with persistent per-conversation history, project-based grouping, and automatic cleanup of expired data.
Why this engagement is representative This engagement is a clean example of Pfactorial building the unglamorous infrastructure - file extraction, history persistence, retention cleanup - that separates a genuinely useful AI chat product from a thin wrapper around a model API.
THE CHALLENGE
Turning a basic chat UI into a file-aware, organized product required solving three problems most chatbot demos skip.

1. A model can't read a file it never receives as text

PDFs, Word documents and images all needed their content extracted into plain text - using the appropriate method per format - before the model could reason about what a user actually uploaded.

2. Unorganized chats become unusable at volume

Without a way to group related conversations, a user with dozens of chats has no way to find the one about a specific project or topic.

3. Stored chat history and files can't accumulate indefinitely

Every chat history and uploaded file consumes storage indefinitely unless something actively manages expiry - without that, storage cost and clutter grow forever.
The real brief Not “build a chat UI on top of an LLM” but “make the model actually aware of what a user uploads, and make months of conversation history stay organized and manageable.”
THE SOLUTION
Pfactorial built the platform around a straightforward but disciplined pattern: extract, inject as context, persist per conversation, and clean up automatically on a schedule.
Pfactorial_Case_Study_File_Aware_Chat_Platform image 2
Figure 2 - Every file is extracted to text and injected as context before the model ever sees it.

Architectural principles

  • Format-appropriate extraction - PDFs are extracted page-by-page, DOCX paragraph-by-paragraph, TXT read directly, and images processed through OCR - each format handled with the library actually suited to it.
  • Context injection, not raw file passing - Extracted file text is appended to the user's message as explicit context before the request reaches the model, keeping the model's input predictable regardless of upload type.
  • Two levels of organization - Standalone chats handle quick conversations; project workspaces group related chats and uploads under a shared topic, with both manageable from the same sidebar.
  • Retention as a scheduled process, not a manual chore - A daily cleanup job removes chat histories and upload folders past the configured expiry period automatically, rather than relying on someone to manage storage by hand.
CAPABILITIES DELIVERED
Each capability moves the product from a bare chat window to a usable, organized AI workspace.
CAPABILITY
WHAT IT DOES
AI chat with conversation history
Persistent, per-conversation message history that continues correctly across sessions.
File-aware responses
PDF, DOCX, TXT and image uploads extracted and used as context for the assistant's reply.
Project workspaces
Named projects with dedicated chat histories and upload folders, grouping related conversations.
Sidebar chat management
View, create, rename and delete both individual chats and full projects.
Automatic chat cleanup
Daily removal of chat histories and uploads past the configured retention period.
Contact form
reCAPTCHA-validated submission stored in the database with a CSV backup.
Pfactorial_Case_Study_File_Aware_Chat_Platform image 3
Figure 3 - Standalone chats and project workspaces share the same storage and cleanup mechanics.
Design note Keeping the message history short - preserving the system message and only the most recent exchanges - is a deliberate constraint, not an oversight. It keeps response latency and cost predictable as a conversation grows long, at the cost of very long-range recall.
ENGINEERING FOR SCALE AND RELIABILITY
Five decisions keep file handling and history management predictable as usage grows.

Library matched to file type

pdfplumber for PDF text, python-docx for DOCX paragraphs, and pytesseract with Pillow for OCR on JPG/PNG images - each format routed to the tool actually built for it.

Upload validation before processing

File extension and size are validated against configured limits (10 MB maximum) before any extraction is attempted, avoiding wasted processing on invalid uploads.

UUID-keyed, file-based history

Each chat is assigned a UUID and persisted as its own JSON file, giving simple, direct lookups without requiring a database table scan for every conversation.

Scheduled, idempotent cleanup

Daily cleanup of expired chat files runs conditionally - only if it hasn't already run that day - avoiding redundant cleanup passes on every request.

Environment-based secret management

The OpenAI API key and other sensitive configuration are loaded from environment variables via python-dotenv, keeping credentials out of source control.
DELIVERY APPROACH
The engagement built the core chat experience first, then layered file awareness and organizational structure on top.
1. Core chat experience - the React frontend and Django REST backend handling message send/receive against the OpenAI API.
2. File extraction pipeline - format-specific extraction for PDF, DOCX, TXT and image uploads, injected as message context.
3. Persistent chat history - UUID-keyed JSON storage enabling users to reopen and continue previous conversations.
4. Project workspaces - named project grouping with dedicated chat histories and upload folders.
5. Retention automation - the daily cleanup job removing expired chat histories and upload folders.
6. Deployment packaging - Docker and Docker Compose configuration for frontend, backend and database services.
RESULTS AND IMPACT

Pfactorial_Case_Study_File_Aware_Chat_Platform image 4
Figure 4 - Key outcomes from this engagement.
Users can upload a document or image mid-conversation and get responses that actually account for its content, rather than needing to manually copy-paste extracted text.
Project-based organization keeps related conversations grouped and easy to find, even as a user's total chat history grows into the dozens or hundreds.

What it enabled commercially

The client got a chat product that behaves like a genuine AI workspace - file-aware, organized, and self-maintaining on storage - rather than a bare conversational interface that loses usefulness as soon as a user needs to reference an uploaded file or find an old conversation.
WHY PFACTORIAL
This engagement reflects Pfactorial's full-stack AI product engineering service line: building the file-handling, persistence and retention infrastructure around a model API that turns a chat demo into a usable product.
Pfactorial_Case_Study_File_Aware_Chat_Platform image 5
Figure 5 - Service lines this engagement draws on.
Engagement enquiries Pfactorial Technologies works with teams building AI chat and workspace products that need to be genuinely file-aware and organized, not just a thin UI over a model API. If you're evaluating a chat product build, we're happy to give you an honest read on scope and risk before anyone commits to anything. · pfactorial.ai
APPENDIX A - TECHNOLOGY STACK
The technology stack underpinning the system, grouped by the layer it serves.
Pfactorial_Case_Study_File_Aware_Chat_Platform image 6
© 2026 Pfactorial Technologies. Client identity and product-specific implementation detail are withheld or generalized; no client data, credentials, source code, or infrastructure detail is included in this document.

Result and Analysis

ENGAGEMENT SNAPSHOT

How Pfactorial Technologies built a chat application that reads uploaded documents and images as conversational context, organized around persistent, resumable projects.

Pfactorial_Case_Study_File_Aware_Chat_Platform image 1
Pfactorial_Case_Study_File_Aware_Chat_Platform image 2
Pfactorial_Case_Study_File_Aware_Chat_Platform image 3
Pfactorial_Case_Study_File_Aware_Chat_Platform image 4
Pfactorial_Case_Study_File_Aware_Chat_Platform image 5
Pfactorial_Case_Study_File_Aware_Chat_Platform image 6