$ show Mintplex-Labs/anything-llm
AnythingLLM is a full-stack, self-hosted AI chat platform designed for Retrieval-Augmented Generation (RAG) over private documents. It provides a web interface where users create workspaces, upload documents (PDF, DOCX, images with OCR, audio, etc.), which are then chunked, embedded, and stored in a vector database (default LanceDB, with support for PGVector, Pinecone, Qdrant, and others). Chat queries retrieve relevant document chunks and feed them to an LLM of choice (supporting 30+ providers including OpenAI, Anthropic, Ollama, and local models via KoboldCPP). The platform also features an extensible agent system (aibitat) with plugins for file system operations, SQL databases, Gmail, Google Calendar, web scraping, image generation, and scheduled jobs. A separate 'collector' microservice handles document ingestion and format conversion, while the 'open-computer' subproject provides a QEMU-based virtual machine for autonomous browser automation. The frontend is a React SPA with multi-user support, role-based access, internationalization, embeddable chat widgets, and a community hub for sharing agent skills, system prompts, and slash commands. The architecture is a monolith (Express server) with the collector as an isolated service, and the open-computer as a standalone CLI/service. It relies on external AI APIs, vector databases, and local storage, making it suitable for both cloud and on-premises deployment.
The LLM identified 3 files worth highlighting for reuse:
Implements a persistent encryption layer for sensitive configuration data (e.g., API keys, tokens). Uses a master key derived from a storage secret (hashed with SHA-256) to encrypt/decrypt values stored in the database. The class provides `encrypt` and `decrypt` methods, with the master key lazily initialized on first use. This pattern is reusable in any application that needs to securely persist secrets without relying on external key management services.
A React hook that uses the Web Audio API to detect silence from a microphone stream. It creates an AudioContext, connects an AnalyserNode, and periodically checks the RMS volume against a threshold. When silence is detected (below threshold for a configurable duration), it triggers a callback. This pattern is reusable in any speech-to-text or voice UI that needs to automatically stop recording after a pause, without requiring third-party libraries.
The provider directory contains a class hierarchy for integrating with 30+ LLM providers. The base `Provider` class defines common methods (`stream`, `complete`, `getChatCompletion`), while `UnTooled` mixin handles non-tool-calling models. Each provider (e.g., `openai.js`, `anthropic.js`, `ollama.js`) inherits via `InheritMultiple([Provider, UnTooled])` and overrides only the provider-specific API calls. This pattern is highly reusable for building new AI provider integrations with consistent streaming, error handling, and tool support.