Skip to content
CAI
Software that uses CAICheck a score

chatchat-space/Langchain-Chatchat

49.8

Weak · 26 September 2026

23.5k

lines of production code

Python

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This release marks a significant architectural shift toward a modular, multi-model framework, removing legacy ChatGLM integrations in favor of a flexible, plugin-based design. The update introduces comprehensive Model Context Protocol (MCP) support, enabling agents to interact with external tools and services via a new unified API and SDK. Key features include a restructured knowledge base system with diverse vector store backends, enhanced RAG capabilities with OCR and Chinese text processing, and a new CLI for configuration and database management. Additionally, the project adopts Poetry for dependency management and includes extensive new test coverage.

Features

Add Chinese text splitting and OCR-based document loaders

The system now supports processing Chinese text with specialized text splitters (AliTextSplitter, ChineseRecursiveTextSplitter, ChineseTextSplitter) and enhances document ingestion with OCR capabilities. New document loaders (RapidOCRDocLoader, RapidOCRLoader, RapidOCRPDFLoader, RapidOCRPPTLoader) enable text extraction from Word, images, PDFs, and PowerPoint files using RapidOCR, while a utility function provides flexible OCR engine selection. Additionally, a CSV loader allows selective column reading, and a title-enhancement utility improves context for Chinese documents.

_libs/chatchat-server/chatchat/server/file\_rag/document\loaders · high confidence

Add MCP connection management page

A new MCP management page has been added to the web UI, providing a dedicated interface for managing MCP connections and profiles. This includes full CRUD operations (create, read, update, delete) for connections, allowing users to add, edit, and delete connections with improved session state handling and validation. The page features a modern UI with status indicators and card-based layouts for managing connection configurations.

_libs/chatchat-server/chatchat/webui\pages/mcp · high confidence

Add Xinference manager tool for model management

A new Python script \tools/model\_loaders/xinference\_manager.py\ has been added. This tool provides a Streamlit-based interface for managing models in a running Xinference instance. It allows users to view currently running models, register custom model paths, and configure cache directories for various model types including LLM, embedding, image, rerank, and audio.

_tools/model\loaders · high confidence

Add ZhipuAI embedding support and agent toolkit exports

Users can now generate text embeddings using the ZhipuAI model via the new \ZhipuAIEmbeddings\ class in \libs/chatchat-server/langchain\_chatchat/embeddings/zhipuai.py\. Additionally, the \agent\toolkits\ module now explicitly exports \AdapterAllTool\ and \BaseToolOutput\ in its \\\init\\_.py\, making these components available for agent-based workflows.

_libs/chatchat-server/langchain\_chatchat/agent\_toolkits, libs/chatchat-server/langchain\chatchat/embeddings · high confidence

Added MCP (Model Context Protocol) integration for agent toolkits

The \mcp\_kit\ module has been introduced to the \agent\_toolkits\ package, providing a new way for agents to interact with external tools via the Model Context Protocol. This addition includes a \MultiServerMCPClient\ that supports both stdio and SSE transports, allowing the system to connect to multiple MCP servers. The implementation converts MCP tools and prompts into LangChain-compatible tools and messages, enabling agents to execute remote tool calls and process their results seamlessly.

_libs/chatchat-server/langchain\_chatchat/agent\_toolkits/mcp\kit · high confidence

Added chat model and utility components for platform integration

Added new files to the chat\models and utils packages to support a new chat model implementation and associated utilities. This includes the base chat model wrapper (base.py) and its exports (\\init\\_.py), a custom message chunk class for handling platform-specific tool calls (platform\_tools\_message.py), and utility modules for managing conversation history (history.py) and parsing JSON responses (try\_parse\_json\_object.py). The utils package also introduces a PYDANTIC\_V2 flag to handle Pydantic version differences.

_libs/chatchat-server/langchain\_chatchat/chat\_models, libs/chatchat-server/langchain\chatchat/utils · high confidence

Added sample knowledge base data for testing

Added two new CSV files, \langchain-ChatGLM\_closed.csv\ and \langchain-ChatGLM\_open.csv\, to the \libs/chatchat-server/chatchat/data/knowledge\_base/samples/content/test\_files\ directory. These files contain structured test data (title, file, url, detail, id) derived from GitHub issues, providing sample content for the knowledge base system.

libs/chatchat-server/chatchat/data · high confidence

Added startup scripts for Xinference and ChatChat

New shell scripts have been added to the autodl\_start\_script directory to automate the startup of the Xinference model server and the ChatChat application. The startup.sh script manages the lifecycle of these services by killing any existing processes, downloading the required model, and then launching Xinference followed by ChatChat.

_tools/autodl\_start\script · high confidence

Introduce LangChain-Chatchat package with ChatPlatformAI and PlatformToolsRunnable

The langchain\_chatchat package is introduced, exposing the ChatPlatformAI chat model and the PlatformToolsRunnable agent tool. Users can now import and use these components directly from the package.

_libs/chatchat-server/langchain\chatchat · high confidence

Introduce agents\_registry module for centralized agent creation

Added the agents\_registry module, which provides a unified registry for creating various agent executors (such as GLM3, Qwen, platform-agent, and default agents) with support for MCP tools and structured output parsing.

_libs/chatchat-server/chatchat/server/agents\registry · high confidence

Introduce dedicated database repository modules for conversations, messages, knowledge bases, and MCP connections

The \libs/chatchat-server/chatchat/server/db/repository\ directory now contains a set of new, dedicated repository modules that encapsulate database interactions for core features. This includes \conversation\_repository\ for managing chat conversations, \message\_repository\ for storing and filtering chat messages, \human\_message\_event\_repository\ for tracking human feedback events, \knowledge\_base\_repository\ for handling knowledge base metadata and file counts, \knowledge\_file\_repository\ for managing document storage and deletion, \knowledge\_metadata\_repository\ for summary chunks, and \mcp\_connection\_repository\ for creating, updating, and retrieving MCP connection configurations. These modules provide a structured, centralized way to interact with the database for these specific domains.

libs/chatchat-server/chatchat/server/db/repository · high confidence

Introduce new RAG retriever services and implementations

Added a new \file\_rag/retrievers\ module providing a \BaseRetrieverService\ interface and concrete implementations: \EnsembleRetrieverService\ (combining BM25 and vector search), \VectorstoreRetrieverService\ (standard vectorstore retrieval), and \MilvusVectorstoreRetrieverService\ (with explicit score-threshold filtering for Milvus). These classes expose \from\_vectorstore\ and \get\_relevant\_documents\ methods to standardize how documents are retrieved and ranked in the RAG pipeline.

_libs/chatchat-server/chatchat/server/file\rag/retrievers · high confidence

Introduce platform-specific agent execution and tool schemas

Added a new \platform\_tools\ module that provides a \PlatformToolsRunnable\ and \PlatformToolsAgentExecutor\ to handle agent loops and tool execution for the platform. This includes new Pydantic-based schema classes (\PlatformToolsAction\, \PlatformToolsFinish\, etc.) to structure agent steps and outputs, and integrates MCP tool support into the agent executor. The change also updates the \agents\ package to export the new runnable and schema components.

_libs/chatchat-server/langchain\_chatchat/agents/platform\tools · high confidence

Introduce structured chat agents for multiple LLM backends

Added new agent implementations for ChatGLM3, Qwen, and a generic base agent, each providing a dedicated prompt template and output parser. The platform knowledge agent now supports current working directory inputs and integrates MCP tools alongside standard tools, with improved parameter validation and prompt formatting to emphasize required fields.

_libs/chatchat-server/langchain\_chatchat/agents/structured\chat · high confidence

Introduced new model configuration and document model structures

Added a new \DocumentWithVSId\ class in the server's knowledge base model to handle vectorized documents with associated IDs and scores. On the web UI side, a new \model\_config\ module was introduced, exposing a \model\_config\_page\ function to manage model configuration settings.

_libs/chatchat-server/chatchat/server/knowledge\_base/model, libs/chatchat-server/chatchat/webui\_pages/model\config · medium confidence

Introduced thread-safe caching for FAISS vector stores

Added new \base.py\ and \faiss\_cache.py\ files in the \kb\_cache\ directory to implement a thread-safe caching mechanism for FAISS vector stores. This introduces \ThreadSafeObject\ and \CachePool\ classes that manage the lifecycle of vector stores, ensuring safe concurrent access and automatic memory management (LRU eviction) for knowledge base operations.

_libs/chatchat-server/chatchat/server/knowledge\_base/kb\cache · high confidence

Knowledge base management UI added

The knowledge base management interface is now available in the web UI, allowing users to create and manage knowledge bases, upload documents, and configure chunking and embedding settings directly from the browser.

_libs/chatchat-server/chatchat/webui\_pages/knowledge\base · high confidence

New API server structure with unified chat and MCP connection management

The API server has been restructured into a modular layout with separate route files for chat, knowledge base, MCP connections, and OpenAI compatibility. A new unified chat endpoint at /chat/completions accepts OpenAI-compatible requests and supports tool calling, streaming, and MCP (Model Context Protocol) integration. MCP connection management is now exposed via dedicated routes for creating, updating, and deleting connections, along with profile configuration for timeout, working directory, and environment variables. The server app now explicitly includes all route modules, enabling a cleaner separation of concerns and easier maintenance.

_libs/chatchat-server/chatchat/server/api\server · high confidence

New Knowledge Base Chat and API client module

The \webui\_pages\ directory now includes \kb\_chat.py\ and \utils.py\, introducing a dedicated interface for Knowledge Base (RAG) chat. Users can now select knowledge bases, configure RAG parameters (top-k, score threshold), and manage conversation history within this new page. The \utils.py\ module provides a synchronous \ApiRequest\ class to handle HTTP interactions with the backend API, supporting retries and streaming responses for chat and file uploads.

_libs/chatchat-server/chatchat/webui\pages · high confidence

New Python SDK and server-side type definitions for chat, knowledge base, and tool APIs

The update introduces a new Python SDK (open\_chatcaht) alongside server-side type definitions and constants. The SDK provides clients for chat, knowledge base, server configuration, standard OpenAI-compatible endpoints, and tool calling, each with corresponding Pydantic parameter models (e.g., KbChatParam, FileChatParam, CreateKnowledgeBaseParam). The server-side changes add a ResponseCode constant and a BaseResponse type to standardize API responses. Users can now interact with the platform programmatically via the new SDK, supporting streaming responses, file uploads, and knowledge base management.

libs/chatchat-server/chatchat/server/constant, libs/chatchat-server/chatchat/server/types, libs/python-sdk · high confidence

New agent callback handler and core protocol definitions

Added a new \AgentExecutorAsyncIteratorCallbackHandler\ in \agent\_callback\handler.py\ to manage agent execution events (LLM, tool, and finish states) and stream status updates via an async queue. The \\\init\\_.py\ now exports this handler. Additionally, \core/protocol.py\ introduces the \AgentBackend\ and \AgentStore\ abstract interfaces, along with Pydantic models (\FunctionCall\, \FunctionCallStatus\) to support backend approval workflows for tool execution.

_libs/chatchat-server/langchain\chatchat/callbacks · high confidence

New agent tools and file RAG retrievers

The agent toolkit now includes a wider range of tools: Amap POI search, Amap weather, Arxiv, calculator, internet search (Bing, DuckDuckGo, Metaphor, Searx), local knowledge base search, YouTube search, shell, text-to-image, text-to-PromQL, text-to-SQL, URL reader, weather check, Wikipedia search, and Wolfram. Additionally, the file RAG module introduces an ensemble retriever alongside the existing vectorstore and Milvus vectorstore retrievers, allowing users to choose their preferred retrieval strategy.

libs/chatchat-server/chatchat/server/agent · high confidence

New all-tools adapter framework for code interpreter, drawing, and web browser tools

A new \all\_tools\ package has been added to \langchain\_chatchat.agent\_toolkits\, introducing a unified adapter pattern for agent tools. This includes a \BaseToolOutput\ class to standardize tool outputs, an \AllToolExecutor\ base class, and specific adapters for code interpretation, drawing, and web browsing. The \registry.py\ file maps structural types to their corresponding adapter classes, enabling a consistent interface for executing these tools within the agent framework.

_libs/chatchat-server/langchain\_chatchat/agent\_toolkits/all\tools · high confidence

New all\_tools.py module for agent scratchpad formatting

A new module, all\_tools.py, has been added to the agents/format\_scratchpad directory. This file introduces a \_create\_tool\_message helper and a format\_to\_platform\_tool\_messages function that convert intermediate agent steps into formatted messages for specific tools (CodeInterpreter, DrawingTool, WebBrowser) and generic tool actions, enabling the agent to process and format tool outputs correctly during execution.

_libs/chatchat-server/langchain\_chatchat/agents/format\scratchpad · high confidence

New chat and RAG endpoints with MCP support and file upload

Added new chat endpoints in \libs/chatchat-server/chatchat/server/chat/\ to support agent-based conversations, file-based RAG, and standard completions. The \chat.py\ module introduces an \agent\ chat mode that supports dynamic MCP (Model Context Protocol) connections, allowing users to toggle MCP usage for agent interactions. The \file\_chat.py\ module enables uploading files for temporary knowledge base creation and subsequent chat. The \kb\_chat.py\ module provides a unified endpoint for local, temporary, and search engine-based RAG. Additionally, \completion.py\ offers a standard LLM completion endpoint, while \feedback.py\ and \human\_message\_event.py\ handle user feedback and human-in-the-loop events. A new \reranker.py\ component integrates document reranking using \sentence\_transformers\.

libs/chatchat-server/chatchat/server/chat · high confidence

New database models for chat, knowledge, and MCP connections

The database layer now includes new SQLAlchemy models for managing conversations, messages, human feedback events, knowledge bases and files, summary chunks, and MCP (Model Context Protocol) connections and profiles. This introduces the underlying data structures for chat history, user feedback, document management, and external tool connections, enabling the system to store and retrieve these specific types of data.

libs/chatchat-server/chatchat/server/db/models · high confidence

New dialogue page implementation with multi-modal support

The dialogue interface has been refactored into a new module (dialogue.py) that introduces support for image-based conversations and multi-modal file handling. Users can now upload and process images, videos, and audio files, with utilities provided to encode these assets for API transmission. The page also includes session management, model configuration dialogs, and integration with the chat box component to handle context and history.

_libs/chatchat-server/chatchat/webui\pages/dialogue · high confidence

Restructured and expanded the knowledge base API with new summary and migration capabilities

The knowledge base module has been reorganized into a dedicated directory, introducing new API endpoints for managing knowledge base summaries and migrating data. Users can now generate and update document summaries via the new \kb\_summary\_api\ endpoints, which support batch and single-file summarization using configurable LLM parameters. Additionally, a \migrate.py\ script has been added to handle database imports and local folder synchronization, supporting modes for recreating vector stores, updating existing records, or performing incremental updates. The \kb\api\ has been updated to use the default vector store type from settings, and the \\\init\\_.py\ file now explicitly exposes the core API functions.

_libs/chatchat-server/chatchat/server/knowledge\base · high confidence

Unified knowledge base service architecture for vector stores

The knowledge base module has been refactored into a unified \KBService\ abstract base class that standardizes operations like \add\_doc\, \delete\_doc\, and \search\ across different vector stores. New concrete implementations have been added for Faiss, Milvus, Zilliz, Elasticsearch, ChromaDB, PostgreSQL (PGVector), and Relyt, each handling the specific logic for that backend. This change provides a consistent interface for managing knowledge bases regardless of the underlying storage technology.

_libs/chatchat-server/chatchat/server/knowledge\_base/kb\service · high confidence

Removals

Repository initialization and removal of legacy ChatGLM implementation

The repository was initialized with standard configuration files, including a comprehensive .gitignore, Apache 2.0 LICENSE, and a release.py script for version management. The project removed the legacy \chatglm\_llm.py\ and \knowledge\_based\_chatglm.py\ files, which previously provided a direct, hardcoded integration with the ChatGLM-6B model via the \langchain\ framework. This change reflects a shift away from a single-model, direct-integration approach toward a more modular architecture that supports multiple model deployment frameworks.

(repo-wide) · high confidence

Behavioural changes

Added legacy server startup scripts and LocalAI embedding support

The server directory now includes new entry-point scripts for launching the application: \api\_allinone\_stale.py\ and \webui\_allinone\_stale.py\ provide all-in-one startup for the API and web UI respectively, while \llm\_api\_shutdown.py\ offers a dedicated script to terminate LLM services. Additionally, \localai\_embeddings.py\ introduces support for LocalAI embeddings, and compatibility shims (\pydantic\_v1.py\, \pydantic\_v2.py\) are added to support both Pydantic v1 and v2.

libs/chatchat-server/chatchat/server · high confidence

Introduce CLI, YAML-based configuration, and structured logging

The project now supports a command-line interface (CLI) for initialization and database management, allowing users to configure LLM and embedding models, and rebuild knowledge bases directly from the terminal. Configuration has been migrated to YAML files, enabling easier editing and automatic reloading. Additionally, the application now uses structured logging via the \loguru\ library, providing better log management and filtering capabilities.

libs/chatchat-server/chatchat · high confidence

New output parsers for agent tool execution

Added a new \output\_parsers\ subpackage containing specialized output parsers for various agent types (GLM3, Qwen, structured chat, platform tools, and platform knowledge). These parsers handle the conversion of LLM responses into agent actions, including support for MCP tools, code interpretation, drawing, and web browsing. The \PlatformKnowledgeOutputParserCustom\ now cleans message content before XML wrapping and handles additional tool tags, while the \PlatformToolsAgentOutputParser\ routes parsing based on the agent's instance type, enabling more robust and consistent tool execution across different model backends.

_libs/chatchat-server/langchain\_chatchat/agents/output\parsers · high confidence

Test coverage

Added comprehensive test coverage for the Chatchat server

Added new test suites for the Chatchat server, including API endpoint tests for knowledge base operations, streaming chat, and tool execution, as well as integration tests for MCP platform tools, document loaders, and vector database services.

libs/chatchat-server/tests · high confidence

Dependencies

Migrate project dependency management to Poetry and update core libraries

The project has transitioned from using flat requirements.txt files to a structured Poetry-based dependency management system. The root requirements.txt has been removed and replaced with pyproject.toml files for the server, Python SDK, and root project. This update upgrades core dependencies including langchain to 0.1.17, pydantic to \~2.11.1, and fastapi to \~0.109.2, while adding new optional dependencies for features like Xinference, ZhipuAI, and Ollama. The migration also introduces a custom PyPI mirror (Tsinghua) for faster downloads and organizes test and linting dependencies into separate groups.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 35 → 50 (+14.9)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 92 → 86 (-6.2)
  • Architecture 96 → 96 (+0.3)
  • Maturity 50 → 51 (+1.1)
  • Readiness 21 → 52 (+30.5)
  • Security 24 → 38 (+14.1)

Resolved (48)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • Duplicated block (10 lines × 2) (libs/chatchat-server/langchain_chatchat/chat_models/base.py)
  • Duplicated block (15 lines × 2) (libs/python-sdk/open_chatcaht/api_client.py)
  • Duplicated block (16 lines × 2) (libs/chatchat-server/chatchat/webui_pages/utils.py)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 28 more

New (232)

  • Banned license: text-unidecode
  • ChatPlatformAI._combine_llm_outputs (cognitive 16) (libs/chatchat-server/langchain_chatchat/chat_models/base.py)
  • ChatPlatformAI.astream (cognitive 37) (libs/chatchat-server/langchain_chatchat/chat_models/base.py)
  • ChatPlatformAI.stream (cognitive 41) (libs/chatchat-server/langchain_chatchat/chat_models/base.py)
  • ChineseRecursiveTextSplitter._split_text (cognitive 22) (libs/chatchat-server/chatchat/server/file_rag/text_splitter/chinese_recursive_text_splitter.py)
  • ChineseTextSplitter.split_text (cognitive 38) (libs/chatchat-server/chatchat/server/file_rag/text_splitter/chinese_text_splitter.py)
  • Documentation: no project overview (docs/install/README_text2sql.md)
  • Documentation: no project overview (docs/install/README_xinference.md)
  • Dormant codebase
  • Duplicated block (10 lines × 2) (libs/chatchat-server/chatchat/server/api_server/openai_routes.py)
  • Duplicated block (10 lines × 2) (libs/chatchat-server/chatchat/webui_pages/utils.py)
  • Duplicated block (10 lines × 2) (libs/chatchat-server/langchain_chatchat/agents/all_tools_agent.py)
  • Duplicated block (10–11 lines × 3) (libs/chatchat-server/langchain_chatchat/agents/structured_chat/glm3_agent.py)
  • Duplicated block (10–11 lines × 5) (libs/chatchat-server/chatchat/server/api_server/mcp_routes.py)
  • Duplicated block (10–14 lines × 3) (libs/chatchat-server/langchain_chatchat/agents/output_parsers/tools_output/code_interpreter.py)
  • Duplicated block (11 lines × 2) (libs/chatchat-server/chatchat/server/chat/chat.py)
  • Duplicated block (11 lines × 2) (libs/chatchat-server/chatchat/server/chat/file_chat.py)
  • Duplicated block (11 lines × 2) (libs/chatchat-server/chatchat/webui_pages/utils.py)
  • Duplicated block (12 lines × 2) (libs/chatchat-server/chatchat/server/agents_registry/agents_registry.py)
  • Duplicated block (12 lines × 2) (libs/chatchat-server/chatchat/server/localai_embeddings.py)
  • …and 212 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

chatchat-space/Langchain-Chatchat was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 26 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 49165d6af4438aa7e8a1f71ce276db55f4405151 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-d0929f7ac71f.