feat: persist Chat History server-side
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 49.2k
- Forks
- 4.5k
- Avg merge
- 1d 3m
- Merged PRs (30d)
- 239
Description
LocalAI version:
Container Image: localai/localai:v4.1.2-gpu-nvidia-cuda-13
Environment, CPU architecture, OS, and Version:
Architecture: x86_64
OS: Linux (Debian-based)
Docker Compose deployment
GPU: 3x NVIDIA GPUs (CUDA 13)
Network: Running behind nginx proxy
Describe the bug
Chat conversations in GUI do not persist across browser refreshes or tab changes. When a user refreshes the page or closes and reopens the tab, the entire chat history is lost. No chat history is persisted to disk despite having persistent storage volumes mounted.
To Reproduce
- Start LocalAI container with standard WebUI access
- Open the WebUI in a browser at configured port
- Start a chat conversation - send multiple messages and receive responses
- Refresh the browser page OR close the tab and reopen it
- Observe that the chat history is completely gone
Expected behavior
One of the following should be the expected behavior:
- Chat history persists - Conversations should be saved to disk and restored when the user returns
- Clear documentation - If chat history is not intended to persist, this should be clearly documented
- Configurable option - There should be a documented way to enable/disable chat history persistence
Currently, there is no clear way to configure chat history persistence. The following environment variables were tried but do not exist or have no effect:
LOCALAI_CHAT_HISTORYLOCALAI_CHAT_HISTORY_ENABLEDLOCALAI_CHAT_STORAGELOCALAI_CHAT_HISTORY_DIR
Persistent volumes configured:
- /home/user/localai/backends:/backends:cached
- /home/user/localai/caches:/build/cache
- /home/user/localai/models:/models:cached
- /home/user/localai/tasks:/data
- /home/user/localai/generated_assets:/tmp/generated/content
- /home/user/localai/backends/upload:/tmp/localai/upload
- /home/user/localai/runtime:/configuration
Despite having a /data volume mounted, no chat history files are created.
Additional context
- The issue affects the built-in WebUI
- This makes the chat feature impractical for actual use
- Users expect chat history to persist as a default behavior in most LLM interfaces
- No configuration options for chat history are documented in the LocalAI documentation
- This may be a feature request rather than a bug - but the lack of documentation makes it unclear
Questions for maintainers:
- Am I configuring something wrong?
- Is there a configuration option that is undocumented?
- Is this expected behavior and should the documentation be updated to clarify this?
- Should this be client-side storage (browser localStorage) vs server-side storage?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the built-in WebUI behavior across refreshes and tab changes with the documented Docker Compose volumes, including the mounted /data path. Review the existing configuration documentation and the listed environment variables to determine whether persistence is intended, then define whether the completed work should implement storage or clarify the current behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose
- Domain
- backend, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100