$ show zhimaAi/chatwiki
ChatWiki is an open-source, multi-service AI chatbot and workflow automation platform primarily targeting the WeChat ecosystem. In production, it operates as a suite of Go microservices (chatwiki, message_service, code_run, websocket, plugin, llm_runner) behind a Gin web server, with a Vue 3 admin panel, separate mobile/PC/Electron frontends, and an embeddable SDK. The core functionality includes knowledge base management (document ingestion, chunking, vector storage with pgvector), a LogicFlow-based visual workflow builder, multi-channel messaging (WeChat Official Account, Mini Program, Feishu, DingTalk, Telegram, WhatsApp, LINE), and an AI agent framework called Clawbot with skill reuse. External dependencies include PostgreSQL (with pgvector and AGE graph extension), Redis, NSQ message queue, and optional Neo4j and E2B sandbox. While the system is primarily an application, it incorporates data-intensive components such as RAG pipelines, LLM request logging, and daily statistics, giving it a hybrid character.
The LLM identified 5 files worth highlighting for reuse:
Provides a generic, typed Pipeline struct (Pipeline[In, Out]) with Pipe and Process methods for composing sequential processing steps. Fully decoupled from business logic, it enables reusable flow construction for chat processing, document pipelines, or any transformation chain. The interface is clean and can be extracted into a standalone library with minimal modification.
Implements Reciprocal Rank Fusion (RRF) for combining ranked results from multiple sources (e.g., vector similarity, BM25, keyword search). A standalone function with configurable k constant, it is reusable across any project needing multi-source ranking fusion. Demonstrates a clear implementation of a well-known information retrieval technique.
Implements a cache-with-build pattern using Redis. Provides GetCacheWithBuild, GetCacheIncrWithBuild, and AddLock functions with a generic CacheBuildHandler interface. Supports stale-while-revalidate strategy and distributed locking. Decoupled from specific domains, it can be reused in any Go application needing a cache-aside pattern with automatic refresh.
A configurable recursive character text splitter for chunking documents. Supports custom separators, chunk size, overlap, and encoding options (e.g., markdown code blocks, reference links). Derived from langchaingo but simplified and self-contained. Reusable in any document processing or RAG pipeline that requires deterministic chunking.
A Vue composable for WebSocket connection management with automatic reconnect, heartbeat (ping/pong), and event-based emission. Handles visibility changes, exponential backoff, and cleanup. Encapsulates the full lifecycle of a real-time connection. Reusable across any Vue 3 project needing reliable WebSocket communication, directly extractable with no internal dependencies.