Skip to content

feat: persist Chat History server-side #9432

@okcodemaybe

Description

@okcodemaybe

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

  1. Start LocalAI container with standard WebUI access
  2. Open the WebUI in a browser at configured port
  3. Start a chat conversation - send multiple messages and receive responses
  4. Refresh the browser page OR close the tab and reopen it
  5. Observe that the chat history is completely gone

Expected behavior
One of the following should be the expected behavior:

  1. Chat history persists - Conversations should be saved to disk and restored when the user returns
  2. Clear documentation - If chat history is not intended to persist, this should be clearly documented
  3. 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_HISTORY
  • LOCALAI_CHAT_HISTORY_ENABLED
  • LOCALAI_CHAT_STORAGE
  • LOCALAI_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:

  1. Am I configuring something wrong?
  2. Is there a configuration option that is undocumented?
  3. Is this expected behavior and should the documentation be updated to clarify this?
  4. Should this be client-side storage (browser localStorage) vs server-side storage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions