Skip to content

A simple Fast API based multi users backend/front end app to serve discussions using lollms_client library

License

Notifications You must be signed in to change notification settings

ParisNeo/lollms

Repository files navigation

LoLLMs

One tool to rule them all!

License Python Version Version

A multi-user FastAPI backend and responsive HTML/Tailwind CSS frontend application designed to provide a chat interface powered by the lollms_client library. It features integrated Retrieval-Augmented Generation (RAG) using safe_store, MCPs, Personalities system, multimodal chat, user personalities, a friend system, direct messaging, and enhanced sharing capabilities.

Live Project: https://github.com/ParisNeo/lollms

Overview

This project aims to provide a self-hostable, user-friendly chat interface that can connect to various Large Language Models (LLMs) supported by lollms-client. It features multi-user support with basic authentication, persistent discussions, RAG functionality, multimodal chat (image input), customizable user personalities, a friend system with direct messaging, administrative user management, and sharing of datastores and personalities.

✨ Features

  • Multi-User Support: Secure login via Token based authentication. Each user has their own isolated data.
  • Persistent Discussions: Chat histories are saved per user (SQLite3 database) and can be revisited, renamed, starred, and deleted.
  • LLM Integration: Uses lollms-client to interact with various LLM backends.
  • Streaming Responses: AI responses are streamed for a real-time experience.
  • Multimodal Chat: Upload images with text prompts for vision-capable models.
  • User Personalities (System Prompts):
    • Create, edit, and delete custom personalities (system prompts with name, category, author, icon, etc.).
    • Select an active personality to guide LLM responses.
    • View and use public (system-provided) personalities.
    • Share (send a copy of) owned personalities with friends.
  • Retrieval-Augmented Generation (RAG):
    • Multiple DataStores per user for organizing RAG documents.
    • Upload documents (.txt, .pdf, .docx, .html, etc.) to specific DataStores.
    • Toggle RAG usage per discussion, selecting a specific DataStore.
    • Manage DataStores (create, rename, delete) and their indexed documents.
    • Share DataStores with friends (read-only query access).
  • Friend System & Direct Messaging (DM):
    • Send, accept, and reject friend requests.
    • View friends list and manage friendships (unfriend, block/unblock - block/unblock WIP).
    • Send and receive direct messages with accepted friends.
    • View conversation history with friends.
  • Configurable Settings:
    • Users can set their default LLM model, RAG vectorizer, LLM generation parameters (temperature, top_k, etc.), RAG parameters, and personal profile information.
  • Admin Panel:
    • Manage users (Add, List, Delete, Reset Password).
    • Initial superadmin user created from config.toml.
  • Data Export/Import: Users can export/import their discussions, settings, and metadata.
  • Responsive UI: Built with Tailwind CSS, including image previews, Markdown rendering with code highlighting (Highlight.js) and math (KaTeX).
  • Dark/Light Theme & Internationalization (i18n).
  • SQLite Backend: Central database for users, settings, personalities, friendships, DMs. SafeStore uses its own DBs per DataStore.

🏗️ Architecture

  • Backend: FastAPI (Python)
  • LLM Communication: lollms-client
  • RAG/Vector Store: safe_store (SQLite based per DataStore)
  • Main Database: SQLAlchemy with SQLite (users, personalities, friendships, DMs, etc.)
  • Authentication: HTTP Basic Auth + Passlib
  • Frontend: HTML, Tailwind CSS, Vanilla JavaScript
  • Configuration: TOML (config.toml)
  • Discussion Storage: YAML files per user

📸 Screenshots

(Add updated screenshots showing the new Friends & Messages modal, DM interface, personality editor, and sharing options)

Login Screen: ![Login Screen](placeholder_login.png)

Main Chat UI (with Personality Selector & RAG): ![Chat UI](placeholder_chat_main.png)

Friends & Messages Modal: ![Friends & Messages Modal](placeholder_friends_dm.png)

Personality Editor Modal: ![Personality Editor](placeholder_personality_editor.png)

Settings Modal (User Profile, LLM/RAG Params): ![Settings Modal](placeholder_settings_new.png)

DataStore Management & Sharing: ![DataStore Management](placeholder_datastore_manage.png)

Admin Panel: ![Admin Panel](placeholder_admin.png)

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • Git, Pip
  • An LLM backend accessible via lollms-client.

Installation

Manual installation

  1. Clone:
    git clone https://github.com/ParisNeo/lollms_chat.git
    cd lollms_chat
  2. Virtual Environment (Recommended):
    python -m venv venv
    # Windows: venv\Scripts\activate
    # macOS/Linux: source venv/bin/activate
  3. Install Dependencies:
    pip install -r requirements.txt
  4. Configure config.toml:
    • Copy config_example.toml to config.toml.
    • Crucially: Change password under [initial_admin_user].
    • Set binding_name and default_model_name in [lollms_client_defaults].
    • Review other settings.
  5. Run:
    python main.py

Automatic installation

  1. ** Windows ** execute install.bat
  2. ** Linux/MazcOs ** execute install.sh

Usage

  1. Access UI: http://localhost:9642
  2. Login: Use initial admin or created user credentials.
  3. Chat: Create/select discussions, use RAG, upload images.
  4. Personalities: Manage and select active personalities via Settings.
  5. Friends & DMs: Access via user menu to manage friends and send messages.
  6. DataStores: Manage RAG DataStores and share them via user menu.
  7. Settings: Configure user profile, LLM/RAG parameters, active personality.
  8. Admin Panel: /admin for user management (admins only).

⚙️ Configuration (config.toml)

  • [app_settings]: data_dir, database_url.
  • [initial_admin_user]: username, password, optional first_name, email.
  • [lollms_client_defaults]: binding_name, default_model_name, LLM parameters, put_thoughts_in_context.
  • [safe_store_defaults]: RAG chunking, global_default_vectorizer.
  • [server]: host, port.

📚 API Documentation

  • Swagger UI: http://localhost:9642/docs
  • ReDoc: http://localhost:9642/redoc

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📜 License

Apache License 2.0. See LICENSE.

About

A simple Fast API based multi users backend/front end app to serve discussions using lollms_client library

Resources

License

Stars

Watchers

Forks

Packages

No packages published