diff --git a/.github/workflows/sync-blog-articles.yml b/.github/workflows/sync-blog-articles.yml new file mode 100644 index 000000000..0dce8ed53 --- /dev/null +++ b/.github/workflows/sync-blog-articles.yml @@ -0,0 +1,52 @@ +name: Sync LangBot Blog articles + +on: + workflow_dispatch: + schedule: + - cron: "17 2 * * *" + +permissions: + contents: write + +concurrency: + group: sync-langbot-blog-articles + cancel-in-progress: false + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Check out Wiki + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Check out LangBot landing page + uses: actions/checkout@v5 + with: + repository: langbot-app/langbot-landing-page + path: .article-source + persist-credentials: false + + - name: Synchronize articles and images + run: node scripts/sync-blog-articles.mjs --source .article-source + + - name: Validate generated articles + run: | + node scripts/sync-blog-articles.mjs --check --source .article-source + node scripts/sync-blog-articles.mjs --check + npm test + npx --yes mintlify@4.2.375 validate + + - name: Commit synchronized content + run: | + rm -rf .article-source + if git diff --quiet && test -z "$(git status --short)"; then + echo "LangBot Blog articles are already synchronized." + exit 0 + fi + git config user.name "langbot-wiki-bot" + git config user.email "actions@users.noreply.github.com" + git add docs.json en/articles zh/articles ja/articles images/articles scripts/blog-articles-manifest.json + git commit -m "docs(articles): sync LangBot Blog" + git push diff --git a/docs.json b/docs.json index 063d57376..972ce725b 100644 --- a/docs.json +++ b/docs.json @@ -710,6 +710,49 @@ } ] }, + { + "tab": "Articles", + "groups": [ + { + "group": "Browse", + "pages": [ + "en/articles/index" + ] + }, + { + "group": "Product Updates", + "pages": [ + "en/articles/langbot-cloud-multi-user-workspaces" + ] + }, + { + "group": "Engineering", + "pages": [ + "en/articles/langbot-v4100-sandbox-skills", + "en/articles/langbot-v490-rag-plugin-architecture", + "en/articles/langbot-plugin-system-deep-dive" + ] + }, + { + "group": "Tutorials & Integrations", + "pages": [ + "en/articles/langtars-remote-pc-control-dify-n8n", + "en/articles/connect-deepseek-to-wechat", + "en/articles/deploy-ai-bot-in-5-minutes", + "en/articles/dify-agent-discord-telegram-slack", + "en/articles/langflow-drag-and-drop-ai-bot", + "en/articles/n8n-multi-platform-ai-chatbot", + "en/articles/dify-langbot-rag-knowledge-base" + ] + }, + { + "group": "Announcements", + "pages": [ + "en/articles/welcome" + ] + } + ] + }, { "tab": "API Reference", "groups": [ @@ -949,6 +992,49 @@ } ] }, + { + "tab": "文章", + "groups": [ + { + "group": "浏览", + "pages": [ + "zh/articles/index" + ] + }, + { + "group": "产品动态", + "pages": [ + "zh/articles/langbot-cloud-multi-user-workspaces" + ] + }, + { + "group": "技术解析", + "pages": [ + "zh/articles/langbot-v4100-sandbox-skills", + "zh/articles/langbot-v490-rag-plugin-architecture", + "zh/articles/langbot-plugin-system-deep-dive" + ] + }, + { + "group": "教程与集成", + "pages": [ + "zh/articles/langtars-remote-pc-control-dify-n8n", + "zh/articles/connect-deepseek-to-wechat", + "zh/articles/deploy-ai-bot-in-5-minutes", + "zh/articles/dify-agent-discord-telegram-slack", + "zh/articles/langflow-drag-and-drop-ai-bot", + "zh/articles/n8n-multi-platform-ai-chatbot", + "zh/articles/dify-langbot-rag-knowledge-base" + ] + }, + { + "group": "公告", + "pages": [ + "zh/articles/welcome" + ] + } + ] + }, { "tab": "API 参考", "groups": [ @@ -1163,6 +1249,49 @@ } ] }, + { + "tab": "記事", + "groups": [ + { + "group": "一覧", + "pages": [ + "ja/articles/index" + ] + }, + { + "group": "製品アップデート", + "pages": [ + "ja/articles/langbot-cloud-multi-user-workspaces" + ] + }, + { + "group": "エンジニアリング", + "pages": [ + "ja/articles/langbot-v4100-sandbox-skills", + "ja/articles/langbot-v490-rag-plugin-architecture", + "ja/articles/langbot-plugin-system-deep-dive" + ] + }, + { + "group": "チュートリアルと連携", + "pages": [ + "ja/articles/langtars-remote-pc-control-dify-n8n", + "ja/articles/connect-deepseek-to-wechat", + "ja/articles/deploy-ai-bot-in-5-minutes", + "ja/articles/dify-agent-discord-telegram-slack", + "ja/articles/langflow-drag-and-drop-ai-bot", + "ja/articles/n8n-multi-platform-ai-chatbot", + "ja/articles/dify-langbot-rag-knowledge-base" + ] + }, + { + "group": "お知らせ", + "pages": [ + "ja/articles/welcome" + ] + } + ] + }, { "tab": "API リファレンス", "groups": [ diff --git a/en/articles/connect-deepseek-to-wechat.mdx b/en/articles/connect-deepseek-to-wechat.mdx new file mode 100644 index 000000000..db79b8074 --- /dev/null +++ b/en/articles/connect-deepseek-to-wechat.mdx @@ -0,0 +1,103 @@ +--- +title: "How to Connect DeepSeek R1 to WeChat, Discord & Telegram in 5 Minutes (FREE)" +description: "A step-by-step guide to connecting DeepSeek R1/V3 API to WeChat (Personal/Enterprise), Discord, Telegram, and more using LangBot. No coding required." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/connect-deepseek-to-wechat). + +Published 2026-02-21 · Author: LangBot Team + +![DeepSeek x WeChat Integration](/images/articles/source/images/covers/deepseek-wechat.png) + +DeepSeek has taken the AI world by storm. Its R1 reasoning model rivals OpenAI's o1 but is open-source and significantly cheaper. + +However, the official DeepSeek app currently only supports "AI Search" in WeChat, and direct integration into group chats or private workflows is limited. + +**What if you could have a fully functional DeepSeek R1 bot in your WeChat groups, Discord servers, and Telegram chats right now?** + +With **LangBot**, you can. And it takes less than 5 minutes. + +## Why LangBot? + +LangBot is an open-source, production-grade IM bot platform. Unlike simple scripts or single-platform bots, LangBot gives you: + +* **Unified Platform:** Connect once, deploy to WeChat, Discord, Telegram, Slack, Lark, and more. +* **Model Agnostic:** Use DeepSeek R1, V3, Claude 3.5, GPT-4, or local Ollama models. +* **No Coding:** robust WebUI for configuration. +* **Enterprise Features:** Knowledge base (RAG), Plugin system, and multi-user management. + +## Prerequisites + +1. **A Server or PC:** Docker installed (VPS, local computer, or Synology/NAS). +2. **DeepSeek API Key:** + * **Official:** [platform.deepseek.com](https://platform.deepseek.com) + * **SiliconFlow (Recommended for speed):** [cloud.siliconflow.cn](https://cloud.siliconflow.cn) (Faster R1 inference). + +## Step 1: Deploy LangBot + +If you haven't deployed LangBot yet, run this one command: + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +Access your dashboard at `http://localhost:5300` (or your server IP). + +## Step 2: Configure DeepSeek Model + +1. Go to **Models** -> **Provider List**. +2. Find **DeepSeek** (or **SiliconFlow** / **OpenAI Compatible**). +3. Enter your API Key. +4. Click **Save**. + +Now create a **Model Instance**: +* **Name:** `DeepSeek-R1-Bot` +* **Model:** `deepseek-reasoner` (for R1) or `deepseek-chat` (for V3). + +## Step 3: Create a Chat Pipeline + +LangBot uses "Pipelines" to manage bot logic. + +1. Go to **Pipelines** -> **New Pipeline**. +2. Choose **Chat Pipeline**. +3. Select your `DeepSeek-R1-Bot` model. +4. (Optional) Add a System Prompt: + > "You are a helpful assistant powered by DeepSeek R1. You think deeply before answering." + +## Step 4: Connect to WeChat (or any platform) + +### For WeChat (Personal / Wechaty) +*Note: Personal WeChat access relies on third-party libraries and carries some risk. For business use, we recommend Enterprise WeChat (WeCom).* + +1. Go to **Bots** -> **New Bot**. +2. Select **WeChat**. +3. Choose the **GeweChat** or **Wechaty** adapter (depending on your preference). +4. Click **Save**. +5. Scan the QR code that appears in the logs or UI. + +### For Discord / Telegram +1. Select **Discord** or **Telegram**. +2. Paste your **Bot Token** (from Discord Developer Portal or BotFather). +3. Click **Save**. + +## Step 5: Test It Out! + +Open your chat app and send a message. You should see DeepSeek R1 "thinking" (if supported) and replying with high-quality reasoning. + +## Advanced: Using Search & Tools + +DeepSeek is great, but DeepSeek with **Internet Access** is better. + +In LangBot: +1. Go to **Plugins**. +2. Install **Tavily Search** or **Google Search**. +3. Add the plugin to your DeepSeek Pipeline. + +Now your bot can search the web for real-time info *before* reasoning with DeepSeek R1! + +--- + +**Ready to build?** +[Star us on GitHub](https://github.com/langbot-app/LangBot) or [Read the Docs](https://docs.langbot.app). diff --git a/en/articles/deploy-ai-bot-in-5-minutes.mdx b/en/articles/deploy-ai-bot-in-5-minutes.mdx new file mode 100644 index 000000000..35fe08ef4 --- /dev/null +++ b/en/articles/deploy-ai-bot-in-5-minutes.mdx @@ -0,0 +1,170 @@ +--- +title: "Deploy Your Own AI Bot to Discord, Telegram & WeChat in 5 Minutes" +description: "A step-by-step guide to deploying LangBot — the open-source platform that connects 20+ LLMs to 13+ messaging platforms with a single Docker command." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/deploy-ai-bot-in-5-minutes). + +Published 2026-02-17 · Author: LangBot Team + +![LangBot Dashboard](/images/articles/source/images/covers/deploy-ai-bot.png) + +What if you could have GPT-5, Claude, DeepSeek, and Gemini all answering questions in your Discord server, Telegram group, and WeChat — at the same time? + +No API wrangling. No weeks of development. Just one Docker command. + +That's **LangBot** — and it just crossed **15,000 stars** on GitHub. + +## The Problem Everyone Faces + +You want an AI assistant in your team's chat. Maybe for customer support on Telegram. Maybe for a coding helper in Discord. Maybe for a knowledge base bot in your company's WeChat or Lark group. + +But then reality hits: + +- Each platform has its own bot API, webhook format, and auth flow +- You need to handle message queuing, session management, and error recovery +- Switching LLM providers means rewriting your integration layer +- Adding RAG or tool calling is yet another project + +LangBot solves all of this with a single, unified platform. + +## What Makes LangBot Different + +### 13+ Messaging Platforms, One Codebase + +Deploy a single LangBot instance and connect it to: + +**Global:** Discord, Telegram, Slack, LINE, WhatsApp +**Asia:** WeChat (Official Account), WeCom, QQ, Lark, DingTalk, Feishu, KOOK + +Each platform gets its own adapter — you just fill in your bot token in the WebUI and you're live. + +![LangBot Bot Management Page](/images/articles/source/images/article-mcp/13-bot-page.png) + +### 20+ LLM Models, Zero Lock-in + +Through **LangBot Space**, you get instant access to 20 cloud models out of the box — no API keys to manage: + +- **Claude** (Opus 4.6, Sonnet 4.5, Haiku 4.5) +- **GPT** (GPT-5.2, GPT-5-mini, GPT-4.1-mini) +- **Gemini** (3 Pro, 2.5 Pro, 2.5 Flash) +- **DeepSeek** (R1, V3) +- **Grok** (4, 4.1) +- **Qwen** (3 Max) + +Or add your own providers — OpenAI-compatible endpoints, Ollama for local models, any provider you want. + +![Model Selection](/images/articles/source/images/article-mcp/08-model-select.png) + +### Built-in Agent with Tool Calling + +LangBot's Local Agent isn't just a chat wrapper — it's a full agent runtime: + +- **Multi-round conversations** with configurable memory +- **Function calling / tool use** for LLM-driven actions +- **MCP (Model Context Protocol)** support for connecting to 100+ pre-built tools +- **Knowledge base (RAG)** with built-in vector search + +![Pipeline AI Configuration](/images/articles/source/images/article-mcp/06-pipeline-ai.png) + +### Plugin Marketplace + +37+ community plugins and growing — install with one click: + +- **WebSearch** — Let your bot search the web +- **AI Image Generator** — Generate images from text +- **LinkAnaly** — Auto-preview links in chat +- **ScheNotify** — Schedule reminders with natural language +- **Google Search**, **Tavily Search**, **RAGFlow Retriever**, and more + +![LangBot Space Plugin Market](/images/articles/source/images/article-mcp/14-space-market.png) + +## Deploy in 5 Minutes — For Real + +### Step 1: Run Docker Compose + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +That's it. LangBot is now running at `http://localhost:5300`. + +### Step 2: Initialize with LangBot Space + +Open the WebUI and click **"Initialize with Space"**. This connects your instance to LangBot Space, giving you: + +- 20 cloud models ready to use (with free credits) +- One-click plugin installation +- Managed API keys + +![Initialize with Space](/images/articles/source/images/article-mcp/01-init-page.png) + +### Step 3: Configure Your Pipeline + +Go to **Pipelines** and edit the default `ChatPipeline`: + +1. Select your model (e.g., `deepseek-v3`, `gpt-5-mini`, `claude-sonnet-4-5`) +2. Customize the system prompt +3. Optionally attach a knowledge base or enable tools + +![Pipelines Page](/images/articles/source/images/article-mcp/05-pipelines.png) + +### Step 4: Connect a Platform + +Go to **Bots** → click **+** → choose your platform (Discord, Telegram, etc.) → enter your bot token. + +Done. Your bot is live. + +### Step 5: Test It + +Use the built-in **Debug Chat** to test your pipeline before going live: + +![Debug Chat](/images/articles/source/images/article-mcp/07-debug-chat.png) + +## Real Conversations, Real Value + +Here's what it looks like when LangBot is running in a QQ group — users asking technical questions and getting instant, accurate answers: + +![Group Chat Demo](/images/articles/source/images/article-mcp/10-group-chat.png) + +And in private chat: + +![Private Chat Demo](/images/articles/source/images/article-mcp/11-private-chat.png) + +## Architecture That Scales + +LangBot is built for production: + +- **Pipeline architecture** — each bot binds to a pipeline; pipelines handle AI logic, triggers, safety controls, and output formatting +- **Cross-process plugin isolation** — a bad plugin can't crash your bot +- **Multiple runner backends** — use LangBot's Local Agent, or connect to Dify, n8n, Langflow, Coze for complex workflows +- **Database flexibility** — SQLite for dev, PostgreSQL for production +- **Vector DB options** — Chroma, Qdrant, Milvus, pgvector, SeekDB + +## Why 15,000+ Developers Choose LangBot + +| Feature | LangBot | Building from Scratch | +|---------|---------|----------------------| +| Platforms | 13+ ready | Weeks per platform | +| LLM Providers | 20+ models | Manual integration | +| Agent Runtime | Built-in | Build your own | +| RAG | Native + external | Separate project | +| Plugin System | Marketplace | DIY | +| Deployment | `docker compose up` | Days of setup | +| WebUI | Included | Build your own | + +## Get Started + +- **GitHub:** [github.com/langbot-app/LangBot](https://github.com/langbot-app/LangBot) — give us a star! +- **Documentation:** [docs.langbot.app](https://docs.langbot.app) +- **Plugin Market:** [space.langbot.app](https://space.langbot.app) + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +Your AI bot empire starts with one command. diff --git a/en/articles/dify-agent-discord-telegram-slack.mdx b/en/articles/dify-agent-discord-telegram-slack.mdx new file mode 100644 index 000000000..5813fab5b --- /dev/null +++ b/en/articles/dify-agent-discord-telegram-slack.mdx @@ -0,0 +1,115 @@ +--- +title: "Finally Got My Dify Agent Working in Discord, Telegram and Slack" +description: "Finally Got My Dify Agent Working in Discord, Telegram and Slack" +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/dify-agent-discord-telegram-slack). + +Published 2025-12-11 · Author: LangBot Team + +![Finally Got My Dify Agent Working in Discord, Telegram and Slack](/images/articles/source/images/covers/dify-agent.png) + +Want your Dify Agent to break free from the browser and chat directly in WeChat, QQ, or Telegram? Combine LangBot with Dify and you can set it up in under 10 minutes. + +## Why This Combo? + +[**LangBot**](https://github.com/langbot-app/LangBot) is the most powerful open-source multi-platform chatbot framework available. It supports major Chinese IMs (QQ, WeChat, Feishu, DingTalk) and international platforms (Telegram, Discord, Slack, LINE). Its core strength is connecting AI backends to messaging apps. + +**Dify** is one of the hottest AI app development platforms, offering visual Agent orchestration, 50+ built-in tools, and RAG knowledge bases. Together, they let you build a multi-platform AI assistant fast. + +## Deploy LangBot + +Three commands with uvx: + +```bash +mkdir langbot-instance +cd langbot-instance +uvx langbot@latest +``` + +Visit `http://127.0.0.1:5300` and register an admin account: + +![LangBot Dashboard](/images/articles/external/c6d52212ba91-02-langbot-dashboard.png) + +## Create a Dify Agent + +Log in to [cloud.dify.ai](https://cloud.dify.ai) and create a new app. Choose **Agent** type - unlike basic chat apps, Agents can reason autonomously and call tools for complex tasks. + +![Select Agent Type](/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png) + +### Configure the Agent + +In the orchestration interface, set up: + +**System Instructions** - Define the Agent's role: + +``` +You are an intelligent assistant that helps users complete various tasks. You have the following capabilities: +1. Answer various user questions +2. Query weather information +3. Retrieve webpage content + +Please always maintain a friendly and professional attitude. If you need to use tools to get information, proactively call the relevant tools. +``` + +**Add Tools** - Pick from Dify's 50+ built-in tools, like Weather and Web Scraper: + +![Add Tools](/images/articles/external/9066d99b172c-11-dify-tools-panel.png) + +**Select Model** - Supports GPT, Claude, Gemini, DeepSeek, and other major LLMs. + +Final configuration: + +![Configuration Complete](/images/articles/external/be278ca435e8-12-dify-agent-configured.png) + +### Get the API Key + +Click "Publish", then go to "Access API" to create a key: + +![Create API Key](/images/articles/external/471b316018e5-13-dify-api-key-created.png) + +Save the API key and server address `https://api.dify.ai/v1`. + +## Connect Dify to LangBot + +Back in LangBot, go to Pipelines > ChatPipeline > AI Capability: + +![AI Capability Config](/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png) + +Select **Dify Service API** as the Runner: + +![Select Dify Runner](/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png) + +Enter the configuration: +- **Base URL**: `https://api.dify.ai/v1` +- **API Key**: The key you just created +- **App Type**: Chat (including Chatflow) + +![Enter Configuration](/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png) + +Save and click "Debug Conversation" to test: + +![Test Conversation](/images/articles/external/9999c12907eb-20-langbot-chat-test.png) + +If the Agent responds correctly and calls tools, the integration is working. + +## Why This Architecture Rocks + +- **Decoupled Design**: Agent capabilities live in Dify, LangBot handles message routing - each does what it's best at +- **One Config, Multi-Platform**: Same Agent serves QQ, WeChat, Telegram, and more simultaneously +- **Easy to Extend**: Add RAG knowledge bases, Workflow orchestration, or more tools in Dify later + +## Next Steps + +- Configure messaging platforms in LangBot (QQ bot, WeChat personal account, etc.) +- Add more tools in Dify (database queries, API calls) +- Try Dify Chatflow for complex conversation flows + +If you're using n8n, FastGPT, Coze, or Langflow, LangBot supports those too. + +--- + +**Resources** + +- [LangBot Docs](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Dify Docs](https://docs.dify.ai) | [Cloud Platform](https://cloud.dify.ai) diff --git a/en/articles/dify-langbot-rag-knowledge-base.mdx b/en/articles/dify-langbot-rag-knowledge-base.mdx new file mode 100644 index 000000000..0040f6e71 --- /dev/null +++ b/en/articles/dify-langbot-rag-knowledge-base.mdx @@ -0,0 +1,204 @@ +--- +title: "LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations" +description: "LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations" +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/dify-langbot-rag-knowledge-base). + +Published 2025-12-02 · Author: LangBot Team + +![LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations](/images/articles/source/images/covers/dify-rag.png) + +LangBot 4.6.0 introduces external knowledge base functionality, allowing users to integrate external knowledge retrieval services such as Dify and RAGFlow into conversation pipelines. This tutorial demonstrates how to combine Dify knowledge base with LangBot to enable intelligent conversations based on domain-specific knowledge. + +## Feature Overview + +The external knowledge base feature enables LangBot to: +- Connect to various external knowledge retrieval services (Dify, RAGFlow, etc.) +- Provide professional answers based on domain-specific knowledge +- Flexibly extend knowledge retrieval capabilities through the plugin system +- Configure conveniently through WebUI without manual configuration file editing + +## Prerequisites + +Before starting, you need: +1. Deploy LangBot 4.6.0 or higher +2. Have a Dify account (register at https://cloud.dify.ai) +3. Configure a conversation model (this tutorial uses claude-opus-4-1-20250805) + +## Step 1: Deploy LangBot + +### 1.1 View LangBot Repository + +First, visit the [LangBot GitHub repository](https://github.com/langbot-app/LangBot) to understand the project. LangBot is a production-grade instant messaging bot development platform supporting multiple messaging platforms and LLM services. + +### 1.2 Learn About External Knowledge Base Feature + +Visit the [official LangBot documentation](https://docs.langbot.app) to view the external knowledge base usage instructions. The documentation provides detailed explanations on how to build built-in knowledge bases and connect to external knowledge bases. + +### 1.3 Start LangBot + +Use the `uvx langbot` command to quickly start LangBot, then visit http://127.0.0.1:5300 for initialization. Fill in your email and password to complete registration, then log in. + +### 1.4 Dashboard After Login + +After successfully logging in, you will see the LangBot WebUI dashboard. + +## Step 2: Configure Conversation Model + +Before using the knowledge base, you need to configure a conversation model. + +### 2.1 Navigate to Model Configuration Page + +Click "Models" in the left navigation bar to enter the model configuration page. + +### 2.2 Add New Model + +Click the "+" button to open the model configuration dialog. + +### 2.3 Fill in Model Information + +Fill in the following information: +- **Model Name**: claude-opus-4-1-20250805 +- **Model Provider**: New API +- **Request URL**: Your API endpoint +- **API Key**: Your API Key +- **Abilities**: Check Vision Ability and Function Call + +Click "Submit" to save the configuration. + +## Step 3: Create Knowledge Base in Dify + +### 3.1 Log in to Dify Platform + +Visit https://cloud.dify.ai and log in to your account. + +### 3.2 Navigate to Knowledge Page + +Click "Knowledge" in the top navigation bar to enter the knowledge base management page. + +### 3.3 Create New Knowledge Base + +Click "Create Knowledge" to start creating a knowledge base. + +### 3.4 Select Data Source + +You can choose from the following methods to import data: +- **Import from file**: Upload document files +- **Sync from Notion**: Sync from Notion +- **Sync from website**: Crawl website content + +This tutorial selects "Import from file" and uploads prepared LangBot documentation. + +### 3.5 Upload Document + +After uploading the document, the system will display file information. Click "Next" to proceed. + +### 3.6 Configure Document Processing Parameters + +On the document processing page, you can configure chunk settings, index method, and retrieval settings: +- **Chunk Settings**: General mode, maximum chunk length 1024 characters +- **Index Method**: High Quality (uses embedding model) +- **Retrieval Setting**: Vector Search + +Click "Save & Process" to start processing the document. + +### 3.7 Knowledge Base Processing + +The system starts processing the document and generating vector embeddings. + +### 3.8 Embedding Completed + +After processing is complete, the knowledge base is ready to use. + +## Step 4: Get Dify API Information + +### 4.1 Open Service API Panel + +Click the "Service API" button in the bottom right. Record the following information: +- **Service API Endpoint**: https://api.dify.ai/v1 +- **Dataset ID**: Get from the URL + +### 4.2 Get API Key + +Click the "API Key" button to view the API key. Record your API Key for use in subsequent configuration. + +## Step 5: Configure External Knowledge Base in LangBot + +### 5.1 Navigate to Knowledge Page + +In the LangBot WebUI, click "Knowledge" in the left navigation bar. + +### 5.2 Switch to External Knowledge Base Tab + +Click the "External" tab. + +### 5.3 Add External Knowledge Base + +Click the "+" button to open the add external knowledge base dialog. In this dialog, you need to: +1. **Knowledge Base Name**: Give the knowledge base a name +2. **Knowledge Base Description**: Add a description (optional) +3. **Retriever**: Select a knowledge retriever plugin + +**Note**: Using an external knowledge base requires installing the corresponding knowledge retriever plugin first. You can search for and install the Dify knowledge retriever plugin in the [plugin marketplace](https://space.langbot.app/market?category=KnowledgeRetriever). + +After installing the plugin, select the corresponding plugin from the Retriever dropdown, then fill in the configuration information obtained from Dify (API Endpoint, API Key, Dataset ID). + +## Step 6: Configure Pipeline + +After configuring the external knowledge base, you need to enable it in the pipeline: + +1. Navigate to the "Pipelines" page +2. Edit or create a new pipeline +3. On the "AI Capabilities" page, select "Built-in Agent" as the runner +4. In the knowledge base selection, check the external knowledge base you just configured +5. Save the pipeline configuration + +## Step 7: Test the Effect + +Test in the pipeline's "Conversation Testing" page, or bind the pipeline to a bot for actual conversation testing. When users ask questions, LangBot will automatically retrieve relevant content from the Dify knowledge base and generate answers combined with the retrieved knowledge. + +## Frequently Asked Questions + +### 1. How to Install Knowledge Retriever Plugins? + +Visit the [LangBot plugin marketplace](https://space.langbot.app/market), search for "Knowledge Retriever" or "Dify", find the corresponding plugin and click install. + +### 2. Which External Knowledge Retrieval Services Are Supported? + +LangBot currently supports multiple external knowledge retrieval services through the plugin system, including: +- Dify +- RAGFlow +- Other custom knowledge retrieval services + +Specific supported services can be viewed in the plugin marketplace. + +### 3. What's the Difference Between External and Built-in Knowledge Bases? + +- **Built-in Knowledge Base**: Data is stored locally in LangBot, with LangBot handling vectorization and retrieval +- **External Knowledge Base**: Data is stored in external services (like Dify), with retrieval performed through API calls + +The advantage of external knowledge bases is the ability to leverage the capabilities of professional LLMOps platforms, such as Dify's advanced document processing and multiple retrieval strategies. + +### 4. Can Multiple Knowledge Bases Be Used Simultaneously? + +Yes. In the pipeline configuration, you can check multiple knowledge bases (built-in or external) simultaneously, and LangBot will comprehensively utilize the content from these knowledge bases to generate answers. + +## Summary + +Through this tutorial, you learned how to: +1. Create a knowledge base and upload documents on the Dify platform +2. Obtain Dify API key and related configuration information +3. Configure a conversation model in LangBot +4. Add an external knowledge base in LangBot +5. Configure pipelines to use external knowledge bases + +The external knowledge base feature provides LangBot with more powerful and flexible knowledge management capabilities. Combined with professional LLMOps platforms like Dify, you can build more intelligent and professional conversational bots. + +## Related Resources + +- [LangBot Official Website](https://langbot.app) +- [LangBot Documentation](https://docs.langbot.app) +- [LangBot GitHub](https://github.com/langbot-app/LangBot) +- [Dify Official Website](https://dify.ai) +- [LangBot Plugin Marketplace](https://space.langbot.app/market) diff --git a/en/articles/index.mdx b/en/articles/index.mdx new file mode 100644 index 000000000..a06650975 --- /dev/null +++ b/en/articles/index.mdx @@ -0,0 +1,30 @@ +--- +title: "LangBot Articles" +description: "Product updates, engineering deep dives, tutorials, integrations, and announcements from the LangBot Blog." +--- + +Product updates, engineering deep dives, tutorials, integrations, and announcements from the LangBot Blog. + +## Product Updates + +- [The new LangBot Cloud is here — and multi-user Workspaces are now in open source](/en/articles/langbot-cloud-multi-user-workspaces) — 2026-08-25 + +## Engineering + +- [LangBot v4.10.0: Agentic Sandbox & Skills — Letting Your Agent Work Like a Developer](/en/articles/langbot-v4100-sandbox-skills) — 2026-06-04 +- [LangBot v4.9.0: Full RAG Plugin Architecture — Knowledge Without Borders](/en/articles/langbot-v490-rag-plugin-architecture) — 2026-03-10 +- [Deep Dive into the LangBot Plugin System: Process Isolation, Event-Driven Hooks, and Component Architecture](/en/articles/langbot-plugin-system-deep-dive) — 2026-02-23 + +## Tutorials & Integrations + +- [LangTARS: Open-Source AI Agent for Remote PC Control — Works with Dify, n8n & 10+ Messaging Platforms](/en/articles/langtars-remote-pc-control-dify-n8n) — 2026-03-23 +- [How to Connect DeepSeek R1 to WeChat, Discord & Telegram in 5 Minutes (FREE)](/en/articles/connect-deepseek-to-wechat) — 2026-02-21 +- [Deploy Your Own AI Bot to Discord, Telegram & WeChat in 5 Minutes](/en/articles/deploy-ai-bot-in-5-minutes) — 2026-02-17 +- [Finally Got My Dify Agent Working in Discord, Telegram and Slack](/en/articles/dify-agent-discord-telegram-slack) — 2025-12-11 +- [How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows](/en/articles/langflow-drag-and-drop-ai-bot) — 2025-12-05 +- [How I Built a Multi-Platform AI Chatbot with n8n and LangBot](/en/articles/n8n-multi-platform-ai-chatbot) — 2025-12-03 +- [LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations](/en/articles/dify-langbot-rag-knowledge-base) — 2025-12-02 + +## Announcements + +- [Introducing the LangBot Blog](/en/articles/welcome) — 2026-02-17 diff --git a/en/articles/langbot-cloud-multi-user-workspaces.mdx b/en/articles/langbot-cloud-multi-user-workspaces.mdx new file mode 100644 index 000000000..b7a0e2c1f --- /dev/null +++ b/en/articles/langbot-cloud-multi-user-workspaces.mdx @@ -0,0 +1,68 @@ +--- +title: "The new LangBot Cloud is here — and multi-user Workspaces are now in open source" +description: "LangBot is an open-source AI bot platform connecting LLMs with messaging apps. The new Cloud and open-source editions now support multi-user Workspaces, invitations, and role-based access." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langbot-cloud-multi-user-workspaces). + +Published 2026-08-25 · Author: LangBot Team + +![LangBot multi-user Workspace dashboard](/images/articles/source/images/cloud-multi-user/oss-dashboard.png) + +The new [LangBot Cloud](https://cloud.langbot.app) is live. This release tackles a practical question: when a team uses LangBot together, who can access which resources? + +The same multi-user foundation is now available in the open-source edition. Cloud and self-hosted LangBot still have different operating models, but they share the same basic approach to members, invitations, and permissions. + +## What is LangBot? + +LangBot is an open-source platform for building and operating AI bots across messaging apps. A single dashboard manages bots, message pipelines, knowledge bases, models, and extensions, then connects them to Discord, Telegram, Slack, LINE, QQ, WeChat, WeCom, Lark, DingTalk, and KOOK. LangBot also supports Satori and Matrix; Matrix bridges can extend a deployment to networks such as WhatsApp, Signal, Messenger, Mattermost, Google Chat, IRC, XMPP, and Zulip. + +The model layer is provider-neutral. LangBot connects to OpenAI, Anthropic Claude, DeepSeek, Google Gemini, xAI Grok, Moonshot Kimi, and Zhipu GLM, while Ollama and LM Studio cover local models. Gateway options include SiliconFlow, Aliyun Bailian, Volcengine Ark, ModelScope, and GiteeAI. Existing agent workflows can also be connected through Dify and MCP. + +A team can therefore run AI assistants on several messaging platforms from one place and choose a hosted model, a local model, or an existing agent workflow for each use case. + +![The new LangBot Cloud sign-in page](/images/articles/source/images/cloud-multi-user/cloud-login.png) + +## Cloud: start in your own Workspace + +LangBot Cloud now uses LangBot Account for sign-in. New users start with a personal Workspace and can accept invitations to join team Workspaces. If an account belongs to several Workspaces, the current one can be switched from the interface. + +Bots, pipelines, models, knowledge bases, and extensions belong to the active Workspace. Switching Workspaces does not mix one team's configuration or data with another's. + +Cloud continues to provide the hosting, updates, and runtime environment. It is the simpler option for teams that want to configure a bot without maintaining a server first. + +## Invite people instead of sharing an admin account + +An Owner, or another role with member-management permission, can send a one-time invitation. The recipient accepts it with their own account and enters the Workspace with the assigned role. + +![LangBot Cloud invitation page with the Workspace name anonymized](/images/articles/source/images/cloud-multi-user/cloud-invitation.png) + +That is a better long-term setup than sharing one administrator password: each person has an identity, and access can match the work they actually do. + +Five fixed roles are available today: + +- **Owner** — owns the Workspace and its highest-level membership controls. +- **Admin** — manages members and most Workspace settings. +- **Developer** — configures bots, pipelines, models, and extensions. +- **Operator** — handles day-to-day operations. +- **Viewer** — read-only access. + +## Open source: one instance, one Workspace, multiple users + +The self-hosted edition is not turning into a multi-Workspace SaaS. One LangBot instance still has one Workspace, but that Workspace can now include several users. + +The account created during initialization becomes the Owner. It can invite other people later. When SMTP is configured, LangBot can deliver the invitation by email; otherwise it shows a one-time link that can be shared through a trusted channel. + +Members still use the familiar LangBot dashboard. The difference is that resource access is checked against both the Workspace and the member's role, rather than treating every signed-in user as a full administrator. + +## Which edition should you use? + +| | LangBot Cloud | Open-source self-hosted | +|---|---|---| +| Deployment | Hosted and maintained by LangBot | You operate the server and data | +| Workspaces | Own or join multiple | One per instance | +| Members and invitations | Included | Included | +| Fixed role-based access | Included | Included | +| Best for | Getting a team running quickly | Private deployment and infrastructure control | + +To start with the hosted edition, visit [cloud.langbot.app](https://cloud.langbot.app). To keep the runtime and data on your own infrastructure, deploy LangBot from [GitHub](https://github.com/langbot-app/LangBot). diff --git a/en/articles/langbot-plugin-system-deep-dive.mdx b/en/articles/langbot-plugin-system-deep-dive.mdx new file mode 100644 index 000000000..55e51aaa6 --- /dev/null +++ b/en/articles/langbot-plugin-system-deep-dive.mdx @@ -0,0 +1,459 @@ +--- +title: "Deep Dive into the LangBot Plugin System: Process Isolation, Event-Driven Hooks, and Component Architecture" +description: "A source-level deep dive into LangBot 4.0's plugin architecture — process-isolated communication, event-driven hooks, a component-based extension model, and comparisons with Dify and MCP." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langbot-plugin-system-deep-dive). + +Published 2026-02-23 · Author: LangBot Team + +![LangBot Plugin System](/images/articles/source/images/covers/plugin-system.png) + +Most chatbot frameworks call their "plugin system" a glorified dynamic import of Python modules. LangBot 4.0 takes a harder but more principled approach — **every plugin runs in its own process**, communicating with the host through a structured JSON-RPC-style protocol. + +This article dissects the system from source code, end to end. + +## Overall Architecture: A Three-Layer Process Model + +LangBot's plugin system consists of three cooperating process layers: + +![LangBot Plugin System Architecture](/images/articles/source/images/plugin-system/architecture.png) + +**Each layer has a distinct responsibility:** + +1. **LangBot Main Process**: Runs business logic (message pipelines, platform adapters, model invocations), connects to Runtime via `PluginRuntimeConnector`. +2. **Plugin Runtime**: The orchestration layer — discovers, launches, and manages all plugin subprocesses, routes requests from the main process to the appropriate plugin. +3. **Plugin Subprocesses**: Each plugin runs in its own Python process, communicating with Runtime via stdio pipes. + +### Why Three Layers Instead of Two? + +The intuitive design would have the main process manage plugin processes directly. LangBot adds the Runtime layer for **deployment flexibility**: + +- **Local development**: Main process spawns Runtime as a child via stdio (zero config) +- **Docker production**: Runtime runs as a separate container, connected via WebSocket +- **Windows compatibility**: Since Windows asyncio has incomplete stdio subprocess support, it automatically falls back to WebSocket + +The same codebase — no config changes — adapts from development to production. + +## Communication Protocol: JSON-RPC-Style Request/Response + +All cross-process communication runs on a unified protocol layer. The core data structures are minimal: + +```python +# Request +class ActionRequest(pydantic.BaseModel): + seq_id: int # Sequence number for matching request/response + action: str # Action name + data: dict # Payload + +# Response +class ActionResponse(pydantic.BaseModel): + seq_id: int + code: int # 0 = success + message: str + data: dict + chunk_status: str # "continue" | "end" (streaming support) +``` + +The `Handler` class is the system's core abstraction, acting as both RPC client and server: + +```python +class Handler: + async def call_action(self, action, data, timeout=15.0) -> dict: + """Actively call an action provided by the peer, wait for response""" + self.seq_id_index += 1 + request = ActionRequest.make_request(self.seq_id_index, action.value, data) + future = asyncio.Future() + self.resp_waiters[self.seq_id_index] = future + await self.conn.send(json.dumps(request.model_dump())) + response = await asyncio.wait_for(future, timeout) + return response.data + + @action(SomeAction.DO_SOMETHING) + async def handle_something(data: dict) -> ActionResponse: + """Register an action for the peer to call""" + return ActionResponse.success({"result": "ok"}) +``` + +**Key design points:** + +- `seq_id`-based request/response matching enables full-duplex concurrent calls +- Streaming responses via `chunk_status` for long-running operations like command execution +- Large messages auto-chunk (stdio: 16KB / WebSocket: 64KB per chunk) +- File transfer uses a separate base64 chunking mechanism + +### Action Enums: Clear API Contracts + +The system defines all cross-process calls through four enum groups: + +```python +# Plugin → Runtime (plugin-initiated requests) +class PluginToRuntimeAction: + REGISTER_PLUGIN = "register_plugin" + SEND_MESSAGE = "send_message" # Send message to a platform + INVOKE_LLM = "invoke_llm" # Call an LLM + SET_PLUGIN_STORAGE = "set_plugin_storage" # Persistent storage + # ... + +# Runtime → Plugin (runtime-dispatched commands) +class RuntimeToPluginAction: + INITIALIZE_PLUGIN = "initialize_plugin" + EMIT_EVENT = "emit_event" + CALL_TOOL = "call_tool" + EXECUTE_COMMAND = "execute_command" + SHUTDOWN = "shutdown" + # ... + +# LangBot Main → Runtime +class LangBotToRuntimeAction: + INSTALL_PLUGIN = "install_plugin" + EMIT_EVENT = "emit_event" + LIST_TOOLS = "list_tools" + # ... + +# Runtime → LangBot Main +class RuntimeToLangBotAction: + GET_PLUGIN_SETTINGS = "get_plugin_settings" + SET_BINARY_STORAGE = "set_binary_storage" + # ... +``` + +This makes API boundaries crystal clear — what a plugin can and cannot do is defined entirely by these enums. + +## Plugin Lifecycle + +A plugin goes through these stages from installation to execution: + +### 1. Discovery + +On startup, Runtime scans the `data/plugins/` directory: + +```python +async def launch_all_plugins(self): + for plugin_path in glob.glob("data/plugins/*"): + if not os.path.isdir(plugin_path): + continue + task = self.launch_plugin(plugin_path) + self.plugin_run_tasks.append(task) +``` + +Directory names follow the `{author}__{name}` convention, each containing a `manifest.yaml` and plugin code. + +### 2. Launch + +Runtime spawns an independent subprocess for each plugin: + +```python +async def launch_plugin(self, plugin_path: str): + python_path = sys.executable + args = ["-m", "langbot_plugin.cli.__init__", "run", "-s", "--prod"] + + ctrl = StdioClientController( + command=python_path, + args=args, + working_dir=plugin_path, # Each plugin runs in its own directory + ) + await ctrl.run(new_plugin_connection_callback) +``` + +**Key detail**: The subprocess working directory is set to the plugin's own directory — natural filesystem isolation. + +### 3. Registration + +After starting, the plugin process actively registers itself with Runtime: + +```python +# Runtime-side registration handler +async def register_plugin(self, handler, container_data, debug_plugin=False): + plugin_container = PluginContainer.from_dict(container_data) + # Fetch plugin settings from the main process + plugin_settings = await self.context.control_handler.call_action( + RuntimeToLangBotAction.GET_PLUGIN_SETTINGS, {...} + ) + # Initialize the plugin (send config) + await handler.initialize_plugin(plugin_settings) + # Store the plugin container + self.plugins.append(plugin_container) +``` + +### 4. Running + +Once in `INITIALIZED` state, the plugin can receive events, tool calls, and command executions. + +### 5. Shutdown + +```python +async def shutdown_plugin(self, plugin_container): + # 1. Notify the plugin to shut down gracefully + await plugin_container._runtime_plugin_handler.shutdown_plugin() + # 2. Close the communication connection + await plugin_container._runtime_plugin_handler.conn.close() + # 3. Kill the subprocess + if handler.stdio_process is not None: + handler.stdio_process.kill() + await asyncio.wait_for(handler.stdio_process.wait(), timeout=2) +``` + +## Component System: Four Extension Types + +A LangBot plugin isn't a single hook function — it's a **component container**. A single plugin can provide multiple component types simultaneously: + +### EventListener + +The most fundamental extension — listen for events in the message pipeline: + +```python +from langbot_plugin.api.definition.components.common.event_listener import EventListener +from langbot_plugin.api.entities.events import PersonNormalMessageReceived +from langbot_plugin.api.entities.context import EventContext + +class MyListener(EventListener): + @EventListener.handler(PersonNormalMessageReceived) + async def on_person_message(self, ctx: EventContext): + event = ctx.event + # Modify the user message before it reaches the LLM + event.user_message_alter = "Answer in poetry: " + event.text_message + + # Or block further processing + # ctx.prevent_default() + # ctx.prevent_postorder() +``` + +Supported events cover the full message lifecycle: + +| Event | Trigger | +|-------|---------| +| `PersonMessageReceived` | Any private message received | +| `GroupMessageReceived` | Any group message received | +| `PersonNormalMessageReceived` | Private message deemed processable | +| `GroupNormalMessageReceived` | Group message deemed processable | +| `NormalMessageResponded` | LLM response completed | +| `PromptPreProcessing` | Prompt preprocessing stage | + +Event propagation supports two interruption modes: +- `prevent_default()`: Skip default behavior (e.g., skip the LLM call) +- `prevent_postorder()`: Stop subsequent plugins from running + +### Tool + +Tools for LLM Function Calling: + +```python +from langbot_plugin.api.definition.components.tool.tool import Tool + +class WeatherTool(Tool): + async def call(self, params: dict, session, query_id: int) -> str: + city = params.get("city", "Beijing") + # Call weather API... + return f"{city}: Sunny, 25°C" +``` + +Tool metadata (name, description, parameter schema) is defined in a companion YAML manifest file. LangBot automatically converts this into the Function definition that LLMs understand. + +### Command + +User-triggered commands via `!command`, with subcommand support: + +```python +from langbot_plugin.api.definition.components.command.command import Command + +class MyCommand(Command): + def __init__(self): + super().__init__() + + @self.subcommand("hello", help="Say hello") + async def hello(self, ctx): + yield CommandReturn(text="Hello from plugin!") + + @self.subcommand("status", help="Show status") + async def status(self, ctx): + yield CommandReturn(text="All systems operational.") +``` + +Command results are returned via `AsyncGenerator`, providing natural streaming output. + +### KnowledgeRetriever + +A multi-instance component for connecting external knowledge bases: + +```python +from langbot_plugin.api.definition.components.knowledge_retriever.retriever import KnowledgeRetriever + +class MyRetriever(KnowledgeRetriever): + async def retrieve(self, context) -> list: + results = await self.search_external_db(context.query) + return [RetrievalResultEntry(content=r) for r in results] +``` + +KnowledgeRetriever is a **polymorphic component** — a single retriever class can spawn multiple instances, each with independent configuration. This allows users to connect multiple different external knowledge bases. + +## SDK API: What Plugins Can Do + +Plugins gain rich capabilities through the `LangBotAPIProxy` inherited by `BasePlugin`: + +```python +class LangBotAPIProxy: + # Message operations + async def send_message(self, bot_uuid, target_type, target_id, message_chain) + + # Model invocation + async def get_llm_models(self) -> list[str] + async def invoke_llm(self, model_uuid, messages, funcs=[], extra_args={}) + + # Persistent storage (plugin-level isolation) + async def set_plugin_storage(self, key, value: bytes) + async def get_plugin_storage(self, key) -> bytes + + # Workspace storage (cross-plugin shared) + async def set_workspace_storage(self, key, value: bytes) + async def get_workspace_storage(self, key) -> bytes + + # System info + async def get_langbot_version(self) -> str + async def get_bots(self) -> list[str] + async def list_plugins_manifest(self) -> list +``` + +**The storage API design is worth noting**: Two levels of KV storage — `plugin_storage` (plugin-private) and `workspace_storage` (globally shared), storing data as bytes (base64-serialized in transit). Simple but flexible enough. + +## Event Dispatch Mechanism + +The complete path from main process to plugin: + +![Event Dispatch Flow](/images/articles/source/images/plugin-system/event-dispatch.png) + +Key source code: + +```python +async def emit_event(self, event_context, include_plugins=None): + for plugin in self.plugins: + if plugin.status != RuntimeContainerStatus.INITIALIZED: + continue + if not plugin.enabled: + continue + + # Pipeline-level plugin filtering + if include_plugins is not None: + plugin_id = f"{plugin.manifest.metadata.author}/{plugin.manifest.metadata.name}" + if plugin_id not in include_plugins: + continue + + resp = await plugin._runtime_plugin_handler.emit_event( + event_context.model_dump() + ) + + event_context = EventContext.model_validate(resp["event_context"]) + + # Plugin requested propagation stop + if event_context.is_prevented_postorder(): + break + + return emitted_plugins, event_context +``` + +The `include_plugins` parameter enables **pipeline-level plugin binding** — different message processing pipelines can use different subsets of plugins. + +## Installation & Distribution + +Plugins support three installation sources: + +1. **Local upload**: `.lbpkg` files (actually zip archives containing manifest.yaml and code) +2. **Marketplace**: Install from LangBot Space online +3. **GitHub Release**: Download from a GitHub repository's Release assets + +The installation flow: + +```python +async def install_plugin(self, source, install_info): + yield {"current_action": "downloading plugin package"} + # 1. Fetch and extract the plugin package (unzip) + plugin_path, author, name, version = await self.install_plugin_from_file(plugin_file) + + yield {"current_action": "installing dependencies"} + # 2. Install dependencies (pip install -r requirements.txt) + pkgmgr_helper.install_requirements(requirements_file) + + yield {"current_action": "initializing plugin settings"} + # 3. Initialize configuration + await self.context.control_handler.call_action( + RuntimeToLangBotAction.INITIALIZE_PLUGIN_SETTINGS, {...} + ) + + yield {"current_action": "launching plugin"} + # 4. Launch the plugin process + task = self.launch_plugin(plugin_path) +``` + +The entire process reports progress via `AsyncGenerator`, enabling real-time installation status in the frontend. + +## Developer Experience + +The SDK provides a complete developer toolchain: + +```bash +# Initialize a new plugin +lbp init + +# Add a component +lbp component add + +# Run locally for debugging +lbp run + +# Package for publication +lbp publish +``` + +**Debug mode** has a particularly clever design: the developer's plugin connects to the running Runtime via WebSocket (instead of stdio), meaning you can hot-reload plugin code without restarting LangBot. Debug plugins are specially marked in the UI and protected from accidental deletion. + +## Comparisons with Other Systems + +### vs Dify Plugins + +Dify's plugin system (`dify-plugin-daemon`) shares the process isolation philosophy with LangBot, but the focus differs: + +- **Dify**: Plugins extend workflow node types (Tool, Model, Extension) — designed for AI application orchestration +- **LangBot**: Plugins extend the message processing pipeline (Event, Tool, Command, KnowledgeRetriever) — designed for instant messaging scenarios + +LangBot's `EventListener` component provides a capability Dify lacks — injecting logic at any stage of message processing. + +### vs MCP (Model Context Protocol) + +MCP is a standardized protocol for AI tool invocation. LangBot's Tool component and MCP services overlap functionally, but serve different purposes: + +- **MCP**: A universal "AI calls external capabilities" protocol, usable by any LLM application +- **LangBot Tool**: Deeply integrated with message processing context, with access to session info, user identity, etc. + +In practice, LangBot natively supports MCP — users can configure MCP servers directly in LangBot without writing plugins. LangBot's Tool component is for scenarios requiring access to LangBot's internal context. + +## Design Decisions Explained + +**Why process isolation instead of threads/coroutines?** + +- Plugin code quality is unpredictable; a segfault shouldn't crash the entire service +- Dependency isolation: different plugins may depend on different versions of the same library +- Resource control: you can set per-plugin process resource limits + +**Why JSON instead of Protobuf/MessagePack?** + +- Debug-friendly: developers can directly read communication logs +- Natively supported in Python, no extra dependencies +- The performance bottleneck isn't serialization (plugin call frequency is far below database queries) + +**Why stdio over WebSocket by default?** + +- stdio requires no network stack — lower latency +- Simpler process lifecycle management (child processes auto-cleanup when parent exits) +- WebSocket is only used where stdio isn't supported (Docker, Windows) + +## Conclusion + +LangBot's plugin system is a **production-grade, process-isolated, event-driven component framework for extensibility**. + +Its core design principles: +1. **Safety first**: Process isolation ensures plugins can't destabilize the main service +2. **Deployment flexibility**: Dual stdio/WebSocket modes adapt to all environments +3. **Developer-friendly**: Complete SDK, CLI, and debug support +4. **Component-based**: Four component types cover the major extension needs + +If you're interested in developing LangBot plugins, start with the [plugin development docs](https://docs.langbot.app/en/plugin/dev/tutor), or browse existing plugins on the [marketplace](https://space.langbot.app/market) for inspiration. diff --git a/en/articles/langbot-v4100-sandbox-skills.mdx b/en/articles/langbot-v4100-sandbox-skills.mdx new file mode 100644 index 000000000..3ed149bf3 --- /dev/null +++ b/en/articles/langbot-v4100-sandbox-skills.mdx @@ -0,0 +1,113 @@ +--- +title: "LangBot v4.10.0: Agentic Sandbox & Skills — Letting Your Agent Work Like a Developer" +description: "LangBot v4.10.0 brings a real sandbox (Box Runtime) and an on-demand Skills system to the built-in Agent. It can now run commands and edit files in an isolated environment, and pull in specialized know-how exactly when a task needs it." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langbot-v4100-sandbox-skills). + +Published 2026-06-04 · Author: LangBot Team + +![LangBot v4.10.0 Agentic Sandbox & Skills](/images/articles/source/images/covers/sandbox-skills.png) + +LangBot v4.10.0 is our biggest Agent update yet. It ships two features that point in the same direction — **letting the built-in Agent work like a real developer**: + +1. **Sandbox**: the Agent now runs in a genuinely isolated environment where it can execute commands and work with files. +2. **Skills**: the Agent can load specialized know-how on demand, instead of cramming everything into its context. + +Both capabilities were led by community contributor [@huanghuoguoguo](https://github.com/huanghuoguoguo). Let's dig in. + +> **New to LangBot?** [LangBot](https://github.com/langbot-app/LangBot) is an open-source LLM bot platform (15k+ GitHub stars) that lets you deploy AI chatbots across **Discord, Telegram, WeChat (个人微信 / 企业微信), Slack, Lark (Feishu), DingTalk, QQ** and more — all from a single instance. It connects 20+ large language models (OpenAI GPT, Anthropic Claude, Google Gemini, DeepSeek, and others) to 13+ messaging platforms, with built-in Agent, RAG knowledge bases, MCP support, and a plugin ecosystem. You can self-host it with one Docker command or run it managed on [LangBot Cloud](https://space.langbot.app/cloud). + +## 📦 Sandbox: a real workspace for your Agent + +Until now, LangBot's built-in Agent could only call predefined tools. It couldn't "open a terminal and run a command," nor "write an intermediate result to a file and read it back later" — which is exactly what human developers do all day. + +v4.10.0 introduces the new **Box Runtime**. It gives the Agent an isolated sandbox environment with six native tools built in: + +| Tool | Purpose | +|------|---------| +| `exec` | Run shell commands | +| `read` | Read file contents | +| `write` | Write files | +| `edit` | Make targeted edits to files | +| `glob` | Find files by pattern | +| `grep` | Search inside file contents | + +With this toolkit, the Agent can work like a developer: run a script, save the output to a file, read it back to analyze, and post-process the result. All of it happens inside an isolated environment that never touches the host. + +![LangBot sandbox in action](/images/articles/source/images/sandbox-skills/sandbox.png) + +### Pluggable backends + +The sandbox's execution backend is **pluggable**, and LangBot selects one automatically based on your deployment: + +- **Docker**: spins up a dedicated `langbot_box` container that talks to the main process over WebSocket. Great for containerized deployments. +- **nsjail**: lightweight isolation based on Linux namespaces, no extra container needed. Great for bare-metal or single-container setups. +- **E2B**: cloud sandbox that runs execution in a remote isolated environment. + +You don't have to pick manually — `box.enabled` is the master switch. Once on, LangBot probes for the most suitable backend and degrades gracefully if probing fails. + +![Sandbox native tools](/images/articles/source/images/sandbox-skills/sandbox-tools.png) + +### It also hosts MCP Servers + +Beyond native tools, the Box Runtime takes on another important job: **hosting stdio-mode MCP Servers**. + +Previously, stdio-mode MCP Servers had to be spawned as subprocesses directly inside the main process — neither safe nor easy to manage. Now they all run inside the sandbox, sharing the same isolation boundary as the Agent's execution environment. `http` / `sse` mode MCP is unaffected and works as before. + +## 🎯 Skills: know-how, loaded on demand + +The second big update is **Skills**. + +As the Agent's capabilities grow, an old problem surfaces: **the context window is finite**. If you stuff every possible instruction, procedure, and reference doc into the system prompt, the context fills up fast — and most of it is irrelevant to the task at hand. + +The design idea behind Skills is simple: **keep the table of contents in view, and open the book only when you need it.** + +A Skill is an **on-demand instruction pack** containing: + +- **A prompt**: tells the Agent what the skill does and when to use it +- **A procedure**: the steps to accomplish a class of tasks +- **Scripts**: ready-to-run helper scripts +- **Reference files**: API docs, templates, examples, and so on + +By default the Agent only sees a **list of available skills** (name + summary), which costs almost nothing in context. When it decides a task needs a particular skill, it pulls the full content just in time via the `activate` action. + +![LangBot Skills system](/images/articles/source/images/sandbox-skills/skills.png) + +The benefits are clear: + +1. **Lean context**: irrelevant skill content never takes up the window. +2. **Extensible capabilities**: want to teach the Agent a new trick? Write a skill pack — no core code changes. +3. **Instant effect**: skills load dynamically during execution, no restart required. + +If you've used Claude's Skills or a similar mechanism, this pattern will feel familiar — it decouples "what the Agent knows" from "what the Agent needs right now." + +## 🧩 Shipped early across 4.9.x + +These were planned for v4.10.0 but shipped early in the 4.9.x line: + +- **Plugin Extension Pages**: plugins can render custom UI via iframe + a Page SDK ([@TyperBody](https://github.com/TyperBody), #2107) +- **Monitoring**: feedback linked to message IDs, plus feedback export ([@6mvp6](https://github.com/6mvp6), #2120) +- **Security hardening**: path-traversal fixes and removal of an authenticated RCE endpoint ([@sebastiondev](https://github.com/sebastiondev), #2087 / #2178) + +## 🚀 Getting started + +The sandbox needs an execution backend, depending on how you deploy: + +- **Docker**: run `docker compose --profile all up`, which also launches the `langbot_box` container. +- **Manual / `uvx`**: runs as a stdio subprocess automatically, nothing to do. +- **LangBot Cloud**: ready out of the box — the sandbox is already set up for you, nothing to install. + +To turn the sandbox off, set `box.enabled: false` — built-in tools, Skill create/edit, and stdio-mode MCP are all disabled; `http` / `sse` mode MCP is unaffected. See the [Sandbox docs](https://docs.langbot.app/en/usage/sandbox/readme) for details. + +This release also upgrades the plugin SDK to **`langbot-plugin 0.4.1`**. + +## Closing thoughts + +Sandbox and Skills are, at their core, answering the same question: **how do we let an Agent handle genuinely complex, open-ended tasks?** + +The sandbox solves the "**hands**" problem — giving the Agent the ability to execute and room to experiment. Skills solve the "**brain**" problem — letting the Agent reach for the right knowledge at the right moment, without drowning in irrelevant information. + +The fastest way to try it is to spin up a managed instance on [LangBot Cloud](https://space.langbot.app/cloud), where the sandbox is ready to go. You can also read the [full release notes](https://github.com/langbot-app/LangBot/releases/tag/v4.10.0) for every change. + +Thank you to everyone building with LangBot. We'll keep making the cloud Agent experience more stable and more capable. diff --git a/en/articles/langbot-v490-rag-plugin-architecture.mdx b/en/articles/langbot-v490-rag-plugin-architecture.mdx new file mode 100644 index 000000000..b565e7339 --- /dev/null +++ b/en/articles/langbot-v490-rag-plugin-architecture.mdx @@ -0,0 +1,293 @@ +--- +title: "LangBot v4.9.0: Full RAG Plugin Architecture — Knowledge Without Borders" +description: "LangBot v4.9.0 refactors the entire knowledge base system from a built-in implementation to a plugin-driven architecture, introducing KnowledgeEngine and Parser component types for boundless extensibility." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langbot-v490-rag-plugin-architecture). + +Published 2026-03-10 · Author: LangBot Team + +![LangBot v4.9.0 RAG Plugin Architecture](/images/articles/source/images/covers/rag-plugin.png) + +LangBot v4.9.0, codenamed **"Knowledge Without Borders,"** does exactly what the name says: **the entire knowledge base capability has been refactored from a built-in implementation to a plugin-driven architecture.** + +This isn't a minor tweak — it redefines what "knowledge" means in LangBot. + +## The Problem with the Old Approach + +Before v4.9.0, LangBot's knowledge base was split into two separate systems: + +- **Built-in Knowledge Base**: Used Chroma as the vector database, with embedding models managed by LangBot directly. Document parsing, chunking, and indexing were all hardcoded. +- **External Knowledge Base**: Bridged services like Dify, RAGFlow, and FastGPT through the `KnowledgeRetriever` plugin component — retrieval only, no document ingestion. + +These two systems lived behind separate UI tabs, with completely different data models and management flows. + +**Why this was painful:** + +1. **Poor extensibility**: Want a different vector database? A custom chunking strategy? Sorry, that's hardcoded. +2. **High maintenance cost**: Every RAG improvement required changes to LangBot's core code and a new release. +3. **Fragmented UX**: Two completely different knowledge base management flows meant a steep learning curve. + +v4.9.0 solves this decisively: **extract RAG capabilities from LangBot's core and hand them to plugins.** + +## What Changed + +### 1. Unified Knowledge Base Model + +The `internal` / `external` distinction is gone. All knowledge bases are managed through a single interface, differentiated only by their `rag_engine_plugin_id`. One list, one creation flow — just pick your engine. + +### 2. KnowledgeEngine Component + +This is the headline addition. `KnowledgeEngine` replaces the old `KnowledgeRetriever` and takes ownership of the full knowledge base lifecycle: + +- **Document Ingestion**: The complete pipeline from file parsing to vector indexing +- **Knowledge Retrieval**: Returning relevant chunks at query time +- **Document Deletion**: Cleaning up documents and their associated vector data +- **Lifecycle Hooks**: Callbacks when knowledge bases are created or deleted + +A KnowledgeEngine plugin has full control over indexing and retrieval strategies — not just retrieval. + +![Knowledge Engine plugins in the Marketplace](/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png) + +### 3. Parser Component + +Document parsing has been extracted into its own plugin component type. A Parser converts binary files (PDF, Word, Markdown, etc.) into structured text, which is then handed to the RAG engine for chunking and indexing. + +**The data flow:** + +![Data flow: Parser → KnowledgeEngine](/images/articles/source/images/rag-plugin/data-flow.png) + +If a RAG engine declares `DOC_PARSING` capability, it can handle parsing internally and skip the external Parser. + +### 4. Host RAG API + +LangBot's core no longer executes RAG operations directly, but it still provides essential infrastructure through `RAGRuntimeService`, accessible to plugins via RPC: + +- **Embedding invocation**: `invoke_embedding()` — plugins don't need to manage model connections +- **Vector database operations**: `vector_upsert()` / `vector_search()` / `vector_delete()` +- **File access**: `get_knowledge_file_stream()` — read raw files from storage + +This means plugins can focus on RAG strategy (chunking algorithms, retrieval logic, re-ranking) while the host handles the "heavy" operations like vector storage and embedding models. + +### 5. KnowledgeRetriever Deprecated + +The old `KnowledgeRetriever` component has been removed. If you had external knowledge base plugins, they'll need to migrate to `KnowledgeEngine`. The good news: the new API is cleaner and migration is straightforward. + +## Building a RAG Engine Plugin + +### Scaffold the Component + +```bash +lbp comp KnowledgeEngine +``` + +This generates the directory structure: + +![Plugin directory structure](/images/articles/source/images/rag-plugin/dir-structure.png) + +### Define Configuration Schemas + +The YAML manifest defines two configuration schemas: + +- **`creation_schema`**: Parameters filled when creating a knowledge base (e.g., chunk size, embedding model) +- **`retrieval_schema`**: Parameters adjustable at retrieval time (e.g., score threshold, top-K) + +```yaml +spec: + creation_schema: + - name: chunk_size + label: + en_US: Chunk Size + type: integer + default: 500 + - name: chunk_overlap + label: + en_US: Chunk Overlap + type: integer + default: 50 + retrieval_schema: + - name: score_threshold + label: + en_US: Score Threshold + type: float + default: 0.5 +``` + +LangBot **dynamically renders** creation and retrieval forms based on these schemas — different engines show different configuration fields. + +### Declare Capabilities + +```python +class SimpleRag(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [ + KnowledgeEngineCapability.DOC_INGESTION, # Supports document upload + # KnowledgeEngineCapability.DOC_PARSING, # Optional: built-in parsing + ] +``` + +| Capability | Description | +|------------|-------------| +| `DOC_INGESTION` | Supports document upload and processing. UI shows "Documents" tab | +| `DOC_PARSING` | Supports built-in document parsing. Without this, an external Parser plugin is required | + +### Implement Core Methods + +The three essential methods: + +**Document Ingestion:** + +```python +async def ingest(self, context: IngestionContext) -> IngestionResult: + # 1. Get file content (or use Parser's pre-parsed result) + if context.parsed_content: + text = context.parsed_content.text + else: + file_bytes = await self.plugin.get_knowledge_file_stream( + context.file_object.storage_path + ) + text = file_bytes.decode('utf-8') + + # 2. Chunk the text + chunks = self._split_text(text, chunk_size=500) + + # 3. Call host embedding model + vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, chunks + ) + + # 4. Write to host vector database + await self.plugin.vector_upsert( + collection_id, vectors, ids, metadata + ) + + return IngestionResult( + document_id=context.file_object.metadata.document_id, + status=DocumentStatus.COMPLETED, + chunks_created=len(chunks), + ) +``` + +**Knowledge Retrieval:** + +```python +async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # 1. Generate query vector + query_vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, [context.query] + ) + + # 2. Vector search + results = await self.plugin.vector_search( + collection_id, query_vectors[0], top_k=5 + ) + + # 3. Convert and return + return RetrievalResponse(results=entries, total_found=len(entries)) +``` + +**Document Deletion:** + +```python +async def delete_document(self, kb_id: str, document_id: str) -> bool: + deleted = await self.plugin.vector_delete( + collection_id=kb_id, file_ids=[document_id] + ) + return deleted > 0 +``` + +### Bridging External Services + +If your goal is to bridge Dify, RAGFlow, FastGPT, or other external services rather than building a custom RAG pipeline, the implementation is even simpler — **don't declare `DOC_INGESTION` capability** and only implement `retrieve`: + +```python +class DifyRAGEngine(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [] # No document upload — managed externally + + async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # Call Dify/RAGFlow/FastGPT retrieval API + ... +``` + +The knowledge base won't show a "Documents" tab — all content management happens in the external service. + +## Building a Parser Plugin + +Parser development is even more concise: + +```bash +lbp comp Parser +``` + +Declare supported MIME types in the manifest: + +```yaml +spec: + supported_mime_types: + - application/pdf + - application/vnd.openxmlformats-officedocument.wordprocessingml.document +``` + +Implement the `parse` method: + +```python +class PdfParser(Parser): + + async def parse(self, context: ParseContext) -> ParseResult: + # context.file_content: raw file bytes + # context.mime_type: detected MIME type + # context.filename: original filename + + text = extract_text_from_pdf(context.file_content) + + return ParseResult( + text=text, + sections=[ + TextSection(content=page_text, heading=f"Page {i}", page=i) + for i, page_text in enumerate(pages) + ], + ) +``` + +Parsers also support **cross-plugin invocation** — a RAG engine plugin can call another plugin's Parser: + +```python +result = await self.plugin.invoke_parser( + plugin_author="author_name", + plugin_name="plugin_name", + storage_path=context.file_object.storage_path, + mime_type=context.file_object.metadata.mime_type, + filename=context.file_object.metadata.filename, +) +``` + +## Upgrade Notes + +- Knowledge bases created in previous versions are **automatically migrated**. After updating, visit the Knowledge Base page to verify. +- The `KnowledgeRetriever` component is deprecated. Existing plugins need to migrate to `KnowledgeEngine`. +- Browse the [Plugin Marketplace](https://space.langbot.app/market?category=KnowledgeEngine) for available RAG engine plugins. + +## The Bigger Picture + +v4.9.0's knowledge base refactoring is the latest step in LangBot's plugin-first evolution. From event handlers and tools in v4.0, to knowledge retrievers, to now full RAG engines and parsers — LangBot's core capabilities are progressively moving from "built-in" to "pluggable." + +The endgame: **LangBot's core provides pipeline orchestration and infrastructure; all business capabilities are plugin-driven.** + +Custom chunking strategy? Write a KnowledgeEngine plugin. PDF parsing? Write a Parser plugin. Bridge your company's internal knowledge service? Also a plugin. + +Knowledge, without borders. + +--- + +**Links:** + +- [v4.9.0 Release Notes](https://github.com/langbot-app/LangBot/releases/tag/v4.9.0) +- [KnowledgeEngine Development Guide](https://docs.langbot.app/en/plugin/dev/components/knowledge-engine) +- [Parser Development Guide](https://docs.langbot.app/en/plugin/dev/components/parser) +- [Plugin Marketplace](https://space.langbot.app/market) +- [LangBot Cloud](https://space.langbot.app/cloud) diff --git a/en/articles/langflow-drag-and-drop-ai-bot.mdx b/en/articles/langflow-drag-and-drop-ai-bot.mdx new file mode 100644 index 000000000..d06cad2bb --- /dev/null +++ b/en/articles/langflow-drag-and-drop-ai-bot.mdx @@ -0,0 +1,207 @@ +--- +title: "How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows" +description: "How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows" +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langflow-drag-and-drop-ai-bot). + +Published 2025-12-05 · Author: LangBot Team + +![How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows](/images/articles/source/images/covers/langflow.png) + +Drive chatbots across QQ, WeChat, Telegram, Discord, and more using visual workflows - no coding required. + +--- + +[LangBot](https://github.com/langbot-app/LangBot) is an open-source instant messaging bot platform that connects AI workflow engines like Langflow, n8n, Dify, FastGPT, and Coze to platforms including WeChat, QQ, Feishu, DingTalk, Telegram, Discord, Slack, and LINE. This tutorial demonstrates how to use Langflow's visual workflows as LangBot's conversation engine. + +## Why This Approach Works + +- **True Multi-Platform**: One workflow powering 8+ messaging platforms simultaneously +- **Visual Orchestration**: Drag-and-drop conversation design with conditional branches, multi-turn dialogs, and external API calls +- **Flexible AI Models**: Support for OpenAI, Claude, Gemini, DeepSeek, and local models +- **Fully Open Source**: Both LangBot and Langflow are open-source projects for free deployment and customization + +## Prerequisites + +- Python 3.10+ +- Docker (recommended for quick deployment) +- OpenAI API Key or API keys for other LLM services + +## Step 1: Deploy LangBot + +Launch with uvx in one command: + +```bash +uvx langbot +``` + +First run auto-initializes and opens your browser to http://127.0.0.1:5300. + +![LangBot Initial Page](/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png) + +After registration, log in to access the dashboard: + +![LangBot Dashboard](/images/articles/external/b93d97b5b830-04-langbot-dashboard.png) + +## Step 2: Deploy Langflow + +Deploy quickly with Docker: + +```bash +docker run -d --name langflow -p 7860:7860 langflowai/langflow:latest +``` + +Visit http://localhost:7860 to access Langflow: + +![Langflow Welcome Page](/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png) + +## Step 3: Create a Langflow Workflow + +In Langflow, select the "Basic Prompting" template to get started quickly: + +![Langflow Template Selection](/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png) + +This template includes four basic components: +- **Chat Input**: Receives user messages +- **Prompt**: Sets system instructions +- **Language Model**: Calls LLM to generate responses +- **Chat Output**: Returns results + +![Langflow Workflow Editor](/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png) + +### Configure Language Model + +Click the Language Model component and configure: + +1. **Model Provider**: Select OpenAI (or other compatible providers like SiliconFlow, New API) +2. **Model Name**: Select gpt-4o-mini or deepseek-chat +3. **OpenAI API Key**: Enter your API Key + +![Langflow OpenAI API Key Configured](/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png) + +> Tip: You can use OpenAI-compatible API services like SiliconFlow or New API by simply modifying the Base URL. + +Save the workflow after configuration. + +## Step 4: Get Langflow API Information + +### Generate API Key + +In Langflow's upper right: Settings → API Keys, navigate to the API Keys page: + +![Langflow API Keys Page](/images/articles/external/21fc47358066-05-langflow-api-keys-page.png) + +Click Create New Key: + +![Langflow Create API Key Dialog](/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png) + +Generate and save the API Key: + +![Langflow API Key Generated](/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png) + +Format: `sk-xxxxxxxxxxxxxxxxxxxxxxxx` + +### Get Flow ID + +Extract from the flow editor's URL: + +``` +http://localhost:7860/flow/{flow-id} +``` + +Record this `flow-id`. + +## Step 5: Configure Langflow in LangBot + +Return to LangBot dashboard and go to **Pipelines** page. + +Click ChatPipeline to edit, in the AI tab: + +![LangBot Pipeline AI Tab](/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png) + +Configure **Runner**, select **Langflow API**: + +![LangBot Runner Dropdown](/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png) + +Fill in the Langflow configuration: + +![LangBot Langflow Config Form](/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png) + +Configuration items: +- **Base URL**: `http://localhost:7860` (local) or `http://langflow:7860` (Docker network) +- **API Key**: The API Key generated in Langflow +- **Flow ID**: The Flow ID recorded earlier + +![LangBot Langflow Config Filled](/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png) + +> Docker Tip: If both services run in containers, ensure they're on the same network and use the container name for Base URL. + +Click **Save** to save the configuration. + +## Step 6: Test the Conversation + +Click **Debug Chat** on the Pipelines page to open the debug chat interface: + +![LangBot Debug Chat Interface](/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png) + +Enter a test message like "Hello" and view the AI response: + +![LangBot Chat Test Success](/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png) + +## How It Works + +1. User sends a message on a messaging platform +2. LangBot receives and passes it to the Pipeline +3. Pipeline calls Langflow API +4. Langflow executes the workflow: receives input → adds prompt → calls LLM → returns result +5. LangBot sends the response back to the user + +## Common Issues + +**Cannot connect to Langflow?** + +Check Base URL. For Docker deployment, ensure containers are on the same network: + +```bash +docker network create langbot_network +docker network connect langbot_network langflow +docker network connect langbot_network langbot +``` + +Use container name: `http://langflow:7860` + +**API call fails?** + +- Confirm API Key and Flow ID are correct +- Verify the Language Model in Langflow has a valid LLM API Key configured + +## Advanced Use Cases + +Langflow's power lies in visually orchestrating complex AI workflows: + +- **Multi-Turn Memory**: Add Memory components for contextual understanding +- **Conditional Branches**: Execute different logic based on user input +- **External API Integration**: Connect databases, search engines, third-party services +- **Multi-Agent Collaboration**: Multiple LLM models working together +- **RAG Applications**: Integrate vector databases for knowledge base Q&A + +All achievable through drag-and-drop without writing code. + +## Summary + +With LangBot + Langflow, you can rapidly build powerful multi-platform AI chatbots. Langflow provides visual workflow orchestration, LangBot handles messaging platform integration - together they create a complete loop from workflow design to multi-platform deployment. + +This approach is ideal for: +- Scenarios requiring the same AI capabilities across multiple platforms +- Teams wanting rapid iteration and testing of different conversation flows +- Developers wanting to build complex AI applications without deep coding + +## Related Resources + +- [LangBot Official Site](https://langbot.app) | [Documentation](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Langflow Official Site](https://www.langflow.org) | [Documentation](https://docs.langflow.org) | [GitHub](https://github.com/langflow-ai/langflow) + +--- + +*This article is based on the latest version of LangBot. LangBot supports integration with Dify, n8n, FastGPT, Coze, and other AI platforms - choose the workflow engine that best fits your needs.* diff --git a/en/articles/langtars-remote-pc-control-dify-n8n.mdx b/en/articles/langtars-remote-pc-control-dify-n8n.mdx new file mode 100644 index 000000000..2904675c6 --- /dev/null +++ b/en/articles/langtars-remote-pc-control-dify-n8n.mdx @@ -0,0 +1,200 @@ +--- +title: "LangTARS: Open-Source AI Agent for Remote PC Control — Works with Dify, n8n & 10+ Messaging Platforms" +description: "LangTARS is a LangBot native plugin that lets you remotely control Mac/Windows/Linux from Telegram, Discord & WeChat — with Dify and n8n workflow support." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/langtars-remote-pc-control-dify-n8n). + +Published 2026-03-23 · Author: LangBot Team + +![LangTARS Logo](/images/articles/external/3fe5bdc18716-icon.svg) + +**LangBot Native Plugin | OpenClaw-like Experience | Ready to Use with One-Click Deployment** + +--- + +## ✨ What is LangTARS? + +**LangTARS** is a powerful **OpenClaw alternative** and native plugin for LangBot, inspired by the loyal and reliable robot TARS from the movie *Interstellar*. + +As a versatile **AI agent** for **remote computer control**, LangTARS allows you to remotely command your **Mac, Windows, or Linux** machine directly through your favorite messaging apps like **Telegram, Discord, DingTalk, and WeChat**! If you've been looking for an **OpenClaw-like** computer use agent that integrates seamlessly into your existing **chatbot framework**, LangTARS is the perfect solution. + +> 💡 **Deploy LangBot, and you can experience LangTARS instantly!** No extra standalone agent installation needed—just get it with one click from the plugin marketplace. + +![LangTARS Demo](/images/articles/external/70b26e660a60-tars.gif) + +--- + +## 🤖 The LangBot Ecosystem + +LangTARS is just ONE plugin in the massive LangBot ecosystem. **LangBot** is a leading **open source chatbot** framework designed for connecting LLMs to messaging platforms. + +- **Multi-platform bot integration**: Native support for Telegram, Discord, WeChat, DingTalk, Lark, LINE, Slack, and more. +- **Multi-model LLM chatbot**: Works flawlessly with OpenAI, Claude, Gemini, DeepSeek, and local models. +- **Rich Plugin Marketplace**: Access over 30+ plugins for endless functionality. +- **Advanced Features**: Pipeline-based message processing, RAG support, and multi-agent workflows. +- **Self-hosted AI**: Total control over your data and deployments. +- **AI Workflow Integrations**: Connect LangBot to platforms like **Dify**, **n8n**, **Langflow**, and **Coze**. LangBot can act as the messaging frontend for your complex AI workflows, meaning LangTARS + Dify/n8n = powerful automation! + +Get started with LangBot: +- **Easiest**: [LangBot Cloud](https://cloud.langbot.app) +- Self-host: `uvx langbot@latest` +- Documentation: [docs.langbot.app](https://docs.langbot.app) +- GitHub: [github.com/langbot-app/LangBot](https://github.com/langbot-app/LangBot) (15k+ stars) + +--- + +## 🎯 What Can It Do? + +As a comprehensive **automation tool**, just send a message, and the AI will handle your **task automation** and **browser automation**: + +| You Say | AI Does | +|------|-------| +| `!tars open Reddit in Chrome, post a thread with the title "Hello from LangTARS" and say hi` | 🌐 Automatically controls Chrome to open Reddit and publish a post | +| `!tars organize my desktop files` | 📁 Automatically categorizes and moves files | +| `!tars open the browser and search for today's AI news` | 🌐 Opens a browser, searches the web, and summarizes the news | +| `!tars create a meeting note for our marketing sync` | 📝 Automatically creates a markdown note file | +| `!tars check system memory and CPU` | 💻 Uses MCP tools to get computer status | + +![Usage Example](/images/articles/external/6613b3025b8b-usage-example.png) +![Plan Mode](/images/articles/external/ff42857251ab-planner-mode.png) + + +--- + +## 🔗 Supercharge with Dify & n8n + +LangTARS becomes even more powerful when combined with **AI workflow platforms**: + +- **Dify Integration**: Connect LangBot to [Dify](https://dify.ai) as a messaging frontend. Build complex AI workflows in Dify's visual editor, then trigger them from Telegram/Discord via LangTARS. +- **n8n Integration**: Use [n8n](https://n8n.io) workflows with LangBot for advanced automation chains. Combine LangTARS's computer control with n8n's 400+ integrations for unlimited possibilities. +- **Also supports**: Langflow, Coze, and any OpenAI-compatible API. + +> 💡 **Example**: "Hey TARS, run my Dify workflow to analyze today's sales data and save the report to my desktop" — LangTARS handles the entire chain. + +--- + +## 🚀 Why Choose LangTARS? + +### 1️⃣ LangBot Native Plugin, Out of the Box + +Instead of deploying a complex standalone agent, you can easily **deploy AI bot** capabilities right where you already chat. + +```bash +# Deploy LangBot with one command +uvx langbot@latest + +# Install LangTARS from the plugin market, configure your LLM, and start using! +``` + +**No complex configuration, no extra deployment. LangBot users can experience OpenClaw-style computer control directly!** + +![Installation Flow](/images/articles/external/2a3a0d5f4ae9-install-flow.png) + +--- + +### 2️⃣ Intelligent Task Planning, Autonomous Execution + +Powered by an AI planning engine based on the **ReAct agent** loop: + +``` +Your Command → Understand Needs → Make a Plan → Execute Step-by-Step → Feedback Results +``` + +The AI assistant thinks like a human and automatically breaks down complex tasks using integrated **MCP tools**! + +--- + +### 3️⃣ Multi-Browser Support for Web Automation + +| Browser | macOS | Windows | Linux | +|--------|-------|---------|-------| +| Playwright (Headless) | ✅ | ✅ | ✅ | +| Safari | ✅ | - | - | +| Chrome | ✅ | ✅ | ✅ | +| Edge | - | ✅ | - | +| Firefox | - | - | ✅ | + +--- + +### 4️⃣ Security-First Design + +- 🚫 **Dangerous Command Interception** — Automatically blocks commands like `rm -rf /` +- 📂 **Workspace Isolation** — Restricts file operations to safe directories +- 📋 **Command Whitelist** — Configurable allowed commands +- 👤 **User Access Control** — Restricts usage to specific authorized users + +![Security Features](/images/articles/external/a618d3d41416-security.png) + +--- + +## 📱 Quick Start + +### Step 1: Deploy LangBot + +> 🚀 **Fastest way to start:** Use [LangBot Cloud](https://cloud.langbot.app) — deploy your LangBot instance in one click, no server needed! Install LangTARS from the plugin marketplace and start controlling your computer immediately. + +*Alternative for power users (Self-hosted):* +```bash +uvx langbot@latest +``` + +### Step 2: Configure Chat Platform + +Follow the documentation to configure your **Telegram bot**, **WeChat bot**, or **Discord bot**. + +### Step 3: Install LangTARS + +Search for **LangTARS** in the **plugin marketplace** and install it. + +### Step 4: Start Chatting + +``` +!tars Hello, tell me what you can do +``` + +> 📱 **Recommendation**: Use it on Telegram or Discord for the best interactive experience! + +--- + +## 🎮 Common Commands + +| Command | Function | +|------|------| +| `!tars ` | Execute a task | +| `!tars stop` | Stop the current task | +| `!tars what` | Check execution status | +| `!tars reset` | Reset the conversation | +| `!tars help` | Show help | + +--- + +## 🌟 Project Information + +| Item | Information | +|------|------| +| **GitHub** | [github.com/langbot-app/LangTARS](https://github.com/langbot-app/LangTARS) | +| **Language** | Python 100% | +| **License** | CC BY-NC-ND 4.0 | +| **Platforms** | macOS / Windows / Linux | + +--- + +## 🔗 Related Links + +- 📖 **LangBot Documentation**: [docs.langbot.app](https://docs.langbot.app) +- 💬 **Issue Feedback**: [GitHub Issues](https://github.com/langbot-app/LangTARS/issues) +- ⭐ **Support with a Star**: [GitHub](https://github.com/langbot-app/LangTARS) + +--- + +## 🎉 Deploy LangBot and Experience LangTARS! + +**Let AI be your loyal digital assistant, just like TARS.** + +> 🚀 **Fastest way to start:** Use [LangBot Cloud](https://cloud.langbot.app) — deploy your LangBot instance in one click, no server needed! Install LangTARS from the plugin marketplace and start controlling your computer immediately. + +*Alternative for power users (Self-hosted):* +```bash +uvx langbot@latest +``` diff --git a/en/articles/n8n-multi-platform-ai-chatbot.mdx b/en/articles/n8n-multi-platform-ai-chatbot.mdx new file mode 100644 index 000000000..d10e91af5 --- /dev/null +++ b/en/articles/n8n-multi-platform-ai-chatbot.mdx @@ -0,0 +1,184 @@ +--- +title: "How I Built a Multi-Platform AI Chatbot with n8n and LangBot" +description: "How I Built a Multi-Platform AI Chatbot with n8n and LangBot" +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/n8n-multi-platform-ai-chatbot). + +Published 2025-12-03 · Author: LangBot Team + +![How I Built a Multi-Platform AI Chatbot with n8n and LangBot](/images/articles/source/images/covers/n8n.png) + +Connecting n8n's visual workflow automation with LangBot's multi-platform bot framework creates a powerful, code-free way to deploy AI chatbots across QQ, WeChat, Discord, Telegram, Slack, and more. This tutorial shows you how to integrate these tools in minutes. + +## What You'll Need + +- Python 3.8+ installed +- Node.js 18+ installed +- npm or npx available +- 15 minutes of your time + +## Deploy LangBot in 3 Commands + +LangBot is a production-ready bot framework that connects to multiple messaging platforms and AI services including Dify, FastGPT, Coze, OpenAI, Claude, and Gemini. Deploy it instantly: + +```bash +cd your-workspace +mkdir -p langbot-instance && cd langbot-instance +uvx langbot@latest +``` + +On first launch, LangBot initializes automatically. Open `http://127.0.0.1:5300` in your browser. + +![LangBot initialization screen](/images/articles/external/70ee40a6d232-01-langbot-initialization.png) + +Register your admin account when prompted. You'll land on the dashboard where you can manage bots, models, pipelines, and integrations. + +![LangBot dashboard](/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png) + +## Set Up n8n Workflow Automation + +n8n is an open-source automation platform with 400+ integrations and powerful AI capabilities. Launch it locally: + +```bash +cd your-workspace +mkdir -p n8n-data +export N8N_USER_FOLDER=$(pwd)/n8n-data +npx n8n +``` + +Visit `http://127.0.0.1:5678` and create your owner account. + +![n8n initial setup](/images/articles/external/12d0e04600c5-05-n8n-setup.png) + +## Build Your AI Workflow + +Create a new workflow in n8n. You'll need two essential nodes: + +![n8n workflow editor](/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png) + +### Add the Webhook Trigger + +Click "+" on the canvas and add a **Webhook** node. Configure it: + +- **HTTP Method**: POST +- **Response Mode**: Streaming (enables real-time chat responses) +- **Authentication**: None (adjust for production) + +![Webhook node configuration](/images/articles/external/03443176ae5c-08-n8n-webhook-node.png) + +### Add the AI Agent + +Press Tab, navigate to the "AI" category, and select **AI Agent**. + +**Configure the Chat Model**: Click "Chat Model" and choose "OpenAI Chat Model". Add your credentials: + +- **API Key**: Your OpenAI API key (or compatible service key) +- **Base URL**: For OpenAI alternatives like Claude, Gemini, or local models, update to your provider's endpoint + +**Critical Step - Fix the Prompt Source**: By default, the AI Agent expects a Chat Trigger node, which won't work with webhooks. Here's how to fix it: + +1. Find "Source for Prompt (User Message)" in the AI Agent settings +2. Change from "Connected Chat Trigger Node" to "Define below" +3. Switch to "Expression" mode +4. Enter: `{{ $json.body }}` + +This expression pulls the user's message from the webhook request body. + +![Configured webhook with AI Agent](/images/articles/external/621f3d526678-09-n8n-webhook-configured.png) + +### Activate and Get Your Webhook URL + +Save the workflow and toggle the activation switch (top-right). Switch to the "Production URL" tab and copy the webhook URL: + +``` +http://localhost:5678/webhook/{your-webhook-id} +``` + +## Connect LangBot to n8n + +Back in the LangBot dashboard, navigate to **Pipelines** and click the default "ChatPipeline". + +![LangBot pipelines page](/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png) + +Switch to the **AI** tab and select "n8n Workflow API" from the Runner dropdown. Configure: + +- **Webhook URL**: Paste your n8n production webhook URL +- **Authentication Type**: None (match your n8n webhook settings) +- **Timeout**: 120 seconds +- **Output Key**: response + +Click **Save**. + +## Test It Out + +In the Pipeline editor, click "Debug Chat" on the left sidebar. Send a test message like "What is LangBot?" + +If everything works, you'll see LangBot send the message to n8n, where the AI Agent processes it and streams back a response. + +## Troubleshooting + +**Error: "Expected to find the prompt in an input field called 'chatInput'"** + +This means the AI Agent is still configured for a Chat Trigger node. Fix it: + +1. Open the AI Agent configuration +2. Set "Source for Prompt (User Message)" to "Define below" +3. Switch to Expression mode +4. Enter: `{{ $json.body }}` + +**Test Your Webhook Directly** + +Verify the webhook works with curl: + +```bash +curl -X POST http://localhost:5678/webhook/your-webhook-id \ + -H "Content-Type: application/json" \ + -d '{"body": "Hello, can you introduce yourself?"}' +``` + +You should receive streaming JSON with the AI's response. + +## How the Integration Works + +Here's the complete flow: + +1. User sends a message via QQ, WeChat, Discord, Telegram, Slack, LINE, or any LangBot-supported platform +2. LangBot's Pipeline receives the message and calls the n8n Workflow API +3. n8n's Webhook node captures the request and passes it to the AI Agent +4. The AI Agent uses OpenAI, Claude, Gemini, or your configured LLM to generate a response +5. n8n streams the response back to LangBot +6. LangBot delivers the response to the user on their original platform + +## Why This Combination Works + +**LangBot + n8n** unlocks powerful capabilities: + +1. **No-Code AI Logic**: Design conversation flows visually in n8n without touching code +2. **Multi-Platform Reach**: Deploy the same AI across QQ, WeChat, Discord, Telegram, Slack, LINE, DingTalk, and Lark simultaneously +3. **Flexible AI Models**: Swap between OpenAI GPT, Anthropic Claude, Google Gemini, Coze, Dify, local models, and more +4. **Rich Integrations**: Connect n8n's 400+ integrations - databases, APIs, Notion, Airtable, Google Sheets, Slack, and beyond +5. **Tool-Calling Agents**: AI Agent can trigger n8n tools like database queries, API calls, or custom functions +6. **Workflow Extensions**: Add preprocessing, content moderation, logging, or custom business logic + +**Perfect For**: +- Enterprise customer support bots +- Knowledge base Q&A systems +- Multi-platform community management +- Task automation assistants +- Unified chat interfaces for teams + +## Next Steps + +Extend your bot further: + +- Integrate Dify or FastGPT for advanced RAG (retrieval-augmented generation) +- Add vector database nodes (Pinecone, Qdrant, Weaviate) for knowledge retrieval +- Connect business APIs for real-time data +- Implement conversation memory and context tracking +- Add content filtering and moderation workflows +- Use Langflow or Coze for additional AI orchestration + +This integration gives you the flexibility of code-based AI frameworks like LangChain with the simplicity of visual workflow builders - all while reaching users across every major messaging platform. + +Ready to deploy your multi-platform AI assistant? Start with LangBot and n8n today. diff --git a/en/articles/welcome.mdx b/en/articles/welcome.mdx new file mode 100644 index 000000000..500ec3ee6 --- /dev/null +++ b/en/articles/welcome.mdx @@ -0,0 +1,33 @@ +--- +title: "Introducing the LangBot Blog" +description: "Welcome to the official LangBot blog. Stay up to date with product updates, new features, and milestones." +--- + +This article is synchronized from the LangBot Blog. [Read the canonical version](https://langbot.app/en/blog/welcome). + +Published 2026-02-17 · Author: LangBot Team + +![LangBot Blog](/images/articles/source/images/covers/welcome.png) + +We're excited to launch the official LangBot blog! This is where we'll share product updates, new features, milestones, and insights from the LangBot team. + +## What is LangBot? + +LangBot is an open-source LLM-native instant messaging bot platform. It supports multiple messaging platforms and model providers, with integrations for Dify, Alibaba Cloud Bailian, and other LLMOps platforms. LangBot also provides a WebUI for quick deployment and management. + +## What to Expect + +On this blog, you'll find: + +- **Release Notes** - Detailed breakdowns of each new version +- **Feature Spotlights** - Deep dives into new capabilities +- **Milestones** - Project growth and community achievements +- **Guides & Tips** - Best practices for getting the most out of LangBot + +## Stay Connected + +- [GitHub](https://github.com/langbot-app/LangBot) - Star us and follow development +- [Documentation](https://docs.langbot.app) - Full guides and API reference +- [LangBot Home](https://langbot.app) - Main website + +Stay tuned for more updates! diff --git a/images/articles/external/03443176ae5c-08-n8n-webhook-node.png b/images/articles/external/03443176ae5c-08-n8n-webhook-node.png new file mode 100644 index 000000000..b000ce791 Binary files /dev/null and b/images/articles/external/03443176ae5c-08-n8n-webhook-node.png differ diff --git a/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png b/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png new file mode 100644 index 000000000..735cee47e Binary files /dev/null and b/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png differ diff --git a/images/articles/external/12d0e04600c5-05-n8n-setup.png b/images/articles/external/12d0e04600c5-05-n8n-setup.png new file mode 100644 index 000000000..c28795e73 Binary files /dev/null and b/images/articles/external/12d0e04600c5-05-n8n-setup.png differ diff --git a/images/articles/external/21fc47358066-05-langflow-api-keys-page.png b/images/articles/external/21fc47358066-05-langflow-api-keys-page.png new file mode 100644 index 000000000..1daac27ad Binary files /dev/null and b/images/articles/external/21fc47358066-05-langflow-api-keys-page.png differ diff --git a/images/articles/external/2a3a0d5f4ae9-install-flow.png b/images/articles/external/2a3a0d5f4ae9-install-flow.png new file mode 100644 index 000000000..7c830f791 Binary files /dev/null and b/images/articles/external/2a3a0d5f4ae9-install-flow.png differ diff --git a/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png b/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png new file mode 100644 index 000000000..004e0d4b3 Binary files /dev/null and b/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png differ diff --git a/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png b/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png new file mode 100644 index 000000000..3b41c4150 Binary files /dev/null and b/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png differ diff --git a/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png b/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png new file mode 100644 index 000000000..d2c951747 Binary files /dev/null and b/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png differ diff --git a/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png b/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png new file mode 100644 index 000000000..0773fcbf1 Binary files /dev/null and b/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png differ diff --git a/images/articles/external/3fe5bdc18716-icon.svg b/images/articles/external/3fe5bdc18716-icon.svg new file mode 100644 index 000000000..e71d7e956 --- /dev/null +++ b/images/articles/external/3fe5bdc18716-icon.svg @@ -0,0 +1,13660 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/images/articles/external/471b316018e5-13-dify-api-key-created.png b/images/articles/external/471b316018e5-13-dify-api-key-created.png new file mode 100644 index 000000000..7e6cf31df Binary files /dev/null and b/images/articles/external/471b316018e5-13-dify-api-key-created.png differ diff --git a/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png b/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png new file mode 100644 index 000000000..5123e6b5b Binary files /dev/null and b/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png differ diff --git a/images/articles/external/621f3d526678-09-n8n-webhook-configured.png b/images/articles/external/621f3d526678-09-n8n-webhook-configured.png new file mode 100644 index 000000000..9fd64291f Binary files /dev/null and b/images/articles/external/621f3d526678-09-n8n-webhook-configured.png differ diff --git a/images/articles/external/6613b3025b8b-usage-example.png b/images/articles/external/6613b3025b8b-usage-example.png new file mode 100644 index 000000000..3a1c4d340 Binary files /dev/null and b/images/articles/external/6613b3025b8b-usage-example.png differ diff --git a/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png b/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png new file mode 100644 index 000000000..8d3e7947d Binary files /dev/null and b/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png differ diff --git a/images/articles/external/70b26e660a60-tars.gif b/images/articles/external/70b26e660a60-tars.gif new file mode 100644 index 000000000..7340c89b3 Binary files /dev/null and b/images/articles/external/70b26e660a60-tars.gif differ diff --git a/images/articles/external/70ee40a6d232-01-langbot-initialization.png b/images/articles/external/70ee40a6d232-01-langbot-initialization.png new file mode 100644 index 000000000..9d9d24019 Binary files /dev/null and b/images/articles/external/70ee40a6d232-01-langbot-initialization.png differ diff --git a/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png b/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png new file mode 100644 index 000000000..d652f89be Binary files /dev/null and b/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png differ diff --git a/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png b/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png new file mode 100644 index 000000000..df2a40364 Binary files /dev/null and b/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png differ diff --git a/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png b/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png new file mode 100644 index 000000000..7e08e18ea Binary files /dev/null and b/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png differ diff --git a/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png b/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png new file mode 100644 index 000000000..a5d430d51 Binary files /dev/null and b/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png differ diff --git a/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png b/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png new file mode 100644 index 000000000..134f3cce3 Binary files /dev/null and b/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png differ diff --git a/images/articles/external/9066d99b172c-11-dify-tools-panel.png b/images/articles/external/9066d99b172c-11-dify-tools-panel.png new file mode 100644 index 000000000..4cfb57471 Binary files /dev/null and b/images/articles/external/9066d99b172c-11-dify-tools-panel.png differ diff --git a/images/articles/external/9999c12907eb-20-langbot-chat-test.png b/images/articles/external/9999c12907eb-20-langbot-chat-test.png new file mode 100644 index 000000000..2b6cf9541 Binary files /dev/null and b/images/articles/external/9999c12907eb-20-langbot-chat-test.png differ diff --git a/images/articles/external/a618d3d41416-security.png b/images/articles/external/a618d3d41416-security.png new file mode 100644 index 000000000..302923487 Binary files /dev/null and b/images/articles/external/a618d3d41416-security.png differ diff --git a/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png b/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png new file mode 100644 index 000000000..201ee73f9 Binary files /dev/null and b/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png differ diff --git a/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png b/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png new file mode 100644 index 000000000..713fcf60f Binary files /dev/null and b/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png differ diff --git a/images/articles/external/b93d97b5b830-04-langbot-dashboard.png b/images/articles/external/b93d97b5b830-04-langbot-dashboard.png new file mode 100644 index 000000000..b73b5a477 Binary files /dev/null and b/images/articles/external/b93d97b5b830-04-langbot-dashboard.png differ diff --git a/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png b/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png new file mode 100644 index 000000000..cad91152c Binary files /dev/null and b/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png differ diff --git a/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png b/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png new file mode 100644 index 000000000..f66912912 Binary files /dev/null and b/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png differ diff --git a/images/articles/external/be278ca435e8-12-dify-agent-configured.png b/images/articles/external/be278ca435e8-12-dify-agent-configured.png new file mode 100644 index 000000000..c5eee9210 Binary files /dev/null and b/images/articles/external/be278ca435e8-12-dify-agent-configured.png differ diff --git a/images/articles/external/c6d52212ba91-02-langbot-dashboard.png b/images/articles/external/c6d52212ba91-02-langbot-dashboard.png new file mode 100644 index 000000000..ef4e82c2f Binary files /dev/null and b/images/articles/external/c6d52212ba91-02-langbot-dashboard.png differ diff --git a/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png b/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png new file mode 100644 index 000000000..34c691f4f Binary files /dev/null and b/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png differ diff --git a/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png b/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png new file mode 100644 index 000000000..579c7510f Binary files /dev/null and b/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png differ diff --git a/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png b/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png new file mode 100644 index 000000000..1a211eecf Binary files /dev/null and b/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png differ diff --git a/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png b/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png new file mode 100644 index 000000000..8bc5d1d8f Binary files /dev/null and b/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png differ diff --git a/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png b/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png new file mode 100644 index 000000000..50da13995 Binary files /dev/null and b/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png differ diff --git a/images/articles/external/ff42857251ab-planner-mode.png b/images/articles/external/ff42857251ab-planner-mode.png new file mode 100644 index 000000000..115d38e28 Binary files /dev/null and b/images/articles/external/ff42857251ab-planner-mode.png differ diff --git a/images/articles/source/images/article-mcp/01-init-page.png b/images/articles/source/images/article-mcp/01-init-page.png new file mode 100644 index 000000000..44ce00cde Binary files /dev/null and b/images/articles/source/images/article-mcp/01-init-page.png differ diff --git a/images/articles/source/images/article-mcp/05-pipelines.png b/images/articles/source/images/article-mcp/05-pipelines.png new file mode 100644 index 000000000..34f5b1647 Binary files /dev/null and b/images/articles/source/images/article-mcp/05-pipelines.png differ diff --git a/images/articles/source/images/article-mcp/06-pipeline-ai.png b/images/articles/source/images/article-mcp/06-pipeline-ai.png new file mode 100644 index 000000000..0cafe65ad Binary files /dev/null and b/images/articles/source/images/article-mcp/06-pipeline-ai.png differ diff --git a/images/articles/source/images/article-mcp/07-debug-chat.png b/images/articles/source/images/article-mcp/07-debug-chat.png new file mode 100644 index 000000000..cead0a319 Binary files /dev/null and b/images/articles/source/images/article-mcp/07-debug-chat.png differ diff --git a/images/articles/source/images/article-mcp/08-model-select.png b/images/articles/source/images/article-mcp/08-model-select.png new file mode 100644 index 000000000..12548f988 Binary files /dev/null and b/images/articles/source/images/article-mcp/08-model-select.png differ diff --git a/images/articles/source/images/article-mcp/10-group-chat.png b/images/articles/source/images/article-mcp/10-group-chat.png new file mode 100644 index 000000000..f51bd0d13 Binary files /dev/null and b/images/articles/source/images/article-mcp/10-group-chat.png differ diff --git a/images/articles/source/images/article-mcp/11-private-chat.png b/images/articles/source/images/article-mcp/11-private-chat.png new file mode 100644 index 000000000..d45065784 Binary files /dev/null and b/images/articles/source/images/article-mcp/11-private-chat.png differ diff --git a/images/articles/source/images/article-mcp/13-bot-page.png b/images/articles/source/images/article-mcp/13-bot-page.png new file mode 100644 index 000000000..399a0ab64 Binary files /dev/null and b/images/articles/source/images/article-mcp/13-bot-page.png differ diff --git a/images/articles/source/images/article-mcp/14-space-market.png b/images/articles/source/images/article-mcp/14-space-market.png new file mode 100644 index 000000000..76a1cd413 Binary files /dev/null and b/images/articles/source/images/article-mcp/14-space-market.png differ diff --git a/images/articles/source/images/cloud-multi-user/cloud-invitation.png b/images/articles/source/images/cloud-multi-user/cloud-invitation.png new file mode 100644 index 000000000..357d86eb8 Binary files /dev/null and b/images/articles/source/images/cloud-multi-user/cloud-invitation.png differ diff --git a/images/articles/source/images/cloud-multi-user/cloud-login.png b/images/articles/source/images/cloud-multi-user/cloud-login.png new file mode 100644 index 000000000..da96e7e37 Binary files /dev/null and b/images/articles/source/images/cloud-multi-user/cloud-login.png differ diff --git a/images/articles/source/images/cloud-multi-user/oss-dashboard.png b/images/articles/source/images/cloud-multi-user/oss-dashboard.png new file mode 100644 index 000000000..4d53cc8f0 Binary files /dev/null and b/images/articles/source/images/cloud-multi-user/oss-dashboard.png differ diff --git a/images/articles/source/images/covers/deepseek-wechat.png b/images/articles/source/images/covers/deepseek-wechat.png new file mode 100644 index 000000000..4de9afd60 Binary files /dev/null and b/images/articles/source/images/covers/deepseek-wechat.png differ diff --git a/images/articles/source/images/covers/deploy-ai-bot.png b/images/articles/source/images/covers/deploy-ai-bot.png new file mode 100644 index 000000000..879dde85c Binary files /dev/null and b/images/articles/source/images/covers/deploy-ai-bot.png differ diff --git a/images/articles/source/images/covers/dify-agent.png b/images/articles/source/images/covers/dify-agent.png new file mode 100644 index 000000000..ffc6354e8 Binary files /dev/null and b/images/articles/source/images/covers/dify-agent.png differ diff --git a/images/articles/source/images/covers/dify-rag.png b/images/articles/source/images/covers/dify-rag.png new file mode 100644 index 000000000..84ebc6f6a Binary files /dev/null and b/images/articles/source/images/covers/dify-rag.png differ diff --git a/images/articles/source/images/covers/langflow.png b/images/articles/source/images/covers/langflow.png new file mode 100644 index 000000000..3a585d08e Binary files /dev/null and b/images/articles/source/images/covers/langflow.png differ diff --git a/images/articles/source/images/covers/n8n.png b/images/articles/source/images/covers/n8n.png new file mode 100644 index 000000000..55458b58c Binary files /dev/null and b/images/articles/source/images/covers/n8n.png differ diff --git a/images/articles/source/images/covers/plugin-system.png b/images/articles/source/images/covers/plugin-system.png new file mode 100644 index 000000000..acc76ab03 Binary files /dev/null and b/images/articles/source/images/covers/plugin-system.png differ diff --git a/images/articles/source/images/covers/rag-plugin.png b/images/articles/source/images/covers/rag-plugin.png new file mode 100644 index 000000000..1d84a53cb Binary files /dev/null and b/images/articles/source/images/covers/rag-plugin.png differ diff --git a/images/articles/source/images/covers/sandbox-skills.png b/images/articles/source/images/covers/sandbox-skills.png new file mode 100644 index 000000000..c191c93cd Binary files /dev/null and b/images/articles/source/images/covers/sandbox-skills.png differ diff --git a/images/articles/source/images/covers/welcome.png b/images/articles/source/images/covers/welcome.png new file mode 100644 index 000000000..9c1e662b4 Binary files /dev/null and b/images/articles/source/images/covers/welcome.png differ diff --git a/images/articles/source/images/plugin-system/architecture.png b/images/articles/source/images/plugin-system/architecture.png new file mode 100644 index 000000000..2c8ab398c Binary files /dev/null and b/images/articles/source/images/plugin-system/architecture.png differ diff --git a/images/articles/source/images/plugin-system/event-dispatch.png b/images/articles/source/images/plugin-system/event-dispatch.png new file mode 100644 index 000000000..c3f7675b6 Binary files /dev/null and b/images/articles/source/images/plugin-system/event-dispatch.png differ diff --git a/images/articles/source/images/rag-plugin/data-flow.png b/images/articles/source/images/rag-plugin/data-flow.png new file mode 100644 index 000000000..84c3ef57a Binary files /dev/null and b/images/articles/source/images/rag-plugin/data-flow.png differ diff --git a/images/articles/source/images/rag-plugin/dir-structure.png b/images/articles/source/images/rag-plugin/dir-structure.png new file mode 100644 index 000000000..8c4fea836 Binary files /dev/null and b/images/articles/source/images/rag-plugin/dir-structure.png differ diff --git a/images/articles/source/images/sandbox-skills/sandbox-tools.png b/images/articles/source/images/sandbox-skills/sandbox-tools.png new file mode 100644 index 000000000..f950d1e41 Binary files /dev/null and b/images/articles/source/images/sandbox-skills/sandbox-tools.png differ diff --git a/images/articles/source/images/sandbox-skills/sandbox.png b/images/articles/source/images/sandbox-skills/sandbox.png new file mode 100644 index 000000000..e45b17063 Binary files /dev/null and b/images/articles/source/images/sandbox-skills/sandbox.png differ diff --git a/images/articles/source/images/sandbox-skills/skills.png b/images/articles/source/images/sandbox-skills/skills.png new file mode 100644 index 000000000..f7cdae00c Binary files /dev/null and b/images/articles/source/images/sandbox-skills/skills.png differ diff --git a/ja/articles/connect-deepseek-to-wechat.mdx b/ja/articles/connect-deepseek-to-wechat.mdx new file mode 100644 index 000000000..9aa411c27 --- /dev/null +++ b/ja/articles/connect-deepseek-to-wechat.mdx @@ -0,0 +1,105 @@ +--- +title: "DeepSeek R1 を WeChat・Discord・Telegram に5分で接続する方法" +description: "A step-by-step guide to connecting DeepSeek R1/V3 API to WeChat (Personal/Enterprise), Discord, Telegram, and more using LangBot. No coding required." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/connect-deepseek-to-wechat). + +公開日:2026-02-21 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![DeepSeek x WeChat Integration](/images/articles/source/images/covers/deepseek-wechat.png) + +DeepSeek has taken the AI world by storm. Its R1 reasoning model rivals OpenAI's o1 but is open-source and significantly cheaper. + +However, the official DeepSeek app currently only supports "AI Search" in WeChat, and direct integration into group chats or private workflows is limited. + +**What if you could have a fully functional DeepSeek R1 bot in your WeChat groups, Discord servers, and Telegram chats right now?** + +With **LangBot**, you can. And it takes less than 5 minutes. + +## Why LangBot? + +LangBot is an open-source, production-grade IM bot platform. Unlike simple scripts or single-platform bots, LangBot gives you: + +* **Unified Platform:** Connect once, deploy to WeChat, Discord, Telegram, Slack, Lark, and more. +* **Model Agnostic:** Use DeepSeek R1, V3, Claude 3.5, GPT-4, or local Ollama models. +* **No Coding:** robust WebUI for configuration. +* **Enterprise Features:** Knowledge base (RAG), Plugin system, and multi-user management. + +## Prerequisites + +1. **A Server or PC:** Docker installed (VPS, local computer, or Synology/NAS). +2. **DeepSeek API Key:** + * **Official:** [platform.deepseek.com](https://platform.deepseek.com) + * **SiliconFlow (Recommended for speed):** [cloud.siliconflow.cn](https://cloud.siliconflow.cn) (Faster R1 inference). + +## Step 1: Deploy LangBot + +If you haven't deployed LangBot yet, run this one command: + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +Access your dashboard at `http://localhost:5300` (or your server IP). + +## Step 2: Configure DeepSeek Model + +1. Go to **Models** -> **Provider List**. +2. Find **DeepSeek** (or **SiliconFlow** / **OpenAI Compatible**). +3. Enter your API Key. +4. Click **Save**. + +Now create a **Model Instance**: +* **Name:** `DeepSeek-R1-Bot` +* **Model:** `deepseek-reasoner` (for R1) or `deepseek-chat` (for V3). + +## Step 3: Create a Chat Pipeline + +LangBot uses "Pipelines" to manage bot logic. + +1. Go to **Pipelines** -> **New Pipeline**. +2. Choose **Chat Pipeline**. +3. Select your `DeepSeek-R1-Bot` model. +4. (Optional) Add a System Prompt: + > "You are a helpful assistant powered by DeepSeek R1. You think deeply before answering." + +## Step 4: Connect to WeChat (or any platform) + +### For WeChat (Personal / Wechaty) +*Note: Personal WeChat access relies on third-party libraries and carries some risk. For business use, we recommend Enterprise WeChat (WeCom).* + +1. Go to **Bots** -> **New Bot**. +2. Select **WeChat**. +3. Choose the **GeweChat** or **Wechaty** adapter (depending on your preference). +4. Click **Save**. +5. Scan the QR code that appears in the logs or UI. + +### For Discord / Telegram +1. Select **Discord** or **Telegram**. +2. Paste your **Bot Token** (from Discord Developer Portal or BotFather). +3. Click **Save**. + +## Step 5: Test It Out! + +Open your chat app and send a message. You should see DeepSeek R1 "thinking" (if supported) and replying with high-quality reasoning. + +## Advanced: Using Search & Tools + +DeepSeek is great, but DeepSeek with **Internet Access** is better. + +In LangBot: +1. Go to **Plugins**. +2. Install **Tavily Search** or **Google Search**. +3. Add the plugin to your DeepSeek Pipeline. + +Now your bot can search the web for real-time info *before* reasoning with DeepSeek R1! + +--- + +**Ready to build?** +[Star us on GitHub](https://github.com/langbot-app/LangBot) or [Read the Docs](https://docs.langbot.app). diff --git a/ja/articles/deploy-ai-bot-in-5-minutes.mdx b/ja/articles/deploy-ai-bot-in-5-minutes.mdx new file mode 100644 index 000000000..5d90d2c37 --- /dev/null +++ b/ja/articles/deploy-ai-bot-in-5-minutes.mdx @@ -0,0 +1,172 @@ +--- +title: "AI Bot を Discord・Telegram・WeChat に5分でデプロイ" +description: "A step-by-step guide to deploying LangBot — the open-source platform that connects 20+ LLMs to 13+ messaging platforms with a single Docker command." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/deploy-ai-bot-in-5-minutes). + +公開日:2026-02-17 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot Dashboard](/images/articles/source/images/covers/deploy-ai-bot.png) + +What if you could have GPT-5, Claude, DeepSeek, and Gemini all answering questions in your Discord server, Telegram group, and WeChat — at the same time? + +No API wrangling. No weeks of development. Just one Docker command. + +That's **LangBot** — and it just crossed **15,000 stars** on GitHub. + +## The Problem Everyone Faces + +You want an AI assistant in your team's chat. Maybe for customer support on Telegram. Maybe for a coding helper in Discord. Maybe for a knowledge base bot in your company's WeChat or Lark group. + +But then reality hits: + +- Each platform has its own bot API, webhook format, and auth flow +- You need to handle message queuing, session management, and error recovery +- Switching LLM providers means rewriting your integration layer +- Adding RAG or tool calling is yet another project + +LangBot solves all of this with a single, unified platform. + +## What Makes LangBot Different + +### 13+ Messaging Platforms, One Codebase + +Deploy a single LangBot instance and connect it to: + +**Global:** Discord, Telegram, Slack, LINE, WhatsApp +**Asia:** WeChat (Official Account), WeCom, QQ, Lark, DingTalk, Feishu, KOOK + +Each platform gets its own adapter — you just fill in your bot token in the WebUI and you're live. + +![LangBot Bot Management Page](/images/articles/source/images/article-mcp/13-bot-page.png) + +### 20+ LLM Models, Zero Lock-in + +Through **LangBot Space**, you get instant access to 20 cloud models out of the box — no API keys to manage: + +- **Claude** (Opus 4.6, Sonnet 4.5, Haiku 4.5) +- **GPT** (GPT-5.2, GPT-5-mini, GPT-4.1-mini) +- **Gemini** (3 Pro, 2.5 Pro, 2.5 Flash) +- **DeepSeek** (R1, V3) +- **Grok** (4, 4.1) +- **Qwen** (3 Max) + +Or add your own providers — OpenAI-compatible endpoints, Ollama for local models, any provider you want. + +![Model Selection](/images/articles/source/images/article-mcp/08-model-select.png) + +### Built-in Agent with Tool Calling + +LangBot's Local Agent isn't just a chat wrapper — it's a full agent runtime: + +- **Multi-round conversations** with configurable memory +- **Function calling / tool use** for LLM-driven actions +- **MCP (Model Context Protocol)** support for connecting to 100+ pre-built tools +- **Knowledge base (RAG)** with built-in vector search + +![Pipeline AI Configuration](/images/articles/source/images/article-mcp/06-pipeline-ai.png) + +### Plugin Marketplace + +37+ community plugins and growing — install with one click: + +- **WebSearch** — Let your bot search the web +- **AI Image Generator** — Generate images from text +- **LinkAnaly** — Auto-preview links in chat +- **ScheNotify** — Schedule reminders with natural language +- **Google Search**, **Tavily Search**, **RAGFlow Retriever**, and more + +![LangBot Space Plugin Market](/images/articles/source/images/article-mcp/14-space-market.png) + +## Deploy in 5 Minutes — For Real + +### Step 1: Run Docker Compose + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +That's it. LangBot is now running at `http://localhost:5300`. + +### Step 2: Initialize with LangBot Space + +Open the WebUI and click **"Initialize with Space"**. This connects your instance to LangBot Space, giving you: + +- 20 cloud models ready to use (with free credits) +- One-click plugin installation +- Managed API keys + +![Initialize with Space](/images/articles/source/images/article-mcp/01-init-page.png) + +### Step 3: Configure Your Pipeline + +Go to **Pipelines** and edit the default `ChatPipeline`: + +1. Select your model (e.g., `deepseek-v3`, `gpt-5-mini`, `claude-sonnet-4-5`) +2. Customize the system prompt +3. Optionally attach a knowledge base or enable tools + +![Pipelines Page](/images/articles/source/images/article-mcp/05-pipelines.png) + +### Step 4: Connect a Platform + +Go to **Bots** → click **+** → choose your platform (Discord, Telegram, etc.) → enter your bot token. + +Done. Your bot is live. + +### Step 5: Test It + +Use the built-in **Debug Chat** to test your pipeline before going live: + +![Debug Chat](/images/articles/source/images/article-mcp/07-debug-chat.png) + +## Real Conversations, Real Value + +Here's what it looks like when LangBot is running in a QQ group — users asking technical questions and getting instant, accurate answers: + +![Group Chat Demo](/images/articles/source/images/article-mcp/10-group-chat.png) + +And in private chat: + +![Private Chat Demo](/images/articles/source/images/article-mcp/11-private-chat.png) + +## Architecture That Scales + +LangBot is built for production: + +- **Pipeline architecture** — each bot binds to a pipeline; pipelines handle AI logic, triggers, safety controls, and output formatting +- **Cross-process plugin isolation** — a bad plugin can't crash your bot +- **Multiple runner backends** — use LangBot's Local Agent, or connect to Dify, n8n, Langflow, Coze for complex workflows +- **Database flexibility** — SQLite for dev, PostgreSQL for production +- **Vector DB options** — Chroma, Qdrant, Milvus, pgvector, SeekDB + +## Why 15,000+ Developers Choose LangBot + +| Feature | LangBot | Building from Scratch | +|---------|---------|----------------------| +| Platforms | 13+ ready | Weeks per platform | +| LLM Providers | 20+ models | Manual integration | +| Agent Runtime | Built-in | Build your own | +| RAG | Native + external | Separate project | +| Plugin System | Marketplace | DIY | +| Deployment | `docker compose up` | Days of setup | +| WebUI | Included | Build your own | + +## Get Started + +- **GitHub:** [github.com/langbot-app/LangBot](https://github.com/langbot-app/LangBot) — give us a star! +- **Documentation:** [docs.langbot.app](https://docs.langbot.app) +- **Plugin Market:** [space.langbot.app](https://space.langbot.app) + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +Your AI bot empire starts with one command. diff --git a/ja/articles/dify-agent-discord-telegram-slack.mdx b/ja/articles/dify-agent-discord-telegram-slack.mdx new file mode 100644 index 000000000..3c2304501 --- /dev/null +++ b/ja/articles/dify-agent-discord-telegram-slack.mdx @@ -0,0 +1,117 @@ +--- +title: "Dify Agent を Discord・Telegram・Slack で動かす" +description: "Finally Got My Dify Agent Working in Discord, Telegram and Slack" +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/dify-agent-discord-telegram-slack). + +公開日:2025-12-11 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![Finally Got My Dify Agent Working in Discord, Telegram and Slack](/images/articles/source/images/covers/dify-agent.png) + +Want your Dify Agent to break free from the browser and chat directly in WeChat, QQ, or Telegram? Combine LangBot with Dify and you can set it up in under 10 minutes. + +## Why This Combo? + +[**LangBot**](https://github.com/langbot-app/LangBot) is the most powerful open-source multi-platform chatbot framework available. It supports major Chinese IMs (QQ, WeChat, Feishu, DingTalk) and international platforms (Telegram, Discord, Slack, LINE). Its core strength is connecting AI backends to messaging apps. + +**Dify** is one of the hottest AI app development platforms, offering visual Agent orchestration, 50+ built-in tools, and RAG knowledge bases. Together, they let you build a multi-platform AI assistant fast. + +## Deploy LangBot + +Three commands with uvx: + +```bash +mkdir langbot-instance +cd langbot-instance +uvx langbot@latest +``` + +Visit `http://127.0.0.1:5300` and register an admin account: + +![LangBot Dashboard](/images/articles/external/c6d52212ba91-02-langbot-dashboard.png) + +## Create a Dify Agent + +Log in to [cloud.dify.ai](https://cloud.dify.ai) and create a new app. Choose **Agent** type - unlike basic chat apps, Agents can reason autonomously and call tools for complex tasks. + +![Select Agent Type](/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png) + +### Configure the Agent + +In the orchestration interface, set up: + +**System Instructions** - Define the Agent's role: + +``` +You are an intelligent assistant that helps users complete various tasks. You have the following capabilities: +1. Answer various user questions +2. Query weather information +3. Retrieve webpage content + +Please always maintain a friendly and professional attitude. If you need to use tools to get information, proactively call the relevant tools. +``` + +**Add Tools** - Pick from Dify's 50+ built-in tools, like Weather and Web Scraper: + +![Add Tools](/images/articles/external/9066d99b172c-11-dify-tools-panel.png) + +**Select Model** - Supports GPT, Claude, Gemini, DeepSeek, and other major LLMs. + +Final configuration: + +![Configuration Complete](/images/articles/external/be278ca435e8-12-dify-agent-configured.png) + +### Get the API Key + +Click "Publish", then go to "Access API" to create a key: + +![Create API Key](/images/articles/external/471b316018e5-13-dify-api-key-created.png) + +Save the API key and server address `https://api.dify.ai/v1`. + +## Connect Dify to LangBot + +Back in LangBot, go to Pipelines > ChatPipeline > AI Capability: + +![AI Capability Config](/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png) + +Select **Dify Service API** as the Runner: + +![Select Dify Runner](/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png) + +Enter the configuration: +- **Base URL**: `https://api.dify.ai/v1` +- **API Key**: The key you just created +- **App Type**: Chat (including Chatflow) + +![Enter Configuration](/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png) + +Save and click "Debug Conversation" to test: + +![Test Conversation](/images/articles/external/9999c12907eb-20-langbot-chat-test.png) + +If the Agent responds correctly and calls tools, the integration is working. + +## Why This Architecture Rocks + +- **Decoupled Design**: Agent capabilities live in Dify, LangBot handles message routing - each does what it's best at +- **One Config, Multi-Platform**: Same Agent serves QQ, WeChat, Telegram, and more simultaneously +- **Easy to Extend**: Add RAG knowledge bases, Workflow orchestration, or more tools in Dify later + +## Next Steps + +- Configure messaging platforms in LangBot (QQ bot, WeChat personal account, etc.) +- Add more tools in Dify (database queries, API calls) +- Try Dify Chatflow for complex conversation flows + +If you're using n8n, FastGPT, Coze, or Langflow, LangBot supports those too. + +--- + +**Resources** + +- [LangBot Docs](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Dify Docs](https://docs.dify.ai) | [Cloud Platform](https://cloud.dify.ai) diff --git a/ja/articles/dify-langbot-rag-knowledge-base.mdx b/ja/articles/dify-langbot-rag-knowledge-base.mdx new file mode 100644 index 000000000..7bb2a56ee --- /dev/null +++ b/ja/articles/dify-langbot-rag-knowledge-base.mdx @@ -0,0 +1,206 @@ +--- +title: "LangBot 4.6.0 外部ナレッジベース入門:Dify と連携した RAG 会話" +description: "LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations" +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/dify-langbot-rag-knowledge-base). + +公開日:2025-12-02 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot 4.6.0 External Knowledge Base Tutorial: Integrating Dify with LangBot for RAG-powered Conversations](/images/articles/source/images/covers/dify-rag.png) + +LangBot 4.6.0 introduces external knowledge base functionality, allowing users to integrate external knowledge retrieval services such as Dify and RAGFlow into conversation pipelines. This tutorial demonstrates how to combine Dify knowledge base with LangBot to enable intelligent conversations based on domain-specific knowledge. + +## Feature Overview + +The external knowledge base feature enables LangBot to: +- Connect to various external knowledge retrieval services (Dify, RAGFlow, etc.) +- Provide professional answers based on domain-specific knowledge +- Flexibly extend knowledge retrieval capabilities through the plugin system +- Configure conveniently through WebUI without manual configuration file editing + +## Prerequisites + +Before starting, you need: +1. Deploy LangBot 4.6.0 or higher +2. Have a Dify account (register at https://cloud.dify.ai) +3. Configure a conversation model (this tutorial uses claude-opus-4-1-20250805) + +## Step 1: Deploy LangBot + +### 1.1 View LangBot Repository + +First, visit the [LangBot GitHub repository](https://github.com/langbot-app/LangBot) to understand the project. LangBot is a production-grade instant messaging bot development platform supporting multiple messaging platforms and LLM services. + +### 1.2 Learn About External Knowledge Base Feature + +Visit the [official LangBot documentation](https://docs.langbot.app) to view the external knowledge base usage instructions. The documentation provides detailed explanations on how to build built-in knowledge bases and connect to external knowledge bases. + +### 1.3 Start LangBot + +Use the `uvx langbot` command to quickly start LangBot, then visit http://127.0.0.1:5300 for initialization. Fill in your email and password to complete registration, then log in. + +### 1.4 Dashboard After Login + +After successfully logging in, you will see the LangBot WebUI dashboard. + +## Step 2: Configure Conversation Model + +Before using the knowledge base, you need to configure a conversation model. + +### 2.1 Navigate to Model Configuration Page + +Click "Models" in the left navigation bar to enter the model configuration page. + +### 2.2 Add New Model + +Click the "+" button to open the model configuration dialog. + +### 2.3 Fill in Model Information + +Fill in the following information: +- **Model Name**: claude-opus-4-1-20250805 +- **Model Provider**: New API +- **Request URL**: Your API endpoint +- **API Key**: Your API Key +- **Abilities**: Check Vision Ability and Function Call + +Click "Submit" to save the configuration. + +## Step 3: Create Knowledge Base in Dify + +### 3.1 Log in to Dify Platform + +Visit https://cloud.dify.ai and log in to your account. + +### 3.2 Navigate to Knowledge Page + +Click "Knowledge" in the top navigation bar to enter the knowledge base management page. + +### 3.3 Create New Knowledge Base + +Click "Create Knowledge" to start creating a knowledge base. + +### 3.4 Select Data Source + +You can choose from the following methods to import data: +- **Import from file**: Upload document files +- **Sync from Notion**: Sync from Notion +- **Sync from website**: Crawl website content + +This tutorial selects "Import from file" and uploads prepared LangBot documentation. + +### 3.5 Upload Document + +After uploading the document, the system will display file information. Click "Next" to proceed. + +### 3.6 Configure Document Processing Parameters + +On the document processing page, you can configure chunk settings, index method, and retrieval settings: +- **Chunk Settings**: General mode, maximum chunk length 1024 characters +- **Index Method**: High Quality (uses embedding model) +- **Retrieval Setting**: Vector Search + +Click "Save & Process" to start processing the document. + +### 3.7 Knowledge Base Processing + +The system starts processing the document and generating vector embeddings. + +### 3.8 Embedding Completed + +After processing is complete, the knowledge base is ready to use. + +## Step 4: Get Dify API Information + +### 4.1 Open Service API Panel + +Click the "Service API" button in the bottom right. Record the following information: +- **Service API Endpoint**: https://api.dify.ai/v1 +- **Dataset ID**: Get from the URL + +### 4.2 Get API Key + +Click the "API Key" button to view the API key. Record your API Key for use in subsequent configuration. + +## Step 5: Configure External Knowledge Base in LangBot + +### 5.1 Navigate to Knowledge Page + +In the LangBot WebUI, click "Knowledge" in the left navigation bar. + +### 5.2 Switch to External Knowledge Base Tab + +Click the "External" tab. + +### 5.3 Add External Knowledge Base + +Click the "+" button to open the add external knowledge base dialog. In this dialog, you need to: +1. **Knowledge Base Name**: Give the knowledge base a name +2. **Knowledge Base Description**: Add a description (optional) +3. **Retriever**: Select a knowledge retriever plugin + +**Note**: Using an external knowledge base requires installing the corresponding knowledge retriever plugin first. You can search for and install the Dify knowledge retriever plugin in the [plugin marketplace](https://space.langbot.app/market?category=KnowledgeRetriever). + +After installing the plugin, select the corresponding plugin from the Retriever dropdown, then fill in the configuration information obtained from Dify (API Endpoint, API Key, Dataset ID). + +## Step 6: Configure Pipeline + +After configuring the external knowledge base, you need to enable it in the pipeline: + +1. Navigate to the "Pipelines" page +2. Edit or create a new pipeline +3. On the "AI Capabilities" page, select "Built-in Agent" as the runner +4. In the knowledge base selection, check the external knowledge base you just configured +5. Save the pipeline configuration + +## Step 7: Test the Effect + +Test in the pipeline's "Conversation Testing" page, or bind the pipeline to a bot for actual conversation testing. When users ask questions, LangBot will automatically retrieve relevant content from the Dify knowledge base and generate answers combined with the retrieved knowledge. + +## Frequently Asked Questions + +### 1. How to Install Knowledge Retriever Plugins? + +Visit the [LangBot plugin marketplace](https://space.langbot.app/market), search for "Knowledge Retriever" or "Dify", find the corresponding plugin and click install. + +### 2. Which External Knowledge Retrieval Services Are Supported? + +LangBot currently supports multiple external knowledge retrieval services through the plugin system, including: +- Dify +- RAGFlow +- Other custom knowledge retrieval services + +Specific supported services can be viewed in the plugin marketplace. + +### 3. What's the Difference Between External and Built-in Knowledge Bases? + +- **Built-in Knowledge Base**: Data is stored locally in LangBot, with LangBot handling vectorization and retrieval +- **External Knowledge Base**: Data is stored in external services (like Dify), with retrieval performed through API calls + +The advantage of external knowledge bases is the ability to leverage the capabilities of professional LLMOps platforms, such as Dify's advanced document processing and multiple retrieval strategies. + +### 4. Can Multiple Knowledge Bases Be Used Simultaneously? + +Yes. In the pipeline configuration, you can check multiple knowledge bases (built-in or external) simultaneously, and LangBot will comprehensively utilize the content from these knowledge bases to generate answers. + +## Summary + +Through this tutorial, you learned how to: +1. Create a knowledge base and upload documents on the Dify platform +2. Obtain Dify API key and related configuration information +3. Configure a conversation model in LangBot +4. Add an external knowledge base in LangBot +5. Configure pipelines to use external knowledge bases + +The external knowledge base feature provides LangBot with more powerful and flexible knowledge management capabilities. Combined with professional LLMOps platforms like Dify, you can build more intelligent and professional conversational bots. + +## Related Resources + +- [LangBot Official Website](https://langbot.app) +- [LangBot Documentation](https://docs.langbot.app) +- [LangBot GitHub](https://github.com/langbot-app/LangBot) +- [Dify Official Website](https://dify.ai) +- [LangBot Plugin Marketplace](https://space.langbot.app/market) diff --git a/ja/articles/index.mdx b/ja/articles/index.mdx new file mode 100644 index 000000000..80401add0 --- /dev/null +++ b/ja/articles/index.mdx @@ -0,0 +1,30 @@ +--- +title: "LangBot 記事" +description: "LangBot Blog の製品アップデート、技術解説、チュートリアル、連携事例、お知らせをまとめています。" +--- + +LangBot Blog の製品アップデート、技術解説、チュートリアル、連携事例、お知らせをまとめています。 + +## 製品アップデート + +- [新しい LangBot Cloud が公開—オープンソース版もマルチユーザー Workspace に対応](/ja/articles/langbot-cloud-multi-user-workspaces) — 2026-08-25 + +## エンジニアリング + +- [LangBot v4.10.0:Agent Sandbox と Skills](/ja/articles/langbot-v4100-sandbox-skills) — 2026-06-04 +- [LangBot v4.9.0:完全プラグイン化された RAG アーキテクチャ](/ja/articles/langbot-v490-rag-plugin-architecture) — 2026-03-10 +- [LangBot プラグインシステム詳解:プロセス分離・イベント駆動・コンポーネント設計](/ja/articles/langbot-plugin-system-deep-dive) — 2026-02-23 + +## チュートリアルと連携 + +- [LangTARS:Dify・n8n と連携するオープンソース PC 操作 Agent](/ja/articles/langtars-remote-pc-control-dify-n8n) — 2026-03-23 +- [DeepSeek R1 を WeChat・Discord・Telegram に5分で接続する方法](/ja/articles/connect-deepseek-to-wechat) — 2026-02-21 +- [AI Bot を Discord・Telegram・WeChat に5分でデプロイ](/ja/articles/deploy-ai-bot-in-5-minutes) — 2026-02-17 +- [Dify Agent を Discord・Telegram・Slack で動かす](/ja/articles/dify-agent-discord-telegram-slack) — 2025-12-11 +- [Langflow のドラッグ&ドロップでマルチプラットフォーム AI Bot を構築](/ja/articles/langflow-drag-and-drop-ai-bot) — 2025-12-05 +- [n8n と LangBot でマルチプラットフォーム AI Chatbot を構築](/ja/articles/n8n-multi-platform-ai-chatbot) — 2025-12-03 +- [LangBot 4.6.0 外部ナレッジベース入門:Dify と連携した RAG 会話](/ja/articles/dify-langbot-rag-knowledge-base) — 2025-12-02 + +## お知らせ + +- [LangBot Blog のご紹介](/ja/articles/welcome) — 2026-02-17 diff --git a/ja/articles/langbot-cloud-multi-user-workspaces.mdx b/ja/articles/langbot-cloud-multi-user-workspaces.mdx new file mode 100644 index 000000000..3bfd1b4bf --- /dev/null +++ b/ja/articles/langbot-cloud-multi-user-workspaces.mdx @@ -0,0 +1,68 @@ +--- +title: "新しい LangBot Cloud が公開—オープンソース版もマルチユーザー Workspace に対応" +description: "LangBot は LLM とメッセージングアプリを接続するオープンソース AI Bot プラットフォームです。新しい Cloud とオープンソース版はマルチユーザー Workspace、招待、ロール権限に対応しました。" +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/ja/blog/langbot-cloud-multi-user-workspaces). + +公開日:2026-08-25 · 著者:LangBot Team + +![LangBot マルチユーザー Workspace ダッシュボード](/images/articles/source/images/cloud-multi-user/oss-dashboard.png) + +新しい [LangBot Cloud](https://cloud.langbot.app) を公開しました。今回まず整理したのは、複数人で LangBot を使うときに、誰がどのリソースへアクセスできるかという実務的な問題です。 + +同じマルチユーザーの基盤は、オープンソース版でも利用できます。Cloud とセルフホスト版では運用方法が異なりますが、メンバー、招待、権限の基本的な考え方は共通になりました。 + +## LangBot とは + +LangBot は、複数のメッセージングアプリで AI Bot を構築・運用するためのオープンソースプラットフォームです。1つのダッシュボードで Bot、メッセージ Pipeline、ナレッジベース、モデル、拡張機能を管理し、LINE、Slack、Discord、Telegram、QQ、WeChat、WeCom、Lark、DingTalk、KOOK に接続できます。Satori と Matrix にも対応し、Matrix ブリッジを使えば WhatsApp、Signal、Messenger、Mattermost、Google Chat、IRC、XMPP、Zulip などにも展開できます。 + +モデルは特定の事業者に限定されません。OpenAI、Anthropic Claude、DeepSeek、Google Gemini、xAI Grok、Moonshot Kimi、Zhipu GLM に接続でき、Ollama と LM Studio ではローカルモデルも利用できます。SiliconFlow、Alibaba Cloud Model Studio(百錬)、Volcengine Ark、ModelScope、GiteeAI などのゲートウェイに加え、Dify と MCP を使った既存の Agent ワークフローにも対応します。 + +チームは複数のチャットサービス上の AI アシスタントを1か所で管理し、用途に応じてクラウドモデル、ローカルモデル、既存の Agent ワークフローを使い分けられます。 + +![新しい LangBot Cloud のログイン画面](/images/articles/source/images/cloud-multi-user/cloud-login.png) + +## Cloud:自分の Workspace から始める + +LangBot Cloud は LangBot Account でログインします。初回利用時には個人用 Workspace が用意され、招待を受けてチームの Workspace に参加できます。複数の Workspace に所属している場合は、画面上で作業先を切り替えられます。 + +Bot、Pipeline、モデル、ナレッジベース、拡張機能は、現在選択している Workspace に属します。Workspace を切り替えても、別のチームの設定やデータが混ざることはありません。 + +ホスティング、更新、実行環境は引き続き Cloud 側が管理します。サーバーを保守せず、チームですぐに Bot の設定を始めたい場合に向いています。 + +## 管理者アカウントを共有せず、メンバーを招待 + +Owner、またはメンバー管理権限を持つロールは、一度だけ使える招待を発行できます。招待された人は自分のアカウントで参加し、割り当てられたロールで Workspace を利用します。 + +![Workspace 名を匿名化した LangBot Cloud の招待画面](/images/articles/source/images/cloud-multi-user/cloud-invitation.png) + +1つの管理者パスワードを共有するより、長期運用に適した形です。利用者ごとに独立した本人性があり、担当に合わせて権限を分けられます。 + +現在は5つの固定ロールを用意しています。 + +- **Owner**:Workspace の所有者。最上位の権限とメンバー管理を担当します。 +- **Admin**:メンバーと大部分の Workspace 設定を管理します。 +- **Developer**:Bot、Pipeline、モデル、拡張機能を設定します。 +- **Operator**:日常的な運用操作を担当します。 +- **Viewer**:読み取り専用で確認します。 + +## オープンソース版:1インスタンス、1 Workspace、複数ユーザー + +セルフホスト版がマルチ Workspace の SaaS になるわけではありません。1つの LangBot インスタンスは引き続き1つの Workspace に対応しますが、その Workspace に複数のユーザーを追加できます。 + +初期設定で作成したアカウントが Owner になります。その後、ほかのメンバーを招待できます。SMTP を設定している場合は招待メールを送信でき、メール設定がない場合は一度だけ表示される招待リンクを信頼できる手段で共有できます。 + +参加後に使うのは、これまでと同じ LangBot のダッシュボードです。異なる点は、ログインした全員を管理者として扱うのではなく、Workspace とロールの両方に基づいてアクセスを確認することです。 + +## どちらを選ぶべきか + +| | LangBot Cloud | オープンソース・セルフホスト版 | +|---|---|---| +| 導入と保守 | LangBot がホスト・保守 | サーバーとデータを自分で管理 | +| Workspace | 複数を所有・参加可能 | 1インスタンスにつき1つ | +| メンバーと招待 | 対応 | 対応 | +| 固定ロール権限 | 対応 | 対応 | +| 向いている用途 | チームですぐに使い始める | プライベート環境とインフラを自分で管理する | + +ホスト版を使う場合は [cloud.langbot.app](https://cloud.langbot.app) へ。実行環境とデータを自分のサーバーに置く場合は、[GitHub](https://github.com/langbot-app/LangBot) からオープンソース版を導入できます。 diff --git a/ja/articles/langbot-plugin-system-deep-dive.mdx b/ja/articles/langbot-plugin-system-deep-dive.mdx new file mode 100644 index 000000000..f9d31fe7d --- /dev/null +++ b/ja/articles/langbot-plugin-system-deep-dive.mdx @@ -0,0 +1,461 @@ +--- +title: "LangBot プラグインシステム詳解:プロセス分離・イベント駆動・コンポーネント設計" +description: "A source-level deep dive into LangBot 4.0's plugin architecture — process-isolated communication, event-driven hooks, a component-based extension model, and comparisons with Dify and MCP." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/langbot-plugin-system-deep-dive). + +公開日:2026-02-23 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot Plugin System](/images/articles/source/images/covers/plugin-system.png) + +Most chatbot frameworks call their "plugin system" a glorified dynamic import of Python modules. LangBot 4.0 takes a harder but more principled approach — **every plugin runs in its own process**, communicating with the host through a structured JSON-RPC-style protocol. + +This article dissects the system from source code, end to end. + +## Overall Architecture: A Three-Layer Process Model + +LangBot's plugin system consists of three cooperating process layers: + +![LangBot Plugin System Architecture](/images/articles/source/images/plugin-system/architecture.png) + +**Each layer has a distinct responsibility:** + +1. **LangBot Main Process**: Runs business logic (message pipelines, platform adapters, model invocations), connects to Runtime via `PluginRuntimeConnector`. +2. **Plugin Runtime**: The orchestration layer — discovers, launches, and manages all plugin subprocesses, routes requests from the main process to the appropriate plugin. +3. **Plugin Subprocesses**: Each plugin runs in its own Python process, communicating with Runtime via stdio pipes. + +### Why Three Layers Instead of Two? + +The intuitive design would have the main process manage plugin processes directly. LangBot adds the Runtime layer for **deployment flexibility**: + +- **Local development**: Main process spawns Runtime as a child via stdio (zero config) +- **Docker production**: Runtime runs as a separate container, connected via WebSocket +- **Windows compatibility**: Since Windows asyncio has incomplete stdio subprocess support, it automatically falls back to WebSocket + +The same codebase — no config changes — adapts from development to production. + +## Communication Protocol: JSON-RPC-Style Request/Response + +All cross-process communication runs on a unified protocol layer. The core data structures are minimal: + +```python +# Request +class ActionRequest(pydantic.BaseModel): + seq_id: int # Sequence number for matching request/response + action: str # Action name + data: dict # Payload + +# Response +class ActionResponse(pydantic.BaseModel): + seq_id: int + code: int # 0 = success + message: str + data: dict + chunk_status: str # "continue" | "end" (streaming support) +``` + +The `Handler` class is the system's core abstraction, acting as both RPC client and server: + +```python +class Handler: + async def call_action(self, action, data, timeout=15.0) -> dict: + """Actively call an action provided by the peer, wait for response""" + self.seq_id_index += 1 + request = ActionRequest.make_request(self.seq_id_index, action.value, data) + future = asyncio.Future() + self.resp_waiters[self.seq_id_index] = future + await self.conn.send(json.dumps(request.model_dump())) + response = await asyncio.wait_for(future, timeout) + return response.data + + @action(SomeAction.DO_SOMETHING) + async def handle_something(data: dict) -> ActionResponse: + """Register an action for the peer to call""" + return ActionResponse.success({"result": "ok"}) +``` + +**Key design points:** + +- `seq_id`-based request/response matching enables full-duplex concurrent calls +- Streaming responses via `chunk_status` for long-running operations like command execution +- Large messages auto-chunk (stdio: 16KB / WebSocket: 64KB per chunk) +- File transfer uses a separate base64 chunking mechanism + +### Action Enums: Clear API Contracts + +The system defines all cross-process calls through four enum groups: + +```python +# Plugin → Runtime (plugin-initiated requests) +class PluginToRuntimeAction: + REGISTER_PLUGIN = "register_plugin" + SEND_MESSAGE = "send_message" # Send message to a platform + INVOKE_LLM = "invoke_llm" # Call an LLM + SET_PLUGIN_STORAGE = "set_plugin_storage" # Persistent storage + # ... + +# Runtime → Plugin (runtime-dispatched commands) +class RuntimeToPluginAction: + INITIALIZE_PLUGIN = "initialize_plugin" + EMIT_EVENT = "emit_event" + CALL_TOOL = "call_tool" + EXECUTE_COMMAND = "execute_command" + SHUTDOWN = "shutdown" + # ... + +# LangBot Main → Runtime +class LangBotToRuntimeAction: + INSTALL_PLUGIN = "install_plugin" + EMIT_EVENT = "emit_event" + LIST_TOOLS = "list_tools" + # ... + +# Runtime → LangBot Main +class RuntimeToLangBotAction: + GET_PLUGIN_SETTINGS = "get_plugin_settings" + SET_BINARY_STORAGE = "set_binary_storage" + # ... +``` + +This makes API boundaries crystal clear — what a plugin can and cannot do is defined entirely by these enums. + +## Plugin Lifecycle + +A plugin goes through these stages from installation to execution: + +### 1. Discovery + +On startup, Runtime scans the `data/plugins/` directory: + +```python +async def launch_all_plugins(self): + for plugin_path in glob.glob("data/plugins/*"): + if not os.path.isdir(plugin_path): + continue + task = self.launch_plugin(plugin_path) + self.plugin_run_tasks.append(task) +``` + +Directory names follow the `{author}__{name}` convention, each containing a `manifest.yaml` and plugin code. + +### 2. Launch + +Runtime spawns an independent subprocess for each plugin: + +```python +async def launch_plugin(self, plugin_path: str): + python_path = sys.executable + args = ["-m", "langbot_plugin.cli.__init__", "run", "-s", "--prod"] + + ctrl = StdioClientController( + command=python_path, + args=args, + working_dir=plugin_path, # Each plugin runs in its own directory + ) + await ctrl.run(new_plugin_connection_callback) +``` + +**Key detail**: The subprocess working directory is set to the plugin's own directory — natural filesystem isolation. + +### 3. Registration + +After starting, the plugin process actively registers itself with Runtime: + +```python +# Runtime-side registration handler +async def register_plugin(self, handler, container_data, debug_plugin=False): + plugin_container = PluginContainer.from_dict(container_data) + # Fetch plugin settings from the main process + plugin_settings = await self.context.control_handler.call_action( + RuntimeToLangBotAction.GET_PLUGIN_SETTINGS, {...} + ) + # Initialize the plugin (send config) + await handler.initialize_plugin(plugin_settings) + # Store the plugin container + self.plugins.append(plugin_container) +``` + +### 4. Running + +Once in `INITIALIZED` state, the plugin can receive events, tool calls, and command executions. + +### 5. Shutdown + +```python +async def shutdown_plugin(self, plugin_container): + # 1. Notify the plugin to shut down gracefully + await plugin_container._runtime_plugin_handler.shutdown_plugin() + # 2. Close the communication connection + await plugin_container._runtime_plugin_handler.conn.close() + # 3. Kill the subprocess + if handler.stdio_process is not None: + handler.stdio_process.kill() + await asyncio.wait_for(handler.stdio_process.wait(), timeout=2) +``` + +## Component System: Four Extension Types + +A LangBot plugin isn't a single hook function — it's a **component container**. A single plugin can provide multiple component types simultaneously: + +### EventListener + +The most fundamental extension — listen for events in the message pipeline: + +```python +from langbot_plugin.api.definition.components.common.event_listener import EventListener +from langbot_plugin.api.entities.events import PersonNormalMessageReceived +from langbot_plugin.api.entities.context import EventContext + +class MyListener(EventListener): + @EventListener.handler(PersonNormalMessageReceived) + async def on_person_message(self, ctx: EventContext): + event = ctx.event + # Modify the user message before it reaches the LLM + event.user_message_alter = "Answer in poetry: " + event.text_message + + # Or block further processing + # ctx.prevent_default() + # ctx.prevent_postorder() +``` + +Supported events cover the full message lifecycle: + +| Event | Trigger | +|-------|---------| +| `PersonMessageReceived` | Any private message received | +| `GroupMessageReceived` | Any group message received | +| `PersonNormalMessageReceived` | Private message deemed processable | +| `GroupNormalMessageReceived` | Group message deemed processable | +| `NormalMessageResponded` | LLM response completed | +| `PromptPreProcessing` | Prompt preprocessing stage | + +Event propagation supports two interruption modes: +- `prevent_default()`: Skip default behavior (e.g., skip the LLM call) +- `prevent_postorder()`: Stop subsequent plugins from running + +### Tool + +Tools for LLM Function Calling: + +```python +from langbot_plugin.api.definition.components.tool.tool import Tool + +class WeatherTool(Tool): + async def call(self, params: dict, session, query_id: int) -> str: + city = params.get("city", "Beijing") + # Call weather API... + return f"{city}: Sunny, 25°C" +``` + +Tool metadata (name, description, parameter schema) is defined in a companion YAML manifest file. LangBot automatically converts this into the Function definition that LLMs understand. + +### Command + +User-triggered commands via `!command`, with subcommand support: + +```python +from langbot_plugin.api.definition.components.command.command import Command + +class MyCommand(Command): + def __init__(self): + super().__init__() + + @self.subcommand("hello", help="Say hello") + async def hello(self, ctx): + yield CommandReturn(text="Hello from plugin!") + + @self.subcommand("status", help="Show status") + async def status(self, ctx): + yield CommandReturn(text="All systems operational.") +``` + +Command results are returned via `AsyncGenerator`, providing natural streaming output. + +### KnowledgeRetriever + +A multi-instance component for connecting external knowledge bases: + +```python +from langbot_plugin.api.definition.components.knowledge_retriever.retriever import KnowledgeRetriever + +class MyRetriever(KnowledgeRetriever): + async def retrieve(self, context) -> list: + results = await self.search_external_db(context.query) + return [RetrievalResultEntry(content=r) for r in results] +``` + +KnowledgeRetriever is a **polymorphic component** — a single retriever class can spawn multiple instances, each with independent configuration. This allows users to connect multiple different external knowledge bases. + +## SDK API: What Plugins Can Do + +Plugins gain rich capabilities through the `LangBotAPIProxy` inherited by `BasePlugin`: + +```python +class LangBotAPIProxy: + # Message operations + async def send_message(self, bot_uuid, target_type, target_id, message_chain) + + # Model invocation + async def get_llm_models(self) -> list[str] + async def invoke_llm(self, model_uuid, messages, funcs=[], extra_args={}) + + # Persistent storage (plugin-level isolation) + async def set_plugin_storage(self, key, value: bytes) + async def get_plugin_storage(self, key) -> bytes + + # Workspace storage (cross-plugin shared) + async def set_workspace_storage(self, key, value: bytes) + async def get_workspace_storage(self, key) -> bytes + + # System info + async def get_langbot_version(self) -> str + async def get_bots(self) -> list[str] + async def list_plugins_manifest(self) -> list +``` + +**The storage API design is worth noting**: Two levels of KV storage — `plugin_storage` (plugin-private) and `workspace_storage` (globally shared), storing data as bytes (base64-serialized in transit). Simple but flexible enough. + +## Event Dispatch Mechanism + +The complete path from main process to plugin: + +![Event Dispatch Flow](/images/articles/source/images/plugin-system/event-dispatch.png) + +Key source code: + +```python +async def emit_event(self, event_context, include_plugins=None): + for plugin in self.plugins: + if plugin.status != RuntimeContainerStatus.INITIALIZED: + continue + if not plugin.enabled: + continue + + # Pipeline-level plugin filtering + if include_plugins is not None: + plugin_id = f"{plugin.manifest.metadata.author}/{plugin.manifest.metadata.name}" + if plugin_id not in include_plugins: + continue + + resp = await plugin._runtime_plugin_handler.emit_event( + event_context.model_dump() + ) + + event_context = EventContext.model_validate(resp["event_context"]) + + # Plugin requested propagation stop + if event_context.is_prevented_postorder(): + break + + return emitted_plugins, event_context +``` + +The `include_plugins` parameter enables **pipeline-level plugin binding** — different message processing pipelines can use different subsets of plugins. + +## Installation & Distribution + +Plugins support three installation sources: + +1. **Local upload**: `.lbpkg` files (actually zip archives containing manifest.yaml and code) +2. **Marketplace**: Install from LangBot Space online +3. **GitHub Release**: Download from a GitHub repository's Release assets + +The installation flow: + +```python +async def install_plugin(self, source, install_info): + yield {"current_action": "downloading plugin package"} + # 1. Fetch and extract the plugin package (unzip) + plugin_path, author, name, version = await self.install_plugin_from_file(plugin_file) + + yield {"current_action": "installing dependencies"} + # 2. Install dependencies (pip install -r requirements.txt) + pkgmgr_helper.install_requirements(requirements_file) + + yield {"current_action": "initializing plugin settings"} + # 3. Initialize configuration + await self.context.control_handler.call_action( + RuntimeToLangBotAction.INITIALIZE_PLUGIN_SETTINGS, {...} + ) + + yield {"current_action": "launching plugin"} + # 4. Launch the plugin process + task = self.launch_plugin(plugin_path) +``` + +The entire process reports progress via `AsyncGenerator`, enabling real-time installation status in the frontend. + +## Developer Experience + +The SDK provides a complete developer toolchain: + +```bash +# Initialize a new plugin +lbp init + +# Add a component +lbp component add + +# Run locally for debugging +lbp run + +# Package for publication +lbp publish +``` + +**Debug mode** has a particularly clever design: the developer's plugin connects to the running Runtime via WebSocket (instead of stdio), meaning you can hot-reload plugin code without restarting LangBot. Debug plugins are specially marked in the UI and protected from accidental deletion. + +## Comparisons with Other Systems + +### vs Dify Plugins + +Dify's plugin system (`dify-plugin-daemon`) shares the process isolation philosophy with LangBot, but the focus differs: + +- **Dify**: Plugins extend workflow node types (Tool, Model, Extension) — designed for AI application orchestration +- **LangBot**: Plugins extend the message processing pipeline (Event, Tool, Command, KnowledgeRetriever) — designed for instant messaging scenarios + +LangBot's `EventListener` component provides a capability Dify lacks — injecting logic at any stage of message processing. + +### vs MCP (Model Context Protocol) + +MCP is a standardized protocol for AI tool invocation. LangBot's Tool component and MCP services overlap functionally, but serve different purposes: + +- **MCP**: A universal "AI calls external capabilities" protocol, usable by any LLM application +- **LangBot Tool**: Deeply integrated with message processing context, with access to session info, user identity, etc. + +In practice, LangBot natively supports MCP — users can configure MCP servers directly in LangBot without writing plugins. LangBot's Tool component is for scenarios requiring access to LangBot's internal context. + +## Design Decisions Explained + +**Why process isolation instead of threads/coroutines?** + +- Plugin code quality is unpredictable; a segfault shouldn't crash the entire service +- Dependency isolation: different plugins may depend on different versions of the same library +- Resource control: you can set per-plugin process resource limits + +**Why JSON instead of Protobuf/MessagePack?** + +- Debug-friendly: developers can directly read communication logs +- Natively supported in Python, no extra dependencies +- The performance bottleneck isn't serialization (plugin call frequency is far below database queries) + +**Why stdio over WebSocket by default?** + +- stdio requires no network stack — lower latency +- Simpler process lifecycle management (child processes auto-cleanup when parent exits) +- WebSocket is only used where stdio isn't supported (Docker, Windows) + +## Conclusion + +LangBot's plugin system is a **production-grade, process-isolated, event-driven component framework for extensibility**. + +Its core design principles: +1. **Safety first**: Process isolation ensures plugins can't destabilize the main service +2. **Deployment flexibility**: Dual stdio/WebSocket modes adapt to all environments +3. **Developer-friendly**: Complete SDK, CLI, and debug support +4. **Component-based**: Four component types cover the major extension needs + +If you're interested in developing LangBot plugins, start with the [plugin development docs](https://docs.langbot.app/en/plugin/dev/tutor), or browse existing plugins on the [marketplace](https://space.langbot.app/market) for inspiration. diff --git a/ja/articles/langbot-v4100-sandbox-skills.mdx b/ja/articles/langbot-v4100-sandbox-skills.mdx new file mode 100644 index 000000000..06f730276 --- /dev/null +++ b/ja/articles/langbot-v4100-sandbox-skills.mdx @@ -0,0 +1,115 @@ +--- +title: "LangBot v4.10.0:Agent Sandbox と Skills" +description: "LangBot v4.10.0 brings a real sandbox (Box Runtime) and an on-demand Skills system to the built-in Agent. It can now run commands and edit files in an isolated environment, and pull in specialized know-how exactly when a task needs it." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/langbot-v4100-sandbox-skills). + +公開日:2026-06-04 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot v4.10.0 Agentic Sandbox & Skills](/images/articles/source/images/covers/sandbox-skills.png) + +LangBot v4.10.0 is our biggest Agent update yet. It ships two features that point in the same direction — **letting the built-in Agent work like a real developer**: + +1. **Sandbox**: the Agent now runs in a genuinely isolated environment where it can execute commands and work with files. +2. **Skills**: the Agent can load specialized know-how on demand, instead of cramming everything into its context. + +Both capabilities were led by community contributor [@huanghuoguoguo](https://github.com/huanghuoguoguo). Let's dig in. + +> **New to LangBot?** [LangBot](https://github.com/langbot-app/LangBot) is an open-source LLM bot platform (15k+ GitHub stars) that lets you deploy AI chatbots across **Discord, Telegram, WeChat (个人微信 / 企业微信), Slack, Lark (Feishu), DingTalk, QQ** and more — all from a single instance. It connects 20+ large language models (OpenAI GPT, Anthropic Claude, Google Gemini, DeepSeek, and others) to 13+ messaging platforms, with built-in Agent, RAG knowledge bases, MCP support, and a plugin ecosystem. You can self-host it with one Docker command or run it managed on [LangBot Cloud](https://space.langbot.app/cloud). + +## 📦 Sandbox: a real workspace for your Agent + +Until now, LangBot's built-in Agent could only call predefined tools. It couldn't "open a terminal and run a command," nor "write an intermediate result to a file and read it back later" — which is exactly what human developers do all day. + +v4.10.0 introduces the new **Box Runtime**. It gives the Agent an isolated sandbox environment with six native tools built in: + +| Tool | Purpose | +|------|---------| +| `exec` | Run shell commands | +| `read` | Read file contents | +| `write` | Write files | +| `edit` | Make targeted edits to files | +| `glob` | Find files by pattern | +| `grep` | Search inside file contents | + +With this toolkit, the Agent can work like a developer: run a script, save the output to a file, read it back to analyze, and post-process the result. All of it happens inside an isolated environment that never touches the host. + +![LangBot sandbox in action](/images/articles/source/images/sandbox-skills/sandbox.png) + +### Pluggable backends + +The sandbox's execution backend is **pluggable**, and LangBot selects one automatically based on your deployment: + +- **Docker**: spins up a dedicated `langbot_box` container that talks to the main process over WebSocket. Great for containerized deployments. +- **nsjail**: lightweight isolation based on Linux namespaces, no extra container needed. Great for bare-metal or single-container setups. +- **E2B**: cloud sandbox that runs execution in a remote isolated environment. + +You don't have to pick manually — `box.enabled` is the master switch. Once on, LangBot probes for the most suitable backend and degrades gracefully if probing fails. + +![Sandbox native tools](/images/articles/source/images/sandbox-skills/sandbox-tools.png) + +### It also hosts MCP Servers + +Beyond native tools, the Box Runtime takes on another important job: **hosting stdio-mode MCP Servers**. + +Previously, stdio-mode MCP Servers had to be spawned as subprocesses directly inside the main process — neither safe nor easy to manage. Now they all run inside the sandbox, sharing the same isolation boundary as the Agent's execution environment. `http` / `sse` mode MCP is unaffected and works as before. + +## 🎯 Skills: know-how, loaded on demand + +The second big update is **Skills**. + +As the Agent's capabilities grow, an old problem surfaces: **the context window is finite**. If you stuff every possible instruction, procedure, and reference doc into the system prompt, the context fills up fast — and most of it is irrelevant to the task at hand. + +The design idea behind Skills is simple: **keep the table of contents in view, and open the book only when you need it.** + +A Skill is an **on-demand instruction pack** containing: + +- **A prompt**: tells the Agent what the skill does and when to use it +- **A procedure**: the steps to accomplish a class of tasks +- **Scripts**: ready-to-run helper scripts +- **Reference files**: API docs, templates, examples, and so on + +By default the Agent only sees a **list of available skills** (name + summary), which costs almost nothing in context. When it decides a task needs a particular skill, it pulls the full content just in time via the `activate` action. + +![LangBot Skills system](/images/articles/source/images/sandbox-skills/skills.png) + +The benefits are clear: + +1. **Lean context**: irrelevant skill content never takes up the window. +2. **Extensible capabilities**: want to teach the Agent a new trick? Write a skill pack — no core code changes. +3. **Instant effect**: skills load dynamically during execution, no restart required. + +If you've used Claude's Skills or a similar mechanism, this pattern will feel familiar — it decouples "what the Agent knows" from "what the Agent needs right now." + +## 🧩 Shipped early across 4.9.x + +These were planned for v4.10.0 but shipped early in the 4.9.x line: + +- **Plugin Extension Pages**: plugins can render custom UI via iframe + a Page SDK ([@TyperBody](https://github.com/TyperBody), #2107) +- **Monitoring**: feedback linked to message IDs, plus feedback export ([@6mvp6](https://github.com/6mvp6), #2120) +- **Security hardening**: path-traversal fixes and removal of an authenticated RCE endpoint ([@sebastiondev](https://github.com/sebastiondev), #2087 / #2178) + +## 🚀 Getting started + +The sandbox needs an execution backend, depending on how you deploy: + +- **Docker**: run `docker compose --profile all up`, which also launches the `langbot_box` container. +- **Manual / `uvx`**: runs as a stdio subprocess automatically, nothing to do. +- **LangBot Cloud**: ready out of the box — the sandbox is already set up for you, nothing to install. + +To turn the sandbox off, set `box.enabled: false` — built-in tools, Skill create/edit, and stdio-mode MCP are all disabled; `http` / `sse` mode MCP is unaffected. See the [Sandbox docs](https://docs.langbot.app/en/usage/sandbox/readme) for details. + +This release also upgrades the plugin SDK to **`langbot-plugin 0.4.1`**. + +## Closing thoughts + +Sandbox and Skills are, at their core, answering the same question: **how do we let an Agent handle genuinely complex, open-ended tasks?** + +The sandbox solves the "**hands**" problem — giving the Agent the ability to execute and room to experiment. Skills solve the "**brain**" problem — letting the Agent reach for the right knowledge at the right moment, without drowning in irrelevant information. + +The fastest way to try it is to spin up a managed instance on [LangBot Cloud](https://space.langbot.app/cloud), where the sandbox is ready to go. You can also read the [full release notes](https://github.com/langbot-app/LangBot/releases/tag/v4.10.0) for every change. + +Thank you to everyone building with LangBot. We'll keep making the cloud Agent experience more stable and more capable. diff --git a/ja/articles/langbot-v490-rag-plugin-architecture.mdx b/ja/articles/langbot-v490-rag-plugin-architecture.mdx new file mode 100644 index 000000000..4d9111485 --- /dev/null +++ b/ja/articles/langbot-v490-rag-plugin-architecture.mdx @@ -0,0 +1,295 @@ +--- +title: "LangBot v4.9.0:完全プラグイン化された RAG アーキテクチャ" +description: "LangBot v4.9.0 refactors the entire knowledge base system from a built-in implementation to a plugin-driven architecture, introducing KnowledgeEngine and Parser component types for boundless extensibility." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/langbot-v490-rag-plugin-architecture). + +公開日:2026-03-10 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot v4.9.0 RAG Plugin Architecture](/images/articles/source/images/covers/rag-plugin.png) + +LangBot v4.9.0, codenamed **"Knowledge Without Borders,"** does exactly what the name says: **the entire knowledge base capability has been refactored from a built-in implementation to a plugin-driven architecture.** + +This isn't a minor tweak — it redefines what "knowledge" means in LangBot. + +## The Problem with the Old Approach + +Before v4.9.0, LangBot's knowledge base was split into two separate systems: + +- **Built-in Knowledge Base**: Used Chroma as the vector database, with embedding models managed by LangBot directly. Document parsing, chunking, and indexing were all hardcoded. +- **External Knowledge Base**: Bridged services like Dify, RAGFlow, and FastGPT through the `KnowledgeRetriever` plugin component — retrieval only, no document ingestion. + +These two systems lived behind separate UI tabs, with completely different data models and management flows. + +**Why this was painful:** + +1. **Poor extensibility**: Want a different vector database? A custom chunking strategy? Sorry, that's hardcoded. +2. **High maintenance cost**: Every RAG improvement required changes to LangBot's core code and a new release. +3. **Fragmented UX**: Two completely different knowledge base management flows meant a steep learning curve. + +v4.9.0 solves this decisively: **extract RAG capabilities from LangBot's core and hand them to plugins.** + +## What Changed + +### 1. Unified Knowledge Base Model + +The `internal` / `external` distinction is gone. All knowledge bases are managed through a single interface, differentiated only by their `rag_engine_plugin_id`. One list, one creation flow — just pick your engine. + +### 2. KnowledgeEngine Component + +This is the headline addition. `KnowledgeEngine` replaces the old `KnowledgeRetriever` and takes ownership of the full knowledge base lifecycle: + +- **Document Ingestion**: The complete pipeline from file parsing to vector indexing +- **Knowledge Retrieval**: Returning relevant chunks at query time +- **Document Deletion**: Cleaning up documents and their associated vector data +- **Lifecycle Hooks**: Callbacks when knowledge bases are created or deleted + +A KnowledgeEngine plugin has full control over indexing and retrieval strategies — not just retrieval. + +![Knowledge Engine plugins in the Marketplace](/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png) + +### 3. Parser Component + +Document parsing has been extracted into its own plugin component type. A Parser converts binary files (PDF, Word, Markdown, etc.) into structured text, which is then handed to the RAG engine for chunking and indexing. + +**The data flow:** + +![Data flow: Parser → KnowledgeEngine](/images/articles/source/images/rag-plugin/data-flow.png) + +If a RAG engine declares `DOC_PARSING` capability, it can handle parsing internally and skip the external Parser. + +### 4. Host RAG API + +LangBot's core no longer executes RAG operations directly, but it still provides essential infrastructure through `RAGRuntimeService`, accessible to plugins via RPC: + +- **Embedding invocation**: `invoke_embedding()` — plugins don't need to manage model connections +- **Vector database operations**: `vector_upsert()` / `vector_search()` / `vector_delete()` +- **File access**: `get_knowledge_file_stream()` — read raw files from storage + +This means plugins can focus on RAG strategy (chunking algorithms, retrieval logic, re-ranking) while the host handles the "heavy" operations like vector storage and embedding models. + +### 5. KnowledgeRetriever Deprecated + +The old `KnowledgeRetriever` component has been removed. If you had external knowledge base plugins, they'll need to migrate to `KnowledgeEngine`. The good news: the new API is cleaner and migration is straightforward. + +## Building a RAG Engine Plugin + +### Scaffold the Component + +```bash +lbp comp KnowledgeEngine +``` + +This generates the directory structure: + +![Plugin directory structure](/images/articles/source/images/rag-plugin/dir-structure.png) + +### Define Configuration Schemas + +The YAML manifest defines two configuration schemas: + +- **`creation_schema`**: Parameters filled when creating a knowledge base (e.g., chunk size, embedding model) +- **`retrieval_schema`**: Parameters adjustable at retrieval time (e.g., score threshold, top-K) + +```yaml +spec: + creation_schema: + - name: chunk_size + label: + en_US: Chunk Size + type: integer + default: 500 + - name: chunk_overlap + label: + en_US: Chunk Overlap + type: integer + default: 50 + retrieval_schema: + - name: score_threshold + label: + en_US: Score Threshold + type: float + default: 0.5 +``` + +LangBot **dynamically renders** creation and retrieval forms based on these schemas — different engines show different configuration fields. + +### Declare Capabilities + +```python +class SimpleRag(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [ + KnowledgeEngineCapability.DOC_INGESTION, # Supports document upload + # KnowledgeEngineCapability.DOC_PARSING, # Optional: built-in parsing + ] +``` + +| Capability | Description | +|------------|-------------| +| `DOC_INGESTION` | Supports document upload and processing. UI shows "Documents" tab | +| `DOC_PARSING` | Supports built-in document parsing. Without this, an external Parser plugin is required | + +### Implement Core Methods + +The three essential methods: + +**Document Ingestion:** + +```python +async def ingest(self, context: IngestionContext) -> IngestionResult: + # 1. Get file content (or use Parser's pre-parsed result) + if context.parsed_content: + text = context.parsed_content.text + else: + file_bytes = await self.plugin.get_knowledge_file_stream( + context.file_object.storage_path + ) + text = file_bytes.decode('utf-8') + + # 2. Chunk the text + chunks = self._split_text(text, chunk_size=500) + + # 3. Call host embedding model + vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, chunks + ) + + # 4. Write to host vector database + await self.plugin.vector_upsert( + collection_id, vectors, ids, metadata + ) + + return IngestionResult( + document_id=context.file_object.metadata.document_id, + status=DocumentStatus.COMPLETED, + chunks_created=len(chunks), + ) +``` + +**Knowledge Retrieval:** + +```python +async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # 1. Generate query vector + query_vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, [context.query] + ) + + # 2. Vector search + results = await self.plugin.vector_search( + collection_id, query_vectors[0], top_k=5 + ) + + # 3. Convert and return + return RetrievalResponse(results=entries, total_found=len(entries)) +``` + +**Document Deletion:** + +```python +async def delete_document(self, kb_id: str, document_id: str) -> bool: + deleted = await self.plugin.vector_delete( + collection_id=kb_id, file_ids=[document_id] + ) + return deleted > 0 +``` + +### Bridging External Services + +If your goal is to bridge Dify, RAGFlow, FastGPT, or other external services rather than building a custom RAG pipeline, the implementation is even simpler — **don't declare `DOC_INGESTION` capability** and only implement `retrieve`: + +```python +class DifyRAGEngine(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [] # No document upload — managed externally + + async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # Call Dify/RAGFlow/FastGPT retrieval API + ... +``` + +The knowledge base won't show a "Documents" tab — all content management happens in the external service. + +## Building a Parser Plugin + +Parser development is even more concise: + +```bash +lbp comp Parser +``` + +Declare supported MIME types in the manifest: + +```yaml +spec: + supported_mime_types: + - application/pdf + - application/vnd.openxmlformats-officedocument.wordprocessingml.document +``` + +Implement the `parse` method: + +```python +class PdfParser(Parser): + + async def parse(self, context: ParseContext) -> ParseResult: + # context.file_content: raw file bytes + # context.mime_type: detected MIME type + # context.filename: original filename + + text = extract_text_from_pdf(context.file_content) + + return ParseResult( + text=text, + sections=[ + TextSection(content=page_text, heading=f"Page {i}", page=i) + for i, page_text in enumerate(pages) + ], + ) +``` + +Parsers also support **cross-plugin invocation** — a RAG engine plugin can call another plugin's Parser: + +```python +result = await self.plugin.invoke_parser( + plugin_author="author_name", + plugin_name="plugin_name", + storage_path=context.file_object.storage_path, + mime_type=context.file_object.metadata.mime_type, + filename=context.file_object.metadata.filename, +) +``` + +## Upgrade Notes + +- Knowledge bases created in previous versions are **automatically migrated**. After updating, visit the Knowledge Base page to verify. +- The `KnowledgeRetriever` component is deprecated. Existing plugins need to migrate to `KnowledgeEngine`. +- Browse the [Plugin Marketplace](https://space.langbot.app/market?category=KnowledgeEngine) for available RAG engine plugins. + +## The Bigger Picture + +v4.9.0's knowledge base refactoring is the latest step in LangBot's plugin-first evolution. From event handlers and tools in v4.0, to knowledge retrievers, to now full RAG engines and parsers — LangBot's core capabilities are progressively moving from "built-in" to "pluggable." + +The endgame: **LangBot's core provides pipeline orchestration and infrastructure; all business capabilities are plugin-driven.** + +Custom chunking strategy? Write a KnowledgeEngine plugin. PDF parsing? Write a Parser plugin. Bridge your company's internal knowledge service? Also a plugin. + +Knowledge, without borders. + +--- + +**Links:** + +- [v4.9.0 Release Notes](https://github.com/langbot-app/LangBot/releases/tag/v4.9.0) +- [KnowledgeEngine Development Guide](https://docs.langbot.app/en/plugin/dev/components/knowledge-engine) +- [Parser Development Guide](https://docs.langbot.app/en/plugin/dev/components/parser) +- [Plugin Marketplace](https://space.langbot.app/market) +- [LangBot Cloud](https://space.langbot.app/cloud) diff --git a/ja/articles/langflow-drag-and-drop-ai-bot.mdx b/ja/articles/langflow-drag-and-drop-ai-bot.mdx new file mode 100644 index 000000000..d5de0a8c3 --- /dev/null +++ b/ja/articles/langflow-drag-and-drop-ai-bot.mdx @@ -0,0 +1,209 @@ +--- +title: "Langflow のドラッグ&ドロップでマルチプラットフォーム AI Bot を構築" +description: "How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows" +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/langflow-drag-and-drop-ai-bot). + +公開日:2025-12-05 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![How I Built a Multi-Platform AI Bot with Langflow's Drag-and-Drop Workflows](/images/articles/source/images/covers/langflow.png) + +Drive chatbots across QQ, WeChat, Telegram, Discord, and more using visual workflows - no coding required. + +--- + +[LangBot](https://github.com/langbot-app/LangBot) is an open-source instant messaging bot platform that connects AI workflow engines like Langflow, n8n, Dify, FastGPT, and Coze to platforms including WeChat, QQ, Feishu, DingTalk, Telegram, Discord, Slack, and LINE. This tutorial demonstrates how to use Langflow's visual workflows as LangBot's conversation engine. + +## Why This Approach Works + +- **True Multi-Platform**: One workflow powering 8+ messaging platforms simultaneously +- **Visual Orchestration**: Drag-and-drop conversation design with conditional branches, multi-turn dialogs, and external API calls +- **Flexible AI Models**: Support for OpenAI, Claude, Gemini, DeepSeek, and local models +- **Fully Open Source**: Both LangBot and Langflow are open-source projects for free deployment and customization + +## Prerequisites + +- Python 3.10+ +- Docker (recommended for quick deployment) +- OpenAI API Key or API keys for other LLM services + +## Step 1: Deploy LangBot + +Launch with uvx in one command: + +```bash +uvx langbot +``` + +First run auto-initializes and opens your browser to http://127.0.0.1:5300. + +![LangBot Initial Page](/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png) + +After registration, log in to access the dashboard: + +![LangBot Dashboard](/images/articles/external/b93d97b5b830-04-langbot-dashboard.png) + +## Step 2: Deploy Langflow + +Deploy quickly with Docker: + +```bash +docker run -d --name langflow -p 7860:7860 langflowai/langflow:latest +``` + +Visit http://localhost:7860 to access Langflow: + +![Langflow Welcome Page](/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png) + +## Step 3: Create a Langflow Workflow + +In Langflow, select the "Basic Prompting" template to get started quickly: + +![Langflow Template Selection](/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png) + +This template includes four basic components: +- **Chat Input**: Receives user messages +- **Prompt**: Sets system instructions +- **Language Model**: Calls LLM to generate responses +- **Chat Output**: Returns results + +![Langflow Workflow Editor](/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png) + +### Configure Language Model + +Click the Language Model component and configure: + +1. **Model Provider**: Select OpenAI (or other compatible providers like SiliconFlow, New API) +2. **Model Name**: Select gpt-4o-mini or deepseek-chat +3. **OpenAI API Key**: Enter your API Key + +![Langflow OpenAI API Key Configured](/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png) + +> Tip: You can use OpenAI-compatible API services like SiliconFlow or New API by simply modifying the Base URL. + +Save the workflow after configuration. + +## Step 4: Get Langflow API Information + +### Generate API Key + +In Langflow's upper right: Settings → API Keys, navigate to the API Keys page: + +![Langflow API Keys Page](/images/articles/external/21fc47358066-05-langflow-api-keys-page.png) + +Click Create New Key: + +![Langflow Create API Key Dialog](/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png) + +Generate and save the API Key: + +![Langflow API Key Generated](/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png) + +Format: `sk-xxxxxxxxxxxxxxxxxxxxxxxx` + +### Get Flow ID + +Extract from the flow editor's URL: + +``` +http://localhost:7860/flow/{flow-id} +``` + +Record this `flow-id`. + +## Step 5: Configure Langflow in LangBot + +Return to LangBot dashboard and go to **Pipelines** page. + +Click ChatPipeline to edit, in the AI tab: + +![LangBot Pipeline AI Tab](/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png) + +Configure **Runner**, select **Langflow API**: + +![LangBot Runner Dropdown](/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png) + +Fill in the Langflow configuration: + +![LangBot Langflow Config Form](/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png) + +Configuration items: +- **Base URL**: `http://localhost:7860` (local) or `http://langflow:7860` (Docker network) +- **API Key**: The API Key generated in Langflow +- **Flow ID**: The Flow ID recorded earlier + +![LangBot Langflow Config Filled](/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png) + +> Docker Tip: If both services run in containers, ensure they're on the same network and use the container name for Base URL. + +Click **Save** to save the configuration. + +## Step 6: Test the Conversation + +Click **Debug Chat** on the Pipelines page to open the debug chat interface: + +![LangBot Debug Chat Interface](/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png) + +Enter a test message like "Hello" and view the AI response: + +![LangBot Chat Test Success](/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png) + +## How It Works + +1. User sends a message on a messaging platform +2. LangBot receives and passes it to the Pipeline +3. Pipeline calls Langflow API +4. Langflow executes the workflow: receives input → adds prompt → calls LLM → returns result +5. LangBot sends the response back to the user + +## Common Issues + +**Cannot connect to Langflow?** + +Check Base URL. For Docker deployment, ensure containers are on the same network: + +```bash +docker network create langbot_network +docker network connect langbot_network langflow +docker network connect langbot_network langbot +``` + +Use container name: `http://langflow:7860` + +**API call fails?** + +- Confirm API Key and Flow ID are correct +- Verify the Language Model in Langflow has a valid LLM API Key configured + +## Advanced Use Cases + +Langflow's power lies in visually orchestrating complex AI workflows: + +- **Multi-Turn Memory**: Add Memory components for contextual understanding +- **Conditional Branches**: Execute different logic based on user input +- **External API Integration**: Connect databases, search engines, third-party services +- **Multi-Agent Collaboration**: Multiple LLM models working together +- **RAG Applications**: Integrate vector databases for knowledge base Q&A + +All achievable through drag-and-drop without writing code. + +## Summary + +With LangBot + Langflow, you can rapidly build powerful multi-platform AI chatbots. Langflow provides visual workflow orchestration, LangBot handles messaging platform integration - together they create a complete loop from workflow design to multi-platform deployment. + +This approach is ideal for: +- Scenarios requiring the same AI capabilities across multiple platforms +- Teams wanting rapid iteration and testing of different conversation flows +- Developers wanting to build complex AI applications without deep coding + +## Related Resources + +- [LangBot Official Site](https://langbot.app) | [Documentation](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Langflow Official Site](https://www.langflow.org) | [Documentation](https://docs.langflow.org) | [GitHub](https://github.com/langflow-ai/langflow) + +--- + +*This article is based on the latest version of LangBot. LangBot supports integration with Dify, n8n, FastGPT, Coze, and other AI platforms - choose the workflow engine that best fits your needs.* diff --git a/ja/articles/langtars-remote-pc-control-dify-n8n.mdx b/ja/articles/langtars-remote-pc-control-dify-n8n.mdx new file mode 100644 index 000000000..9bf58ea77 --- /dev/null +++ b/ja/articles/langtars-remote-pc-control-dify-n8n.mdx @@ -0,0 +1,202 @@ +--- +title: "LangTARS:Dify・n8n と連携するオープンソース PC 操作 Agent" +description: "LangTARS is a LangBot native plugin that lets you remotely control Mac/Windows/Linux from Telegram, Discord & WeChat — with Dify and n8n workflow support." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/langtars-remote-pc-control-dify-n8n). + +公開日:2026-03-23 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangTARS Logo](/images/articles/external/3fe5bdc18716-icon.svg) + +**LangBot Native Plugin | OpenClaw-like Experience | Ready to Use with One-Click Deployment** + +--- + +## ✨ What is LangTARS? + +**LangTARS** is a powerful **OpenClaw alternative** and native plugin for LangBot, inspired by the loyal and reliable robot TARS from the movie *Interstellar*. + +As a versatile **AI agent** for **remote computer control**, LangTARS allows you to remotely command your **Mac, Windows, or Linux** machine directly through your favorite messaging apps like **Telegram, Discord, DingTalk, and WeChat**! If you've been looking for an **OpenClaw-like** computer use agent that integrates seamlessly into your existing **chatbot framework**, LangTARS is the perfect solution. + +> 💡 **Deploy LangBot, and you can experience LangTARS instantly!** No extra standalone agent installation needed—just get it with one click from the plugin marketplace. + +![LangTARS Demo](/images/articles/external/70b26e660a60-tars.gif) + +--- + +## 🤖 The LangBot Ecosystem + +LangTARS is just ONE plugin in the massive LangBot ecosystem. **LangBot** is a leading **open source chatbot** framework designed for connecting LLMs to messaging platforms. + +- **Multi-platform bot integration**: Native support for Telegram, Discord, WeChat, DingTalk, Lark, LINE, Slack, and more. +- **Multi-model LLM chatbot**: Works flawlessly with OpenAI, Claude, Gemini, DeepSeek, and local models. +- **Rich Plugin Marketplace**: Access over 30+ plugins for endless functionality. +- **Advanced Features**: Pipeline-based message processing, RAG support, and multi-agent workflows. +- **Self-hosted AI**: Total control over your data and deployments. +- **AI Workflow Integrations**: Connect LangBot to platforms like **Dify**, **n8n**, **Langflow**, and **Coze**. LangBot can act as the messaging frontend for your complex AI workflows, meaning LangTARS + Dify/n8n = powerful automation! + +Get started with LangBot: +- **Easiest**: [LangBot Cloud](https://cloud.langbot.app) +- Self-host: `uvx langbot@latest` +- Documentation: [docs.langbot.app](https://docs.langbot.app) +- GitHub: [github.com/langbot-app/LangBot](https://github.com/langbot-app/LangBot) (15k+ stars) + +--- + +## 🎯 What Can It Do? + +As a comprehensive **automation tool**, just send a message, and the AI will handle your **task automation** and **browser automation**: + +| You Say | AI Does | +|------|-------| +| `!tars open Reddit in Chrome, post a thread with the title "Hello from LangTARS" and say hi` | 🌐 Automatically controls Chrome to open Reddit and publish a post | +| `!tars organize my desktop files` | 📁 Automatically categorizes and moves files | +| `!tars open the browser and search for today's AI news` | 🌐 Opens a browser, searches the web, and summarizes the news | +| `!tars create a meeting note for our marketing sync` | 📝 Automatically creates a markdown note file | +| `!tars check system memory and CPU` | 💻 Uses MCP tools to get computer status | + +![Usage Example](/images/articles/external/6613b3025b8b-usage-example.png) +![Plan Mode](/images/articles/external/ff42857251ab-planner-mode.png) + + +--- + +## 🔗 Supercharge with Dify & n8n + +LangTARS becomes even more powerful when combined with **AI workflow platforms**: + +- **Dify Integration**: Connect LangBot to [Dify](https://dify.ai) as a messaging frontend. Build complex AI workflows in Dify's visual editor, then trigger them from Telegram/Discord via LangTARS. +- **n8n Integration**: Use [n8n](https://n8n.io) workflows with LangBot for advanced automation chains. Combine LangTARS's computer control with n8n's 400+ integrations for unlimited possibilities. +- **Also supports**: Langflow, Coze, and any OpenAI-compatible API. + +> 💡 **Example**: "Hey TARS, run my Dify workflow to analyze today's sales data and save the report to my desktop" — LangTARS handles the entire chain. + +--- + +## 🚀 Why Choose LangTARS? + +### 1️⃣ LangBot Native Plugin, Out of the Box + +Instead of deploying a complex standalone agent, you can easily **deploy AI bot** capabilities right where you already chat. + +```bash +# Deploy LangBot with one command +uvx langbot@latest + +# Install LangTARS from the plugin market, configure your LLM, and start using! +``` + +**No complex configuration, no extra deployment. LangBot users can experience OpenClaw-style computer control directly!** + +![Installation Flow](/images/articles/external/2a3a0d5f4ae9-install-flow.png) + +--- + +### 2️⃣ Intelligent Task Planning, Autonomous Execution + +Powered by an AI planning engine based on the **ReAct agent** loop: + +``` +Your Command → Understand Needs → Make a Plan → Execute Step-by-Step → Feedback Results +``` + +The AI assistant thinks like a human and automatically breaks down complex tasks using integrated **MCP tools**! + +--- + +### 3️⃣ Multi-Browser Support for Web Automation + +| Browser | macOS | Windows | Linux | +|--------|-------|---------|-------| +| Playwright (Headless) | ✅ | ✅ | ✅ | +| Safari | ✅ | - | - | +| Chrome | ✅ | ✅ | ✅ | +| Edge | - | ✅ | - | +| Firefox | - | - | ✅ | + +--- + +### 4️⃣ Security-First Design + +- 🚫 **Dangerous Command Interception** — Automatically blocks commands like `rm -rf /` +- 📂 **Workspace Isolation** — Restricts file operations to safe directories +- 📋 **Command Whitelist** — Configurable allowed commands +- 👤 **User Access Control** — Restricts usage to specific authorized users + +![Security Features](/images/articles/external/a618d3d41416-security.png) + +--- + +## 📱 Quick Start + +### Step 1: Deploy LangBot + +> 🚀 **Fastest way to start:** Use [LangBot Cloud](https://cloud.langbot.app) — deploy your LangBot instance in one click, no server needed! Install LangTARS from the plugin marketplace and start controlling your computer immediately. + +*Alternative for power users (Self-hosted):* +```bash +uvx langbot@latest +``` + +### Step 2: Configure Chat Platform + +Follow the documentation to configure your **Telegram bot**, **WeChat bot**, or **Discord bot**. + +### Step 3: Install LangTARS + +Search for **LangTARS** in the **plugin marketplace** and install it. + +### Step 4: Start Chatting + +``` +!tars Hello, tell me what you can do +``` + +> 📱 **Recommendation**: Use it on Telegram or Discord for the best interactive experience! + +--- + +## 🎮 Common Commands + +| Command | Function | +|------|------| +| `!tars ` | Execute a task | +| `!tars stop` | Stop the current task | +| `!tars what` | Check execution status | +| `!tars reset` | Reset the conversation | +| `!tars help` | Show help | + +--- + +## 🌟 Project Information + +| Item | Information | +|------|------| +| **GitHub** | [github.com/langbot-app/LangTARS](https://github.com/langbot-app/LangTARS) | +| **Language** | Python 100% | +| **License** | CC BY-NC-ND 4.0 | +| **Platforms** | macOS / Windows / Linux | + +--- + +## 🔗 Related Links + +- 📖 **LangBot Documentation**: [docs.langbot.app](https://docs.langbot.app) +- 💬 **Issue Feedback**: [GitHub Issues](https://github.com/langbot-app/LangTARS/issues) +- ⭐ **Support with a Star**: [GitHub](https://github.com/langbot-app/LangTARS) + +--- + +## 🎉 Deploy LangBot and Experience LangTARS! + +**Let AI be your loyal digital assistant, just like TARS.** + +> 🚀 **Fastest way to start:** Use [LangBot Cloud](https://cloud.langbot.app) — deploy your LangBot instance in one click, no server needed! Install LangTARS from the plugin marketplace and start controlling your computer immediately. + +*Alternative for power users (Self-hosted):* +```bash +uvx langbot@latest +``` diff --git a/ja/articles/n8n-multi-platform-ai-chatbot.mdx b/ja/articles/n8n-multi-platform-ai-chatbot.mdx new file mode 100644 index 000000000..767a796c2 --- /dev/null +++ b/ja/articles/n8n-multi-platform-ai-chatbot.mdx @@ -0,0 +1,186 @@ +--- +title: "n8n と LangBot でマルチプラットフォーム AI Chatbot を構築" +description: "How I Built a Multi-Platform AI Chatbot with n8n and LangBot" +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/n8n-multi-platform-ai-chatbot). + +公開日:2025-12-03 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![How I Built a Multi-Platform AI Chatbot with n8n and LangBot](/images/articles/source/images/covers/n8n.png) + +Connecting n8n's visual workflow automation with LangBot's multi-platform bot framework creates a powerful, code-free way to deploy AI chatbots across QQ, WeChat, Discord, Telegram, Slack, and more. This tutorial shows you how to integrate these tools in minutes. + +## What You'll Need + +- Python 3.8+ installed +- Node.js 18+ installed +- npm or npx available +- 15 minutes of your time + +## Deploy LangBot in 3 Commands + +LangBot is a production-ready bot framework that connects to multiple messaging platforms and AI services including Dify, FastGPT, Coze, OpenAI, Claude, and Gemini. Deploy it instantly: + +```bash +cd your-workspace +mkdir -p langbot-instance && cd langbot-instance +uvx langbot@latest +``` + +On first launch, LangBot initializes automatically. Open `http://127.0.0.1:5300` in your browser. + +![LangBot initialization screen](/images/articles/external/70ee40a6d232-01-langbot-initialization.png) + +Register your admin account when prompted. You'll land on the dashboard where you can manage bots, models, pipelines, and integrations. + +![LangBot dashboard](/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png) + +## Set Up n8n Workflow Automation + +n8n is an open-source automation platform with 400+ integrations and powerful AI capabilities. Launch it locally: + +```bash +cd your-workspace +mkdir -p n8n-data +export N8N_USER_FOLDER=$(pwd)/n8n-data +npx n8n +``` + +Visit `http://127.0.0.1:5678` and create your owner account. + +![n8n initial setup](/images/articles/external/12d0e04600c5-05-n8n-setup.png) + +## Build Your AI Workflow + +Create a new workflow in n8n. You'll need two essential nodes: + +![n8n workflow editor](/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png) + +### Add the Webhook Trigger + +Click "+" on the canvas and add a **Webhook** node. Configure it: + +- **HTTP Method**: POST +- **Response Mode**: Streaming (enables real-time chat responses) +- **Authentication**: None (adjust for production) + +![Webhook node configuration](/images/articles/external/03443176ae5c-08-n8n-webhook-node.png) + +### Add the AI Agent + +Press Tab, navigate to the "AI" category, and select **AI Agent**. + +**Configure the Chat Model**: Click "Chat Model" and choose "OpenAI Chat Model". Add your credentials: + +- **API Key**: Your OpenAI API key (or compatible service key) +- **Base URL**: For OpenAI alternatives like Claude, Gemini, or local models, update to your provider's endpoint + +**Critical Step - Fix the Prompt Source**: By default, the AI Agent expects a Chat Trigger node, which won't work with webhooks. Here's how to fix it: + +1. Find "Source for Prompt (User Message)" in the AI Agent settings +2. Change from "Connected Chat Trigger Node" to "Define below" +3. Switch to "Expression" mode +4. Enter: `{{ $json.body }}` + +This expression pulls the user's message from the webhook request body. + +![Configured webhook with AI Agent](/images/articles/external/621f3d526678-09-n8n-webhook-configured.png) + +### Activate and Get Your Webhook URL + +Save the workflow and toggle the activation switch (top-right). Switch to the "Production URL" tab and copy the webhook URL: + +``` +http://localhost:5678/webhook/{your-webhook-id} +``` + +## Connect LangBot to n8n + +Back in the LangBot dashboard, navigate to **Pipelines** and click the default "ChatPipeline". + +![LangBot pipelines page](/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png) + +Switch to the **AI** tab and select "n8n Workflow API" from the Runner dropdown. Configure: + +- **Webhook URL**: Paste your n8n production webhook URL +- **Authentication Type**: None (match your n8n webhook settings) +- **Timeout**: 120 seconds +- **Output Key**: response + +Click **Save**. + +## Test It Out + +In the Pipeline editor, click "Debug Chat" on the left sidebar. Send a test message like "What is LangBot?" + +If everything works, you'll see LangBot send the message to n8n, where the AI Agent processes it and streams back a response. + +## Troubleshooting + +**Error: "Expected to find the prompt in an input field called 'chatInput'"** + +This means the AI Agent is still configured for a Chat Trigger node. Fix it: + +1. Open the AI Agent configuration +2. Set "Source for Prompt (User Message)" to "Define below" +3. Switch to Expression mode +4. Enter: `{{ $json.body }}` + +**Test Your Webhook Directly** + +Verify the webhook works with curl: + +```bash +curl -X POST http://localhost:5678/webhook/your-webhook-id \ + -H "Content-Type: application/json" \ + -d '{"body": "Hello, can you introduce yourself?"}' +``` + +You should receive streaming JSON with the AI's response. + +## How the Integration Works + +Here's the complete flow: + +1. User sends a message via QQ, WeChat, Discord, Telegram, Slack, LINE, or any LangBot-supported platform +2. LangBot's Pipeline receives the message and calls the n8n Workflow API +3. n8n's Webhook node captures the request and passes it to the AI Agent +4. The AI Agent uses OpenAI, Claude, Gemini, or your configured LLM to generate a response +5. n8n streams the response back to LangBot +6. LangBot delivers the response to the user on their original platform + +## Why This Combination Works + +**LangBot + n8n** unlocks powerful capabilities: + +1. **No-Code AI Logic**: Design conversation flows visually in n8n without touching code +2. **Multi-Platform Reach**: Deploy the same AI across QQ, WeChat, Discord, Telegram, Slack, LINE, DingTalk, and Lark simultaneously +3. **Flexible AI Models**: Swap between OpenAI GPT, Anthropic Claude, Google Gemini, Coze, Dify, local models, and more +4. **Rich Integrations**: Connect n8n's 400+ integrations - databases, APIs, Notion, Airtable, Google Sheets, Slack, and beyond +5. **Tool-Calling Agents**: AI Agent can trigger n8n tools like database queries, API calls, or custom functions +6. **Workflow Extensions**: Add preprocessing, content moderation, logging, or custom business logic + +**Perfect For**: +- Enterprise customer support bots +- Knowledge base Q&A systems +- Multi-platform community management +- Task automation assistants +- Unified chat interfaces for teams + +## Next Steps + +Extend your bot further: + +- Integrate Dify or FastGPT for advanced RAG (retrieval-augmented generation) +- Add vector database nodes (Pinecone, Qdrant, Weaviate) for knowledge retrieval +- Connect business APIs for real-time data +- Implement conversation memory and context tracking +- Add content filtering and moderation workflows +- Use Langflow or Coze for additional AI orchestration + +This integration gives you the flexibility of code-based AI frameworks like LangChain with the simplicity of visual workflow builders - all while reaching users across every major messaging platform. + +Ready to deploy your multi-platform AI assistant? Start with LangBot and n8n today. diff --git a/ja/articles/welcome.mdx b/ja/articles/welcome.mdx new file mode 100644 index 000000000..987581bad --- /dev/null +++ b/ja/articles/welcome.mdx @@ -0,0 +1,35 @@ +--- +title: "LangBot Blog のご紹介" +description: "Welcome to the official LangBot blog. Stay up to date with product updates, new features, and milestones." +--- + +この記事は LangBot Blog から同期されています。 [Blog の原文を読む](https://langbot.app/en/blog/welcome). + +公開日:2026-02-17 · 著者:LangBot Team + +> この記事の日本語版はまだ公開されていないため、英語版を掲載しています。 + +![LangBot Blog](/images/articles/source/images/covers/welcome.png) + +We're excited to launch the official LangBot blog! This is where we'll share product updates, new features, milestones, and insights from the LangBot team. + +## What is LangBot? + +LangBot is an open-source LLM-native instant messaging bot platform. It supports multiple messaging platforms and model providers, with integrations for Dify, Alibaba Cloud Bailian, and other LLMOps platforms. LangBot also provides a WebUI for quick deployment and management. + +## What to Expect + +On this blog, you'll find: + +- **Release Notes** - Detailed breakdowns of each new version +- **Feature Spotlights** - Deep dives into new capabilities +- **Milestones** - Project growth and community achievements +- **Guides & Tips** - Best practices for getting the most out of LangBot + +## Stay Connected + +- [GitHub](https://github.com/langbot-app/LangBot) - Star us and follow development +- [Documentation](https://docs.langbot.app) - Full guides and API reference +- [LangBot Home](https://langbot.app) - Main website + +Stay tuned for more updates! diff --git a/package.json b/package.json index bdbd358c2..1ef38c5b2 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,8 @@ "scripts": { "dev": "npx mintlify dev", "generate:sitemap-alternates": "node scripts/generate-alternate-sitemap.mjs", + "sync:articles": "node scripts/sync-blog-articles.mjs", + "check:articles": "node scripts/sync-blog-articles.mjs --check", "test": "node --test tests/*.test.mjs" }, "dependencies": { diff --git a/scripts/README-blog-articles.md b/scripts/README-blog-articles.md new file mode 100644 index 000000000..e1298941a --- /dev/null +++ b/scripts/README-blog-articles.md @@ -0,0 +1,28 @@ +# LangBot Blog → Wiki article synchronization + +`langbot-app/langbot-landing-page/src/content/blog` is the canonical article source. The Wiki publishes generated copies under `{en,zh,ja}/articles/` and stores every rendered image locally under `images/articles/` so Wiki pages do not depend on third-party hotlinks. + +## Run locally + +From the Wiki checkout, with the landing-page repository available as a sibling checkout: + +```bash +node scripts/sync-blog-articles.mjs --source ../langbot-landing-page +node scripts/sync-blog-articles.mjs --check --source ../langbot-landing-page +node scripts/sync-blog-articles.mjs --check +npm test +``` + +The synchronizer: + +- requires matching English and Chinese slug sets; +- uses the canonical Japanese article when one exists and a clearly marked English fallback otherwise; +- groups navigation into product updates, engineering, tutorials/integrations, and announcements with localized labels; +- copies source images and downloads external images into the Wiki repository; +- rewrites Markdown image URLs to Wiki-local paths; +- escapes prose that would otherwise be parsed as MDX expressions; +- replaces the generated article directories and updates the `docs.json` article tabs deterministically. + +Do not edit generated article pages or mirrored images manually. Fix the canonical Blog post or the synchronizer, then regenerate. + +A daily GitHub Actions workflow provides drift recovery. Article publishing work should still synchronize and verify the Wiki in the same task so a new Blog post does not wait for the scheduled run. diff --git a/scripts/blog-articles-manifest.json b/scripts/blog-articles-manifest.json new file mode 100644 index 000000000..db0513f9a --- /dev/null +++ b/scripts/blog-articles-manifest.json @@ -0,0 +1,594 @@ +{ + "source": "https://github.com/langbot-app/langbot-landing-page/tree/main/src/content/blog", + "articles": [ + { + "locale": "en", + "slug": "connect-deepseek-to-wechat", + "page": "en/articles/connect-deepseek-to-wechat", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "deploy-ai-bot-in-5-minutes", + "page": "en/articles/deploy-ai-bot-in-5-minutes", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "dify-agent-discord-telegram-slack", + "page": "en/articles/dify-agent-discord-telegram-slack", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "dify-langbot-rag-knowledge-base", + "page": "en/articles/dify-langbot-rag-knowledge-base", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langbot-cloud-multi-user-workspaces", + "page": "en/articles/langbot-cloud-multi-user-workspaces", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langbot-plugin-system-deep-dive", + "page": "en/articles/langbot-plugin-system-deep-dive", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langbot-v4100-sandbox-skills", + "page": "en/articles/langbot-v4100-sandbox-skills", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langbot-v490-rag-plugin-architecture", + "page": "en/articles/langbot-v490-rag-plugin-architecture", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langflow-drag-and-drop-ai-bot", + "page": "en/articles/langflow-drag-and-drop-ai-bot", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "langtars-remote-pc-control-dify-n8n", + "page": "en/articles/langtars-remote-pc-control-dify-n8n", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "n8n-multi-platform-ai-chatbot", + "page": "en/articles/n8n-multi-platform-ai-chatbot", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "en", + "slug": "welcome", + "page": "en/articles/welcome", + "sourceLocale": "en", + "fallback": false + }, + { + "locale": "zh", + "slug": "connect-deepseek-to-wechat", + "page": "zh/articles/connect-deepseek-to-wechat", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "deploy-ai-bot-in-5-minutes", + "page": "zh/articles/deploy-ai-bot-in-5-minutes", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "dify-agent-discord-telegram-slack", + "page": "zh/articles/dify-agent-discord-telegram-slack", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "dify-langbot-rag-knowledge-base", + "page": "zh/articles/dify-langbot-rag-knowledge-base", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langbot-cloud-multi-user-workspaces", + "page": "zh/articles/langbot-cloud-multi-user-workspaces", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langbot-plugin-system-deep-dive", + "page": "zh/articles/langbot-plugin-system-deep-dive", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langbot-v4100-sandbox-skills", + "page": "zh/articles/langbot-v4100-sandbox-skills", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langbot-v490-rag-plugin-architecture", + "page": "zh/articles/langbot-v490-rag-plugin-architecture", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langflow-drag-and-drop-ai-bot", + "page": "zh/articles/langflow-drag-and-drop-ai-bot", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "langtars-remote-pc-control-dify-n8n", + "page": "zh/articles/langtars-remote-pc-control-dify-n8n", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "n8n-multi-platform-ai-chatbot", + "page": "zh/articles/n8n-multi-platform-ai-chatbot", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "zh", + "slug": "welcome", + "page": "zh/articles/welcome", + "sourceLocale": "zh", + "fallback": false + }, + { + "locale": "ja", + "slug": "connect-deepseek-to-wechat", + "page": "ja/articles/connect-deepseek-to-wechat", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "deploy-ai-bot-in-5-minutes", + "page": "ja/articles/deploy-ai-bot-in-5-minutes", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "dify-agent-discord-telegram-slack", + "page": "ja/articles/dify-agent-discord-telegram-slack", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "dify-langbot-rag-knowledge-base", + "page": "ja/articles/dify-langbot-rag-knowledge-base", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "langbot-cloud-multi-user-workspaces", + "page": "ja/articles/langbot-cloud-multi-user-workspaces", + "sourceLocale": "ja", + "fallback": false + }, + { + "locale": "ja", + "slug": "langbot-plugin-system-deep-dive", + "page": "ja/articles/langbot-plugin-system-deep-dive", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "langbot-v4100-sandbox-skills", + "page": "ja/articles/langbot-v4100-sandbox-skills", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "langbot-v490-rag-plugin-architecture", + "page": "ja/articles/langbot-v490-rag-plugin-architecture", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "langflow-drag-and-drop-ai-bot", + "page": "ja/articles/langflow-drag-and-drop-ai-bot", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "langtars-remote-pc-control-dify-n8n", + "page": "ja/articles/langtars-remote-pc-control-dify-n8n", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "n8n-multi-platform-ai-chatbot", + "page": "ja/articles/n8n-multi-platform-ai-chatbot", + "sourceLocale": "en", + "fallback": true + }, + { + "locale": "ja", + "slug": "welcome", + "page": "ja/articles/welcome", + "sourceLocale": "en", + "fallback": true + } + ], + "images": [ + { + "path": "/images/articles/external/03443176ae5c-08-n8n-webhook-node.png", + "sha256": "8b05859a0d3c77a11755e493b464eb12a04f1abd341f982432f06be5e737d72f", + "bytes": 92552 + }, + { + "path": "/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png", + "sha256": "5dadd6447bca26f2aea014cdb63d075f655c30194c0e46b15b3f79c7dab768ee", + "bytes": 38365 + }, + { + "path": "/images/articles/external/12d0e04600c5-05-n8n-setup.png", + "sha256": "52cc42c6f1e12c4df29ac5a646888154e9193b33b28cdd678e8d88a6123bf0eb", + "bytes": 30953 + }, + { + "path": "/images/articles/external/21fc47358066-05-langflow-api-keys-page.png", + "sha256": "758bf810158bf3fe5ec1b1571086371db457de809de91743ade776c2c7497693", + "bytes": 54223 + }, + { + "path": "/images/articles/external/2a3a0d5f4ae9-install-flow.png", + "sha256": "7fe8844aeb196a3cb3c6338b4b6b7cf8c5255780a37a7aedd2cd5e2adaf3f99c", + "bytes": 138088 + }, + { + "path": "/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png", + "sha256": "3da8e3faf3984091df9b176c5d05d341cbd3427ac35a61047cb6353d20edf418", + "bytes": 100965 + }, + { + "path": "/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png", + "sha256": "a0c20a44d45f20d7588f611eb1ac006be68360f5289b2a767f36a6a35b16449b", + "bytes": 88489 + }, + { + "path": "/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png", + "sha256": "e1c8d41b8efb17a31fc9b41206b44e0d2a1bf83099a2d4d29d3b2c59ed9142e9", + "bytes": 62219 + }, + { + "path": "/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png", + "sha256": "6f161d5de119721af085ed40ce86c50aca4d6566f97241f7eeba1f83aefd3f0d", + "bytes": 165144 + }, + { + "path": "/images/articles/external/3fe5bdc18716-icon.svg", + "sha256": "430b8fc2bbcd1799231285f9f9645becce0d4cf7bef4412769db425f52cfac23", + "bytes": 734399 + }, + { + "path": "/images/articles/external/471b316018e5-13-dify-api-key-created.png", + "sha256": "776930876f0c50ef7bd70ff81faa4fdae2a66de4dbec4a3b595d2db3213c7ff3", + "bytes": 128227 + }, + { + "path": "/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png", + "sha256": "3d6769445112e80fddf079028f81e4df67d28374b20c4f3a94086a535ed38fa3", + "bytes": 38244 + }, + { + "path": "/images/articles/external/621f3d526678-09-n8n-webhook-configured.png", + "sha256": "e19bb4356edfb75f463928528f702ed8a765d879ea377bf9721c2a24088f457a", + "bytes": 48125 + }, + { + "path": "/images/articles/external/6613b3025b8b-usage-example.png", + "sha256": "387e811bf57f83b121842a0e9066f2c045ad18e2666f6c04ae5eb568c288efc1", + "bytes": 126628 + }, + { + "path": "/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png", + "sha256": "53069258d131ed4e87e6467eb95e8b90764684d5c948bdae9b4109f07667b158", + "bytes": 212230 + }, + { + "path": "/images/articles/external/70b26e660a60-tars.gif", + "sha256": "ec59948d2c335c17f373186b1913703017c8664554b53f7fb49c3eae0ee19ed5", + "bytes": 1544475 + }, + { + "path": "/images/articles/external/70ee40a6d232-01-langbot-initialization.png", + "sha256": "b9f45c78b49bdfdb51e278b2e491b88ca35d1a4ed05f33fc4c15085baacf2391", + "bytes": 42702 + }, + { + "path": "/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png", + "sha256": "225397739ad8458f38002b75dfbbdc6eea268e9e3d1dd478e8a498b7a302e0d4", + "bytes": 101173 + }, + { + "path": "/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png", + "sha256": "62876dd239a917eb88ba7de369f9444e1c2fa169f3a347715c86c9bbaa4fba36", + "bytes": 50425 + }, + { + "path": "/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png", + "sha256": "56d2046d64179008e6d0384bce1dd4797f9818d866df86bf20ce16f9db322bbd", + "bytes": 92112 + }, + { + "path": "/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png", + "sha256": "19a51834168c350185b0d2de1dd83a025d14d75bd3dfe3278997f755a258b3ae", + "bytes": 72422 + }, + { + "path": "/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png", + "sha256": "b751c1d8eacca6b9f5ffe6645d3d2b2d2557dacb88002b85dd1bae2f9d81f6ed", + "bytes": 86022 + }, + { + "path": "/images/articles/external/9066d99b172c-11-dify-tools-panel.png", + "sha256": "b099d333ded4cdf4e3392de8f444b3e7e7be81804e717b9c0a9735f0aff35844", + "bytes": 176867 + }, + { + "path": "/images/articles/external/9999c12907eb-20-langbot-chat-test.png", + "sha256": "ee409e91f03415bda392e8d51d31ffea16a4489773255f8c3690a63d6d67ced7", + "bytes": 61568 + }, + { + "path": "/images/articles/external/a618d3d41416-security.png", + "sha256": "18bf5b073596354b64c0abd4692c79f73da24b2e69b400c9164e3b62da76e361", + "bytes": 91790 + }, + { + "path": "/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png", + "sha256": "d28ff1118326a43cb089ce21fd7fd4bb8c181bd037ac33b461dbf6e10a00dd3c", + "bytes": 455482 + }, + { + "path": "/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png", + "sha256": "30a260b07cc96584a39de1419d53b17991b9d86c10a956ac5896a91ab5617f49", + "bytes": 55005 + }, + { + "path": "/images/articles/external/b93d97b5b830-04-langbot-dashboard.png", + "sha256": "ae9dfe886f8802e1d35fa185b94465d40a229145ed65279d9b89f7bb63bd430b", + "bytes": 35641 + }, + { + "path": "/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png", + "sha256": "1dbae106a3306820c6364faa7e21cf57fee5ea76b1187ed809c6faa8f3985863", + "bytes": 140727 + }, + { + "path": "/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png", + "sha256": "785b4cf39a62539eb334a750bc8e53466077198f120786fdb9c078b7e062d0d6", + "bytes": 209881 + }, + { + "path": "/images/articles/external/be278ca435e8-12-dify-agent-configured.png", + "sha256": "5feda01e6419a40658786e906a59b5e1c7e27503842e5b08fe3990d2d5b44a1c", + "bytes": 141049 + }, + { + "path": "/images/articles/external/c6d52212ba91-02-langbot-dashboard.png", + "sha256": "43a4eabed41c1ac9a356d33b8a160afac7a74ad1d06452827b3dd6c03017195a", + "bytes": 36354 + }, + { + "path": "/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png", + "sha256": "f845f0d7fd7553af2406c0e3bc1b461b4a5dd76ebd108f8ff3b48c3de3804037", + "bytes": 41296 + }, + { + "path": "/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png", + "sha256": "50c2e5d99ad7c1bbd40e6f467b0bd3edc85454a8867b9c11077f9f5f2ddececa", + "bytes": 82662 + }, + { + "path": "/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png", + "sha256": "f1edae3941ae6b55085a84e9c290a95744015ef4db1bd9978e97109b8ab320d4", + "bytes": 58250 + }, + { + "path": "/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png", + "sha256": "3fc0d26c86715a1e859925727bdd27b84671da158185ff6860a73fd4f5f3466f", + "bytes": 94483 + }, + { + "path": "/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png", + "sha256": "826a60ffe5198b5cef2620f9f4ba553b006c6b3ad2ee2e0b041f044b6536bc56", + "bytes": 92060 + }, + { + "path": "/images/articles/external/ff42857251ab-planner-mode.png", + "sha256": "1e2ee21c697ab9c2320094874889e2ac0bd2fc44efb529eafa4d895393ca5691", + "bytes": 161907 + }, + { + "path": "/images/articles/source/images/article-mcp/01-init-page.png", + "sha256": "b392e42d582c8c1723a2eb63596801b9d459df0465377246d9a4015edcae1ca0", + "bytes": 45011 + }, + { + "path": "/images/articles/source/images/article-mcp/05-pipelines.png", + "sha256": "66891ef15942b5c11c92a60208ffed491414a488a8352b1f255b65b4d95cd912", + "bytes": 54047 + }, + { + "path": "/images/articles/source/images/article-mcp/06-pipeline-ai.png", + "sha256": "41b60a85a29e4fa75c8cb59c7f55fe51912eddb961340b04153201fdc5ae9d06", + "bytes": 72714 + }, + { + "path": "/images/articles/source/images/article-mcp/07-debug-chat.png", + "sha256": "6bb15b2ebb29878b83882eaf17e6f5a39785dd17572b7f864e7e653bdfd59fce", + "bytes": 57403 + }, + { + "path": "/images/articles/source/images/article-mcp/08-model-select.png", + "sha256": "27100d6a84663da8b227a460841698233ed5f8e4323b23fec2608d0acbec5682", + "bytes": 89524 + }, + { + "path": "/images/articles/source/images/article-mcp/10-group-chat.png", + "sha256": "b87b7d219527aebedfb48e6269796bc2ecc6eb68ec1f661dd1b1b4903c5f0f66", + "bytes": 58454 + }, + { + "path": "/images/articles/source/images/article-mcp/11-private-chat.png", + "sha256": "3e79edd893da3cfc983d2d8ff451c828e5bcd704f3f75c36711f01a94058902b", + "bytes": 53834 + }, + { + "path": "/images/articles/source/images/article-mcp/13-bot-page.png", + "sha256": "1a2dfbf25b164df63cb87d7490474d45b273e5e33c121e75490d923eaa41fb8f", + "bytes": 341107 + }, + { + "path": "/images/articles/source/images/article-mcp/14-space-market.png", + "sha256": "49ccec9d7f98f74020573a9e1da30c3fc3729ebb32610dad672ccc800c1455ef", + "bytes": 110469 + }, + { + "path": "/images/articles/source/images/cloud-multi-user/cloud-invitation.png", + "sha256": "8102e7f3d2babb38d5f8f211167c23d119858924913c0e576d3cbe1f9cca02ca", + "bytes": 23712 + }, + { + "path": "/images/articles/source/images/cloud-multi-user/cloud-login.png", + "sha256": "aa49e8120707c2e4d2fb7fde346afb7aa0eaf46bfa985027c079f3984d76287b", + "bytes": 33810 + }, + { + "path": "/images/articles/source/images/cloud-multi-user/oss-dashboard.png", + "sha256": "c9f8a0402c2077571826fafe7c3587c695c7aaed12186fa4f86823f6fa99da98", + "bytes": 103726 + }, + { + "path": "/images/articles/source/images/covers/deepseek-wechat.png", + "sha256": "fd0f772d9cd0bfa4c33e2ea38a6ab09710f2df08c004af91f17e4882c60be146", + "bytes": 20896 + }, + { + "path": "/images/articles/source/images/covers/deploy-ai-bot.png", + "sha256": "2bc212631b8b072e214bb433e4da241aca0e4c99087bef9ea24f5fd368bf6c7d", + "bytes": 20798 + }, + { + "path": "/images/articles/source/images/covers/dify-agent.png", + "sha256": "114d06c78593aa66e693768435822cdde7bec356d39e17b74a78d012c123a3a0", + "bytes": 11651 + }, + { + "path": "/images/articles/source/images/covers/dify-rag.png", + "sha256": "7746be4bb44228165f00a65ca5b147559058a5c79f9a91ac80fb3f1277c34dfe", + "bytes": 15799 + }, + { + "path": "/images/articles/source/images/covers/langflow.png", + "sha256": "b577d13d95e4b5428a076fb68f17a020f75a5d5f0b581f51e94323f83fd922b1", + "bytes": 14706 + }, + { + "path": "/images/articles/source/images/covers/n8n.png", + "sha256": "bea4ff8a15517784ab0035483a43ace25b0b2ce5099d7c39f0f817520801750b", + "bytes": 14297 + }, + { + "path": "/images/articles/source/images/covers/plugin-system.png", + "sha256": "cdf9a0e2249901835f98fe94faa9071ef8ffaa57831a8af30dd69155aeac953c", + "bytes": 17004 + }, + { + "path": "/images/articles/source/images/covers/rag-plugin.png", + "sha256": "c4e24290b57b30f55d086b2557425f7e790bedd2c8fa17d09c9cbc23686bdab3", + "bytes": 14661 + }, + { + "path": "/images/articles/source/images/covers/sandbox-skills.png", + "sha256": "2a89789d61ffe229aeb20c069a0e63102374abcdfe0f99e799fc5563cfb1910d", + "bytes": 86846 + }, + { + "path": "/images/articles/source/images/covers/welcome.png", + "sha256": "5ff0078633e30e8d8d8efa5abf686fbe13993b06cee383d2e7b9afec16639712", + "bytes": 11535 + }, + { + "path": "/images/articles/source/images/plugin-system/architecture.png", + "sha256": "85028534d0a6246bd25f110189a6734f6176e1765fc64bf5eeb3248137e7292d", + "bytes": 30445 + }, + { + "path": "/images/articles/source/images/plugin-system/event-dispatch.png", + "sha256": "ba6780bfda4c250da30575e87570e6b3d1a2bd682265340c365b4d3ba575ea13", + "bytes": 31013 + }, + { + "path": "/images/articles/source/images/rag-plugin/data-flow.png", + "sha256": "9f6f331d4ed508a983e7cc9aeb34914ba47cf0e00a1bd2df87c7424eab93c156", + "bytes": 31760 + }, + { + "path": "/images/articles/source/images/rag-plugin/dir-structure.png", + "sha256": "f167f813eda287ba11b492adc2626f1340f54b2cb03fe77f496ab5f3bbc65db3", + "bytes": 20301 + }, + { + "path": "/images/articles/source/images/sandbox-skills/sandbox-tools.png", + "sha256": "3137100959db409a0fa5b70e25bded4bb47df20c90c3a65a578d7862a4e64a3f", + "bytes": 169802 + }, + { + "path": "/images/articles/source/images/sandbox-skills/sandbox.png", + "sha256": "3a1fd443f4f8008f58144c9e344c2dc50f6faa343c8f65732d9df7d35d93744a", + "bytes": 46498 + }, + { + "path": "/images/articles/source/images/sandbox-skills/skills.png", + "sha256": "6ad86d972c7438fbef898d9d339f3f17a30277bf1626e8a9dd11b0b46583c817", + "bytes": 362173 + } + ] +} diff --git a/scripts/sync-blog-articles.mjs b/scripts/sync-blog-articles.mjs new file mode 100755 index 000000000..b43bdff62 --- /dev/null +++ b/scripts/sync-blog-articles.mjs @@ -0,0 +1,429 @@ +#!/usr/bin/env node + +import { createHash } from "node:crypto"; +import { existsSync } from "node:fs"; +import { cp, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rm, stat, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import process from "node:process"; + +const ROOT = path.resolve(import.meta.dirname, ".."); +const ARTICLE_LOCALES = ["en", "zh", "ja"]; +const MAX_IMAGE_BYTES = 25 * 1024 * 1024; +const LANGUAGE_CONFIG = { + en: { mintlify: "en", tab: "Articles", introTitle: "LangBot Articles", introDescription: "Product updates, engineering deep dives, tutorials, integrations, and announcements from the LangBot Blog.", sourceLabel: "This article is synchronized from the LangBot Blog.", sourceAction: "Read the canonical version", fallbackLabel: "", overviewGroup: "Browse", groups: { updates: "Product Updates", engineering: "Engineering", tutorials: "Tutorials & Integrations", announcements: "Announcements" } }, + zh: { mintlify: "cn", tab: "文章", introTitle: "LangBot 文章", introDescription: "同步自 LangBot Blog 的产品动态、技术解析、教程、集成实践与公告。", sourceLabel: "本文同步自 LangBot Blog。", sourceAction: "阅读 Blog 原文", fallbackLabel: "", overviewGroup: "浏览", groups: { updates: "产品动态", engineering: "技术解析", tutorials: "教程与集成", announcements: "公告" } }, + ja: { mintlify: "jp", tab: "記事", introTitle: "LangBot 記事", introDescription: "LangBot Blog の製品アップデート、技術解説、チュートリアル、連携事例、お知らせをまとめています。", sourceLabel: "この記事は LangBot Blog から同期されています。", sourceAction: "Blog の原文を読む", fallbackLabel: "この記事の日本語版はまだ公開されていないため、英語版を掲載しています。", overviewGroup: "一覧", groups: { updates: "製品アップデート", engineering: "エンジニアリング", tutorials: "チュートリアルと連携", announcements: "お知らせ" } }, +}; +const JAPANESE_TITLES = { + "connect-deepseek-to-wechat": "DeepSeek R1 を WeChat・Discord・Telegram に5分で接続する方法", + "deploy-ai-bot-in-5-minutes": "AI Bot を Discord・Telegram・WeChat に5分でデプロイ", + "dify-agent-discord-telegram-slack": "Dify Agent を Discord・Telegram・Slack で動かす", + "dify-langbot-rag-knowledge-base": "LangBot 4.6.0 外部ナレッジベース入門:Dify と連携した RAG 会話", + "langbot-plugin-system-deep-dive": "LangBot プラグインシステム詳解:プロセス分離・イベント駆動・コンポーネント設計", + "langbot-v4100-sandbox-skills": "LangBot v4.10.0:Agent Sandbox と Skills", + "langbot-v490-rag-plugin-architecture": "LangBot v4.9.0:完全プラグイン化された RAG アーキテクチャ", + "langflow-drag-and-drop-ai-bot": "Langflow のドラッグ&ドロップでマルチプラットフォーム AI Bot を構築", + "langtars-remote-pc-control-dify-n8n": "LangTARS:Dify・n8n と連携するオープンソース PC 操作 Agent", + "n8n-multi-platform-ai-chatbot": "n8n と LangBot でマルチプラットフォーム AI Chatbot を構築", + welcome: "LangBot Blog のご紹介", +}; + +function parseArgs(argv) { + const result = { check: false, source: process.env.LANGBOT_LANDING_REPO || "" }; + for (let i = 0; i < argv.length; i += 1) { + if (argv[i] === "--check") result.check = true; + else if (argv[i] === "--source") result.source = argv[++i]; + else throw new Error(`Unknown argument: ${argv[i]}`); + } + if (result.source) result.source = path.resolve(result.source); + return result; +} +function parseScalar(value) { + const trimmed = value.trim(); + if ((trimmed.startsWith('"') && trimmed.endsWith('"')) || (trimmed.startsWith("'") && trimmed.endsWith("'"))) return trimmed.slice(1, -1).replaceAll('\\"', '"'); + return trimmed; +} +function parseFrontmatter(markdown, file) { + if (!markdown.startsWith("---\n")) throw new Error(`${file}: missing frontmatter`); + const end = markdown.indexOf("\n---\n", 4); + if (end < 0) throw new Error(`${file}: unterminated frontmatter`); + const raw = markdown.slice(4, end); + const body = markdown.slice(end + 5).trimStart(); + const lines = raw.split("\n"); + const data = {}; + for (let i = 0; i < lines.length; i += 1) { + const match = /^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/.exec(lines[i]); + if (!match) continue; + const [, key, value] = match; + if (key === "cover") { + const cover = {}; + while (i + 1 < lines.length && /^\s+/.test(lines[i + 1])) { + const nested = /^\s+([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/.exec(lines[++i]); + if (nested) cover[nested[1]] = parseScalar(nested[2]); + } + data.cover = cover; + } else if (value.startsWith("[") && value.endsWith("]")) { + data[key] = [...value.matchAll(/"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'/g)].map((item) => item[1] ?? item[2]); + } else data[key] = parseScalar(value); + } + for (const required of ["title", "date", "description", "author"]) if (!data[required]) throw new Error(`${file}: missing ${required}`); + return { data, body }; +} +function yamlQuote(value) { return JSON.stringify(String(value)); } +function classify(post) { + const category = String(post.data.categories?.[0] || "").toLowerCase(); + if (category.includes("product") || category.includes("产品") || category.includes("製品")) return "updates"; + if (category.includes("engineering") || category.includes("technical") || category.includes("技术") || category.includes("技術")) return "engineering"; + if (category.includes("announcement") || category.includes("公告") || category.includes("お知らせ")) return "announcements"; + return "tutorials"; +} +function canonicalUrl(locale, slug) { return `https://langbot.app/${locale}/blog/${slug}`; } +function attribution(locale, post) { + if (locale === "zh") return `发布于 ${post.data.date} · 作者:${post.data.author}`; + if (locale === "ja") return `公開日:${post.data.date} · 著者:${post.data.author}`; + return `Published ${post.data.date} · Author: ${post.data.author}`; +} +function escapeMdxProse(markdown) { + const lines = markdown.split("\n"); + let fenced = false; + return lines.map((line) => { + if (/^\s*```/.test(line) || /^\s*~~~/.test(line)) { fenced = !fenced; return line; } + if (fenced) return line.trimEnd(); + return line.split(/(`[^`]*`)/g).map((piece, index) => index % 2 === 1 ? piece : piece.replaceAll("{", "{").replaceAll("}", "}")).join("").trimEnd(); + }).join("\n"); +} +function imageReferences(markdown) { return [...markdown.matchAll(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+["'][^"']*["'])?\)/g)].map((match) => ({ alt: match[1], url: match[2], full: match[0] })); } +function contentTypeExtension(contentType) { + if (contentType.includes("image/png")) return ".png"; + if (contentType.includes("image/jpeg")) return ".jpg"; + if (contentType.includes("image/gif")) return ".gif"; + if (contentType.includes("image/svg")) return ".svg"; + if (contentType.includes("image/webp")) return ".webp"; + return ""; +} +function localImageTarget(sourceUrl) { + if (sourceUrl.startsWith("/")) return `/images/articles/source${sourceUrl}`; + const parsed = new URL(sourceUrl); + let base = path.posix.basename(parsed.pathname) || "image"; + const digest = createHash("sha256").update(sourceUrl).digest("hex").slice(0, 12); + base = base.replace(/[^A-Za-z0-9._-]/g, "-"); + return `/images/articles/external/${digest}-${base}`; +} +function assertWithin(base, candidate, label) { + const normalizedBase = path.resolve(base); + const normalizedCandidate = path.resolve(candidate); + if (!normalizedCandidate.startsWith(`${normalizedBase}${path.sep}`)) throw new Error(`${label} escapes ${normalizedBase}: ${normalizedCandidate}`); +} +async function assertDirectoryWithoutSymlinks(directory, label) { + if (!existsSync(directory)) throw new Error(`${label} does not exist: ${directory}`); + const info = await lstat(directory); + if (!info.isDirectory() || info.isSymbolicLink()) throw new Error(`${label} must be a real non-symlink directory: ${directory}`); + const resolved = await realpath(directory); + if (resolved !== path.resolve(directory)) throw new Error(`${label} path must not traverse symlinks: ${directory}`); + return resolved; +} +async function readRegularFileWithin(base, file, label, encoding = null) { + const baseReal = await assertDirectoryWithoutSymlinks(base, `${label} directory`); + if (!existsSync(file)) throw new Error(`${label} does not exist: ${file}`); + const info = await lstat(file); + if (!info.isFile() || info.isSymbolicLink()) throw new Error(`${label} must be a regular non-symlink file: ${file}`); + const fileReal = await realpath(file); + assertWithin(baseReal, fileReal, label); + return encoding ? readFile(fileReal, encoding) : readFile(fileReal); +} +function validateImageBytes(bytes, label) { + const ascii = bytes.subarray(0, 16).toString("ascii"); + const trimmed = bytes.toString("utf8", 0, Math.min(bytes.length, 1024)).trimStart(); + const valid = + bytes.subarray(0, 8).equals(Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) || + (bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) || + ascii.startsWith("GIF87a") || ascii.startsWith("GIF89a") || + (ascii.startsWith("RIFF") && ascii.slice(8, 12) === "WEBP") || + ((trimmed.startsWith(" MAX_IMAGE_BYTES) throw new Error(`Image exceeds ${MAX_IMAGE_BYTES} bytes: ${sourceUrl}`); + const bytes = Buffer.from(await response.arrayBuffer()); + const contentType = response.headers.get("content-type") || ""; + if (!bytes.length || bytes.length > MAX_IMAGE_BYTES || !contentType.toLowerCase().startsWith("image/")) throw new Error(`Invalid image ${sourceUrl}: ${contentType}, ${bytes.length} bytes`); + validateImageBytes(bytes, sourceUrl); + if (!path.extname(target)) { + const extension = contentTypeExtension(contentType); + if (!extension) throw new Error(`Unsupported image content type for extensionless URL: ${contentType}`); + target += extension; + targetUrl += extension; + await prepareImageTarget(assetRoot, target); + } + if (contentType.toLowerCase().includes("image/svg")) { + await writeFile(target, bytes.toString("utf8").replace(/[ \t]+$/gm, "")); + } else { + await writeFile(target, bytes); + } + return targetUrl; +} +async function loadPosts(sourceRoot) { + const byLocale = new Map(); + const blogRoot = path.join(sourceRoot, "src/content/blog"); + const blogRootReal = await assertDirectoryWithoutSymlinks(blogRoot, "Blog content root"); + for (const locale of ARTICLE_LOCALES) { + const dir = path.join(blogRoot, locale); + const files = existsSync(dir) ? await readdir(dir) : []; + if (existsSync(dir)) { + const localeRootReal = await assertDirectoryWithoutSymlinks(dir, `Blog ${locale} content root`); + assertWithin(blogRootReal, localeRootReal, `Blog ${locale} content root`); + } + const posts = new Map(); + for (const name of files.filter((item) => item.endsWith(".md")).sort()) { + const file = path.join(dir, name); + const parsed = parseFrontmatter(await readRegularFileWithin(dir, file, `Blog ${locale} article`, "utf8"), file); + const slug = name.slice(0, -3); + posts.set(slug, { ...parsed, slug, locale, file }); + } + byLocale.set(locale, posts); + } + const enSlugs = [...byLocale.get("en").keys()].sort(); + const zhSlugs = [...byLocale.get("zh").keys()].sort(); + if (JSON.stringify(enSlugs) !== JSON.stringify(zhSlugs)) throw new Error("English and Chinese blog slug sets differ"); + return { byLocale, slugs: enSlugs }; +} +async function renderArticle(sourceRoot, post, locale, fallback, assetRoot, imageCache) { + const config = LANGUAGE_CONFIG[locale]; + const title = locale === "ja" && fallback ? (JAPANESE_TITLES[post.slug] || post.data.title) : post.data.title; + let body = post.body; + const refs = imageReferences(body); + for (const ref of refs) if (!imageCache.has(ref.url)) imageCache.set(ref.url, await materializeImage(sourceRoot, ref.url, assetRoot)); + if (post.data.cover?.image && !imageCache.has(post.data.cover.image)) imageCache.set(post.data.cover.image, await materializeImage(sourceRoot, post.data.cover.image, assetRoot)); + for (const ref of refs) body = body.replaceAll(ref.full, `![${ref.alt}](${imageCache.get(ref.url)})`); + body = escapeMdxProse(body); + const cover = post.data.cover?.image ? imageCache.get(post.data.cover.image) : ""; + const bodyHasCover = cover && body.includes(`](${cover})`); + const notice = fallback ? `\n> ${config.fallbackLabel}\n` : ""; + const coverBlock = cover && !bodyHasCover ? `\n![${post.data.cover.alt || title}](${cover})\n` : ""; + return `---\ntitle: ${yamlQuote(title)}\ndescription: ${yamlQuote(post.data.description)}\n---\n\n${config.sourceLabel} [${config.sourceAction}](${canonicalUrl(post.locale, post.slug)}).\n\n${attribution(locale, post)}\n${notice}${coverBlock}\n${body.trim()}\n`; +} +function articlePage(locale, slug) { return `${locale}/articles/${slug}`; } +function renderIndex(locale, posts) { + const config = LANGUAGE_CONFIG[locale]; + const lines = ["---", `title: ${yamlQuote(config.introTitle)}`, `description: ${yamlQuote(config.introDescription)}`, "---", "", config.introDescription, ""]; + for (const key of ["updates", "engineering", "tutorials", "announcements"]) { + const inGroup = posts.filter((post) => post.group === key); + if (!inGroup.length) continue; + lines.push(`## ${config.groups[key]}`, ""); + for (const post of inGroup) lines.push(`- [${post.title}](/${articlePage(locale, post.slug)}) — ${post.date}`); + lines.push(""); + } + return `${lines.join("\n").trim()}\n`; +} +function navigationTab(locale, posts) { + const config = LANGUAGE_CONFIG[locale]; + const groups = [{ group: config.overviewGroup, pages: [`${locale}/articles/index`] }]; + for (const key of ["updates", "engineering", "tutorials", "announcements"]) { + const pages = posts.filter((post) => post.group === key).map((post) => articlePage(locale, post.slug)); + if (pages.length) groups.push({ group: config.groups[key], pages }); + } + return { tab: config.tab, groups }; +} +async function validateGenerated(manifest) { + const docs = JSON.parse(await readFile(path.join(ROOT, "docs.json"), "utf8")); + const failures = []; + const referencedImages = new Set(); + for (const locale of ARTICLE_LOCALES) { + const config = LANGUAGE_CONFIG[locale]; + const articleRoot = path.join(ROOT, locale, "articles"); + await assertDirectoryWithoutSymlinks(articleRoot, `${locale} generated article root`); + const language = docs.navigation.languages.find((item) => item.language === config.mintlify); + const tabs = language?.tabs.filter((item) => item.tab === config.tab) || []; + if (tabs.length !== 1) failures.push(`${locale}: expected exactly one ${config.tab} navigation tab, found ${tabs.length}`); + for (const article of manifest.articles.filter((item) => item.locale === locale)) { + const file = path.join(ROOT, `${article.page}.mdx`); + if (!existsSync(file)) failures.push(`missing article: ${article.page}.mdx`); + else { + const content = await readRegularFileWithin(articleRoot, file, `${locale} generated article`, "utf8"); + for (const match of content.matchAll(/!\[[^\]]*\]\((\/images\/[^)]+)\)/g)) { + referencedImages.add(match[1]); + const image = path.join(ROOT, match[1].slice(1)); + if (!existsSync(image) || (await stat(image)).size === 0) failures.push(`${article.page}: missing image ${match[1]}`); + } + } + } + } + const mirroredMetadata = await imageMetadata(ROOT); + const mirroredImages = new Set(mirroredMetadata.map((image) => image.path)); + for (const image of mirroredImages) if (!referencedImages.has(image)) failures.push(`unreferenced mirrored image: ${image}`); + for (const image of referencedImages) if (!mirroredImages.has(image)) failures.push(`referenced image is not mirrored: ${image}`); + const expectedImages = new Map((manifest.images || []).map((image) => [image.path, image])); + for (const image of mirroredMetadata) { + const expected = expectedImages.get(image.path); + if (!expected) failures.push(`mirrored image missing from manifest: ${image.path}`); + else if (expected.sha256 !== image.sha256 || expected.bytes !== image.bytes) failures.push(`mirrored image digest mismatch: ${image.path}`); + } + for (const image of expectedImages.keys()) if (!mirroredImages.has(image)) failures.push(`manifest image is missing: ${image}`); + if (failures.length) throw new Error(`Generated article validation failed:\n${failures.join("\n")}`); +} +async function listFiles(directory) { + if (!existsSync(directory)) return []; + const files = []; + for (const entry of await readdir(directory, { withFileTypes: true })) { + const full = path.join(directory, entry.name); + if (entry.isSymbolicLink()) throw new Error(`Generated content tree must not contain symlinks: ${full}`); + if (entry.isDirectory()) files.push(...await listFiles(full)); + else if (entry.isFile()) files.push(full); + else throw new Error(`Generated content tree must contain only directories and regular files: ${full}`); + } + return files; +} +async function imageMetadata(assetRoot) { + const metadata = []; + for (const file of await listFiles(path.join(assetRoot, "images/articles"))) { + const bytes = await readFile(file); + validateImageBytes(bytes, file); + metadata.push({ + path: `/${path.relative(assetRoot, file).split(path.sep).join("/")}`, + sha256: createHash("sha256").update(bytes).digest("hex"), + bytes: bytes.length, + }); + } + return metadata.sort((a, b) => a.path.localeCompare(b.path)); +} +async function referencedImagesIn(directory) { + const images = new Set(); + for (const file of await listFiles(directory)) { + if (!file.endsWith(".mdx")) continue; + const content = await readFile(file, "utf8"); + for (const match of content.matchAll(/!\[[^\]]*\]\((\/images\/articles\/[^)]+)\)/g)) images.add(match[1]); + } + return images; +} +async function main() { + const args = parseArgs(process.argv.slice(2)); + const manifestPath = path.join(ROOT, "scripts/blog-articles-manifest.json"); + if (args.check && !args.source) { + await validateGenerated(JSON.parse(await readFile(manifestPath, "utf8"))); + console.log("Generated article pages, navigation, and local images are valid."); + return; + } + if (!args.source) throw new Error("Pass --source /path/to/langbot-landing-page or set LANGBOT_LANDING_REPO"); + if (!existsSync(path.join(args.source, "src/content/blog"))) throw new Error(`Not a LangBot landing repository: ${args.source}`); + const { byLocale, slugs } = await loadPosts(args.source); + const outputRoot = await mkdtemp(path.join(tmpdir(), "langbot-wiki-article-sync-")); + const assetRoot = args.check ? outputRoot : ROOT; + const imageCache = new Map(); + const localePosts = new Map(); + const manifest = { source: "https://github.com/langbot-app/langbot-landing-page/tree/main/src/content/blog", articles: [] }; + for (const locale of ARTICLE_LOCALES) { + const renderedPosts = []; + for (const slug of slugs) { + const localized = byLocale.get(locale).get(slug); + const post = localized || byLocale.get("en").get(slug); + const fallback = !localized; + const title = locale === "ja" && fallback ? (JAPANESE_TITLES[slug] || post.data.title) : post.data.title; + renderedPosts.push({ slug, title, date: post.data.date, group: classify(byLocale.get("en").get(slug)), fallback }); + const target = path.join(outputRoot, locale, "articles", `${slug}.mdx`); + await mkdir(path.dirname(target), { recursive: true }); + await writeFile(target, await renderArticle(args.source, post, locale, fallback, assetRoot, imageCache)); + manifest.articles.push({ locale, slug, page: articlePage(locale, slug), sourceLocale: post.locale, fallback }); + } + renderedPosts.sort((a, b) => b.date.localeCompare(a.date) || a.slug.localeCompare(b.slug)); + localePosts.set(locale, renderedPosts); + await writeFile(path.join(outputRoot, locale, "articles", "index.mdx"), renderIndex(locale, renderedPosts)); + } + if (!args.check) { + const referencedImages = await referencedImagesIn(outputRoot); + for (const file of await listFiles(path.join(ROOT, "images/articles"))) { + const publicPath = `/${path.relative(ROOT, file).split(path.sep).join("/")}`; + if (!referencedImages.has(publicPath)) await rm(file, { force: true }); + } + } + manifest.images = await imageMetadata(assetRoot); + if (args.check) { + const mismatches = []; + for (const locale of ARTICLE_LOCALES) { + const generatedDir = path.join(outputRoot, locale, "articles"); + const currentDir = path.join(ROOT, locale, "articles"); + const generatedNames = (await readdir(generatedDir)).sort(); + const currentEntries = existsSync(currentDir) ? await readdir(currentDir, { withFileTypes: true }) : []; + if (currentEntries.some((entry) => !entry.isFile() || entry.isSymbolicLink())) mismatches.push(`${locale}/articles contains non-regular files`); + const currentNames = currentEntries.map((entry) => entry.name).sort(); + if (JSON.stringify(generatedNames) !== JSON.stringify(currentNames)) mismatches.push(`${locale}/articles file set`); + for (const name of generatedNames) { + const generated = await readFile(path.join(generatedDir, name), "utf8"); + const currentFile = path.join(currentDir, name); + const current = existsSync(currentFile) ? await readRegularFileWithin(currentDir, currentFile, `${locale} generated article`, "utf8") : ""; + if (generated !== current) mismatches.push(`${locale}/articles/${name}`); + } + } + const currentManifest = existsSync(manifestPath) ? JSON.parse(await readFile(manifestPath, "utf8")) : null; + if (JSON.stringify(currentManifest) !== JSON.stringify(manifest)) mismatches.push("scripts/blog-articles-manifest.json"); + const currentDocs = JSON.parse(await readFile(path.join(ROOT, "docs.json"), "utf8")); + for (const locale of ARTICLE_LOCALES) { + const config = LANGUAGE_CONFIG[locale]; + const language = currentDocs.navigation.languages.find((item) => item.language === config.mintlify); + const matchingTabs = language?.tabs.filter((item) => item.tab === config.tab) || []; + const currentTab = matchingTabs.length === 1 ? matchingTabs[0] : null; + const expectedTab = navigationTab(locale, localePosts.get(locale)); + if (matchingTabs.length !== 1 || JSON.stringify(currentTab) !== JSON.stringify(expectedTab)) mismatches.push(`docs.json ${config.tab} tab`); + } + await rm(outputRoot, { recursive: true, force: true }); + if (mismatches.length) throw new Error(`Blog articles are out of sync:\n${mismatches.join("\n")}`); + await validateGenerated(JSON.parse(await readFile(manifestPath, "utf8"))); + console.log(`All ${manifest.articles.length} localized article pages are synchronized.`); + return; + } + for (const locale of ARTICLE_LOCALES) { + const targetDir = path.join(ROOT, locale, "articles"); + await rm(targetDir, { recursive: true, force: true }); + await mkdir(path.dirname(targetDir), { recursive: true }); + await cp(path.join(outputRoot, locale, "articles"), targetDir, { recursive: true }); + } + await rm(outputRoot, { recursive: true, force: true }); + const docsPath = path.join(ROOT, "docs.json"); + const docs = JSON.parse(await readFile(docsPath, "utf8")); + for (const locale of ARTICLE_LOCALES) { + const config = LANGUAGE_CONFIG[locale]; + const language = docs.navigation.languages.find((item) => item.language === config.mintlify); + if (!language) throw new Error(`docs.json missing language ${config.mintlify}`); + language.tabs = language.tabs.filter((item) => item.tab !== config.tab); + const apiIndex = language.tabs.findIndex((item) => /API/.test(item.tab)); + language.tabs.splice(apiIndex >= 0 ? apiIndex : language.tabs.length, 0, navigationTab(locale, localePosts.get(locale))); + } + await writeFile(docsPath, `${JSON.stringify(docs, null, 2)}\n`); + await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`); + await validateGenerated(manifest); + console.log(`Synchronized ${slugs.length} posts into ${manifest.articles.length} localized Wiki pages.`); +} +main().catch((error) => { console.error(error.stack || error.message); process.exitCode = 1; }); diff --git a/tests/blog-articles.test.mjs b/tests/blog-articles.test.mjs new file mode 100644 index 000000000..470f1aaf7 --- /dev/null +++ b/tests/blog-articles.test.mjs @@ -0,0 +1,59 @@ +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import { existsSync, readFileSync, statSync } from "node:fs"; +import path from "node:path"; +import test from "node:test"; + +const root = path.resolve(import.meta.dirname, ".."); +const docs = JSON.parse(readFileSync(path.join(root, "docs.json"), "utf8")); +const manifest = JSON.parse(readFileSync(path.join(root, "scripts/blog-articles-manifest.json"), "utf8")); +const localeConfig = { + en: { language: "en", tab: "Articles" }, + zh: { language: "cn", tab: "文章" }, + ja: { language: "jp", tab: "記事" }, +}; + +test("all canonical Blog slugs are published in every Wiki locale", () => { + const slugsByLocale = new Map(); + for (const locale of Object.keys(localeConfig)) { + const items = manifest.articles.filter((article) => article.locale === locale); + assert.ok(items.length > 0, `${locale} has no articles`); + slugsByLocale.set(locale, items.map((article) => article.slug).sort()); + } + assert.deepEqual(slugsByLocale.get("zh"), slugsByLocale.get("en")); + assert.deepEqual(slugsByLocale.get("ja"), slugsByLocale.get("en")); +}); + +test("article tabs group every generated page exactly once", () => { + for (const [locale, config] of Object.entries(localeConfig)) { + const language = docs.navigation.languages.find((item) => item.language === config.language); + const matchingTabs = language.tabs.filter((item) => item.tab === config.tab); + assert.equal(matchingTabs.length, 1, `${locale} must have exactly one ${config.tab} tab`); + const tab = matchingTabs[0]; + const pages = tab.groups.flatMap((group) => group.pages).filter((page) => page !== `${locale}/articles/index`); + const expected = manifest.articles.filter((article) => article.locale === locale).map((article) => article.page); + assert.deepEqual([...pages].sort(), [...expected].sort()); + assert.equal(new Set(pages).size, pages.length, `${locale} has duplicate article navigation entries`); + } +}); + +test("generated articles use only non-empty Wiki-local images", () => { + const expectedImages = new Map(manifest.images.map((image) => [image.path, image])); + for (const article of manifest.articles) { + const file = path.join(root, `${article.page}.mdx`); + assert.ok(existsSync(file), `missing ${article.page}.mdx`); + const content = readFileSync(file, "utf8"); + const imageUrls = [...content.matchAll(/!\[[^\]]*\]\(([^)]+)\)/g)].map((match) => match[1]); + for (const imageUrl of imageUrls) { + assert.match(imageUrl, /^\/images\/articles\//, `${article.page} hotlinks ${imageUrl}`); + const image = path.join(root, imageUrl.slice(1)); + assert.ok(existsSync(image), `${article.page} references missing ${imageUrl}`); + assert.ok(statSync(image).size > 0, `${imageUrl} is empty`); + const bytes = readFileSync(image); + const expected = expectedImages.get(imageUrl); + assert.ok(expected, `${imageUrl} is missing from the synchronization manifest`); + assert.equal(bytes.length, expected.bytes, `${imageUrl} size differs from the manifest`); + assert.equal(createHash("sha256").update(bytes).digest("hex"), expected.sha256, `${imageUrl} digest differs from the manifest`); + } + } +}); diff --git a/zh/articles/connect-deepseek-to-wechat.mdx b/zh/articles/connect-deepseek-to-wechat.mdx new file mode 100644 index 000000000..e289924d0 --- /dev/null +++ b/zh/articles/connect-deepseek-to-wechat.mdx @@ -0,0 +1,101 @@ +--- +title: "5分钟将 DeepSeek R1 接入微信、企业微信与 Discord (免费教程)" +description: "手把手教你使用 LangBot 将 DeepSeek R1/V3 (官方/硅基流动 API) 接入个人微信、企业微信、钉钉和飞书。无需写代码,支持联网搜索与知识库。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/connect-deepseek-to-wechat). + +发布于 2026-02-21 · 作者:LangBot Team + +![DeepSeek x WeChat Integration](/images/articles/source/images/covers/deepseek-wechat.png) + +DeepSeek 已经引爆了 AI 圈。其 R1 推理模型在逻辑能力上媲美 OpenAI o1,但它是开源的,而且 API 价格极低(甚至免费)。 + +然而,DeepSeek 官方目前仅宣布与微信搜索整合,我们在微信群聊、私聊中依然无法直接使用 DeepSeek R1 进行即时问答或协作。 + +**想在你的微信群、企业微信、钉钉或 Discord 频道里直接拥有一个满血版的 DeepSeek R1 机器人吗?** + +使用 **LangBot**,你只需要 5 分钟就能搞定。 + +## 为什么选择 LangBot? + +LangBot 是一个开源的、生产级的即时通信机器人平台。与 GitHub 上零散的 Python 脚本不同,LangBot 提供: + +* **统一平台:** 一次配置,同时部署到微信、QQ、Discord、Telegram、钉钉、飞书等 10+ 个平台。 +* **模型聚合:** 支持 DeepSeek (R1/V3), Claude, GPT-4, Gemini, 以及本地 Ollama 模型。 +* **零代码:** 全图形化 WebUI 配置,无需懂编程。 +* **企业级功能:** 内置知识库 (RAG)、插件系统(联网搜索、绘图)和多用户管理。 + +## 准备工作 + +1. **一台服务器或电脑:** 安装好 Docker (VPS, 本地电脑, 或群晖 NAS 均可)。 +2. **DeepSeek API Key:** + * **官方平台:** [platform.deepseek.com](https://platform.deepseek.com) + * **硅基流动 (推荐):** [cloud.siliconflow.cn](https://cloud.siliconflow.cn) (国内访问更快,并发更高)。 + +## 第一步:部署 LangBot + +如果你还没有部署 LangBot,只需一行命令: + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +部署完成后,浏览器访问 `http://localhost:5300` (或服务器 IP:5300)。 + +## 第二步:配置 DeepSeek 模型 + +1. 进入 **模型 (Models)** -> **提供商列表 (Provider List)**。 +2. 找到 **DeepSeek** (或 **SiliconFlow** / **OpenAI Compatible**)。 +3. 填入你的 API Key。 +4. 点击 **保存**。 + +接着创建一个 **模型实例 (Model Instance)**: +* **名称:** `DeepSeek-R1-Bot` +* **模型 ID:** `deepseek-reasoner` (R1 推理版) 或 `deepseek-chat` (V3 通用版)。 + +## 第三步:创建对话流 (Pipeline) + +LangBot 使用 "Pipeline" 来管理机器人的逻辑。 + +1. 进入 **业务流 (Pipelines)** -> **新建 Pipeline**。 +2. 选择 **对话流 (Chat Pipeline)**。 +3. 选择刚才创建的 `DeepSeek-R1-Bot` 模型。 +4. (可选) 添加系统提示词: + > "你是由 DeepSeek R1 驱动的智能助手。在回答问题前,请先进行深度思考。" + +## 第四步:接入微信 (或任意平台) + +### 接入微信 (个人号 / Wechaty) +*注意:个人号接入存在风险,企业用户建议使用企业微信 (WeCom)。* + +1. 进入 **机器人 (Bots)** -> **新建机器人**。 +2. 选择 **WeChat**。 +3. 选择 **GeweChat** 或 **Wechaty** 适配器。 +4. 点击 **保存**。 +5. 查看日志或界面上的二维码,使用微信扫码登录。 + +### 接入企业微信 / 钉钉 / 飞书 +* 直接在对应平台后台获取 `AppID` 和 `Secret`,填入 LangBot 即可。 + +## 第五步:测试效果! + +打开微信,给机器人发一条消息。你应该能看到 DeepSeek R1 正在“思考”(如果开启了思维链输出),并给出高质量的回答。 + +## 进阶玩法:联网搜索与工具调用 + +DeepSeek 很强,但**带联网搜索的 DeepSeek** 更强。 + +在 LangBot 中: +1. 进入 **插件市场 (Plugins)**。 +2. 安装 **Tavily Search** 或 **Google Search**。 +3. 将插件添加到你的 DeepSeek Pipeline 中。 + +现在,你的机器人可以在回答问题前,先去 Google 搜索最新的实时信息,再结合 DeepSeek R1 的推理能力给出答案! + +--- + +**立即开始构建?** +[GitHub 点个 Star](https://github.com/langbot-app/LangBot) 或 [阅读官方文档](https://docs.langbot.app)。 diff --git a/zh/articles/deploy-ai-bot-in-5-minutes.mdx b/zh/articles/deploy-ai-bot-in-5-minutes.mdx new file mode 100644 index 000000000..7377ba4a6 --- /dev/null +++ b/zh/articles/deploy-ai-bot-in-5-minutes.mdx @@ -0,0 +1,170 @@ +--- +title: "5 分钟部署你的 AI 机器人到 Discord、Telegram 和微信" +description: "手把手教你部署 LangBot —— 开源平台,一条 Docker 命令即可将 20+ 大模型接入 13+ 即时通讯平台。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/deploy-ai-bot-in-5-minutes). + +发布于 2026-02-17 · 作者:LangBot Team + +![LangBot 控制面板](/images/articles/source/images/covers/deploy-ai-bot.png) + +如果你能让 GPT-5、Claude、DeepSeek 和 Gemini 同时在你的 Discord 服务器、Telegram 群组和微信中回答问题呢? + +不需要折腾 API。不需要开发好几周。只需要一条 Docker 命令。 + +这就是 **LangBot** —— GitHub 上已经突破 **15,000 Stars** 的开源项目。 + +## 每个人都会遇到的问题 + +你想在团队的聊天工具里加个 AI 助手。也许是 Telegram 上的客服机器人,也许是 Discord 里的编程助手,也许是企业微信或飞书群里的知识库问答机器人。 + +然后现实来了: + +- 每个平台都有自己的 Bot API、Webhook 格式和认证流程 +- 你需要处理消息队列、会话管理、错误恢复 +- 切换大模型供应商意味着重写整个集成层 +- 加上 RAG 或工具调用又是一个独立项目 + +LangBot 用一个统一的平台解决了所有这些问题。 + +## LangBot 的独特之处 + +### 13+ 即时通讯平台,一套代码 + +部署一个 LangBot 实例,即可连接: + +**海外平台:** Discord、Telegram、Slack、LINE、WhatsApp +**国内平台:** 微信公众号、企业微信、QQ、飞书、钉钉、KOOK + +每个平台都有独立的适配器 —— 你只需要在 WebUI 中填入 Bot Token 即可上线。 + +![LangBot 机器人管理页面](/images/articles/source/images/article-mcp/13-bot-page.png) + +### 20+ 大模型,零锁定 + +通过 **LangBot Space**,开箱即用 20 个云端模型 —— 无需管理 API Key: + +- **Claude**(Opus 4.6、Sonnet 4.5、Haiku 4.5) +- **GPT**(GPT-5.2、GPT-5-mini、GPT-4.1-mini) +- **Gemini**(3 Pro、2.5 Pro、2.5 Flash) +- **DeepSeek**(R1、V3) +- **Grok**(4、4.1) +- **Qwen**(通义千问 3 Max) + +也可以添加自己的模型供应商 —— OpenAI 兼容接口、Ollama 本地模型,随心选择。 + +![模型选择](/images/articles/source/images/article-mcp/08-model-select.png) + +### 内置 Agent 与工具调用 + +LangBot 的本地 Agent 不仅仅是聊天封装 —— 它是一个完整的智能体运行时: + +- **多轮对话** —— 可配置的上下文记忆 +- **函数调用 / 工具使用** —— LLM 驱动的动作执行 +- **MCP(模型上下文协议)** —— 连接 100+ 预置工具 +- **知识库(RAG)** —— 内置向量检索 + +![流水线 AI 配置](/images/articles/source/images/article-mcp/06-pipeline-ai.png) + +### 插件市场 + +37+ 社区插件,持续增长 —— 一键安装: + +- **WebSearch** —— 让机器人搜索网页 +- **AI Image Generator** —— 文字生成图片 +- **LinkAnaly** —— 自动预览聊天中的链接 +- **ScheNotify** —— 用自然语言设置定时提醒 +- **Google Search**、**Tavily Search**、**RAGFlow Retriever** 等 + +![LangBot Space 插件市场](/images/articles/source/images/article-mcp/14-space-market.png) + +## 5 分钟部署 —— 真的只要 5 分钟 + +### 第 1 步:运行 Docker Compose + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +就这样。LangBot 已经运行在 `http://localhost:5300`。 + +### 第 2 步:用 LangBot Space 初始化 + +打开 WebUI,点击 **「Initialize with Space」**。这会将你的实例连接到 LangBot Space,获得: + +- 20 个开箱即用的云端模型(附赠免费额度) +- 一键安装插件 +- 托管式 API Key 管理 + +![用 Space 初始化](/images/articles/source/images/article-mcp/01-init-page.png) + +### 第 3 步:配置流水线 + +进入 **流水线** 页面,编辑默认的 `ChatPipeline`: + +1. 选择模型(如 `deepseek-v3`、`gpt-5-mini`、`claude-sonnet-4-5`) +2. 自定义系统提示词 +3. 可选:关联知识库或启用工具调用 + +![流水线页面](/images/articles/source/images/article-mcp/05-pipelines.png) + +### 第 4 步:接入平台 + +进入 **机器人** → 点击 **+** → 选择平台(Discord、Telegram 等) → 填入 Bot Token。 + +搞定。你的机器人已经上线了。 + +### 第 5 步:测试 + +使用内置的 **Debug Chat** 在上线前测试流水线: + +![调试聊天](/images/articles/source/images/article-mcp/07-debug-chat.png) + +## 真实对话,真实价值 + +下面是 LangBot 在 QQ 群中运行的实际效果 —— 用户提出技术问题,即刻获得准确回答: + +![群聊演示](/images/articles/source/images/article-mcp/10-group-chat.png) + +私聊场景: + +![私聊演示](/images/articles/source/images/article-mcp/11-private-chat.png) + +## 为生产环境打造的架构 + +LangBot 为生产环境而生: + +- **流水线架构** —— 每个机器人绑定一条流水线,流水线处理 AI 逻辑、触发条件、安全控制和输出格式 +- **跨进程插件隔离** —— 一个有问题的插件不会崩溃你的机器人 +- **多运行器后端** —— 使用 LangBot 内置 Agent,或接入 Dify、n8n、Langflow、Coze 构建复杂工作流 +- **灵活的数据库** —— 开发用 SQLite,生产用 PostgreSQL +- **多种向量数据库** —— Chroma、Qdrant、Milvus、pgvector、SeekDB + +## 为什么 15,000+ 开发者选择 LangBot + +| 功能 | LangBot | 从零开发 | +|------|---------|---------| +| 平台支持 | 13+ 即开即用 | 每个平台数周 | +| 模型供应商 | 20+ 模型 | 手动对接 | +| Agent 运行时 | 内置 | 自己搭建 | +| RAG | 原生 + 外部集成 | 独立项目 | +| 插件系统 | 有市场 | DIY | +| 部署 | `docker compose up` | 数天搭建 | +| WebUI | 自带 | 自己开发 | + +## 立即开始 + +- **GitHub:** [github.com/langbot-app/LangBot](https://github.com/langbot-app/LangBot) —— 来点个 Star 吧! +- **文档:** [docs.langbot.app](https://docs.langbot.app) +- **插件市场:** [space.langbot.app](https://space.langbot.app) + +```bash +git clone https://github.com/langbot-app/LangBot +cd LangBot/docker +docker compose up -d +``` + +一条命令,开启你的 AI 机器人帝国。 diff --git a/zh/articles/dify-agent-discord-telegram-slack.mdx b/zh/articles/dify-agent-discord-telegram-slack.mdx new file mode 100644 index 000000000..adcf26975 --- /dev/null +++ b/zh/articles/dify-agent-discord-telegram-slack.mdx @@ -0,0 +1,115 @@ +--- +title: "终于让 Dify Agent 在 Discord、Telegram 和 Slack 上跑起来了" +description: "终于让 Dify Agent 在 Discord、Telegram 和 Slack 上跑起来了" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/dify-agent-discord-telegram-slack). + +发布于 2025-12-11 · 作者:LangBot Team + +![终于让 Dify Agent 在 Discord、Telegram 和 Slack 上跑起来了](/images/articles/source/images/covers/dify-agent.png) + +想让你的 Dify Agent 突破浏览器限制,直接在 QQ、微信、Telegram 里对话?LangBot 配合 Dify,十分钟就能搞定。 + +## 为什么要这么搭? + +[**LangBot**](https://github.com/langbot-app/LangBot) 是目前最强大的开源多平台聊天机器人框架,支持国内主流 IM(QQ、微信、飞书、钉钉)以及国际平台(Telegram、Discord、Slack、LINE)。它的核心能力就是把各种 AI 后端接入到聊天软件里。 + +**Dify** 是当下最火的 AI 应用开发平台,提供可视化 Agent 编排、50 多个内置工具、RAG 知识库等功能。两者结合,可以快速打造跨平台 AI 助手。 + +## 部署 LangBot + +用 uvx 三行命令搞定: + +```bash +mkdir langbot-instance +cd langbot-instance +uvx langbot@latest +``` + +访问 `http://127.0.0.1:5300`,注册管理员账号: + +![LangBot Dashboard](/images/articles/external/c6d52212ba91-02-langbot-dashboard.png) + +## 创建 Dify Agent + +登录 [cloud.dify.ai](https://cloud.dify.ai) 创建新应用。选择 **Agent** 类型——与普通聊天应用不同,Agent 可以自主推理并调用工具完成复杂任务。 + +![Select Agent Type](/images/articles/external/3e5b1d8ec6ec-07-dify-create-app-types.png) + +### 配置 Agent + +在编排界面配置: + +**System Instructions** - 定义 Agent 角色: + +``` +You are an intelligent assistant that helps users complete various tasks. You have the following capabilities: +1. Answer various user questions +2. Query weather information +3. Retrieve webpage content + +Please always maintain a friendly and professional attitude. If you need to use tools to get information, proactively call the relevant tools. +``` + +**添加工具** - 从 Dify 的 50+ 内置工具中选择,比如天气查询和网页抓取: + +![Add Tools](/images/articles/external/9066d99b172c-11-dify-tools-panel.png) + +**选择模型** - 支持 GPT、Claude、Gemini、DeepSeek 等主流 LLM。 + +配置完成效果: + +![Configuration Complete](/images/articles/external/be278ca435e8-12-dify-agent-configured.png) + +### 获取 API Key + +点击"发布",然后进入"访问 API"创建密钥: + +![Create API Key](/images/articles/external/471b316018e5-13-dify-api-key-created.png) + +保存好 API key 和服务器地址 `https://api.dify.ai/v1`。 + +## 连接 Dify 到 LangBot + +回到 LangBot,进入 Pipelines > ChatPipeline > AI 能力: + +![AI Capability Config](/images/articles/external/8f4b3820ed5b-14-langbot-pipeline-ai-capability.png) + +选择 **Dify Service API** 作为 Runner: + +![Select Dify Runner](/images/articles/external/efa6fcae9c58-15-langbot-runner-dropdown.png) + +填写配置: +- **Base URL**: `https://api.dify.ai/v1` +- **API Key**: 刚才创建的密钥 +- **App Type**: Chat(包括 Chatflow) + +![Enter Configuration](/images/articles/external/74f71a8bf1dc-17-langbot-dify-api-key-entered.png) + +保存后点击"调试对话"测试: + +![Test Conversation](/images/articles/external/9999c12907eb-20-langbot-chat-test.png) + +如果 Agent 能正确回复并调用工具,说明集成成功。 + +## 这种架构的优势 + +- **解耦设计**:Agent 能力在 Dify 中维护,LangBot 负责消息路由,各司其职 +- **一份配置,多端生效**:同一个 Agent 可以同时服务 QQ、微信、Telegram 等多个平台 +- **易于扩展**:后续可以在 Dify 中添加 RAG 知识库、工作流编排、更多工具等 + +## 下一步 + +- 在 LangBot 中配置消息平台(QQ 机器人、微信个人号等) +- 在 Dify 中添加更多工具(数据库查询、API 调用等) +- 尝试 Dify Chatflow 实现更复杂的对话流程 + +如果你在用 n8n、FastGPT、Coze 或 Langflow,LangBot 也都支持。 + +--- + +**相关资源** + +- [LangBot 文档](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Dify 文档](https://docs.dify.ai) | [云端平台](https://cloud.dify.ai) diff --git a/zh/articles/dify-langbot-rag-knowledge-base.mdx b/zh/articles/dify-langbot-rag-knowledge-base.mdx new file mode 100644 index 000000000..54607ddf0 --- /dev/null +++ b/zh/articles/dify-langbot-rag-knowledge-base.mdx @@ -0,0 +1,204 @@ +--- +title: "LangBot 4.6.0 外部知识库教程:集成 Dify 实现 RAG 对话" +description: "LangBot 4.6.0 外部知识库教程:集成 Dify 实现 RAG 对话" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/dify-langbot-rag-knowledge-base). + +发布于 2025-12-02 · 作者:LangBot Team + +![LangBot 4.6.0 外部知识库教程:集成 Dify 实现 RAG 对话](/images/articles/source/images/covers/dify-rag.png) + +LangBot 4.6.0 引入了外部知识库功能,允许用户将 Dify、RAGFlow 等外部知识检索服务集成到对话流水线中。本教程演示如何将 Dify 知识库与 LangBot 结合,实现基于领域知识的智能对话。 + +## 功能概述 + +外部知识库功能使 LangBot 能够: +- 连接各种外部知识检索服务(Dify、RAGFlow 等) +- 基于领域专业知识提供专业回答 +- 通过插件系统灵活扩展知识检索能力 +- 通过 WebUI 便捷配置,无需手动编辑配置文件 + +## 准备工作 + +开始之前,你需要: +1. 部署 LangBot 4.6.0 或更高版本 +2. 拥有 Dify 账号(在 https://cloud.dify.ai 注册) +3. 配置一个对话模型(本教程使用 claude-opus-4-1-20250805) + +## 第一步:部署 LangBot + +### 1.1 查看 LangBot 仓库 + +首先访问 [LangBot GitHub 仓库](https://github.com/langbot-app/LangBot) 了解项目。LangBot 是一个生产级的即时通讯机器人开发平台,支持多种消息平台和 LLM 服务。 + +### 1.2 了解外部知识库功能 + +访问 [LangBot 官方文档](https://docs.langbot.app) 查看外部知识库使用说明。文档详细介绍了如何构建内置知识库和连接外部知识库。 + +### 1.3 启动 LangBot + +使用 `uvx langbot` 命令快速启动 LangBot,然后访问 http://127.0.0.1:5300 进行初始化。填写邮箱和密码完成注册,然后登录。 + +### 1.4 登录后的控制台 + +成功登录后,你将看到 LangBot WebUI 控制台。 + +## 第二步:配置对话模型 + +使用知识库之前,需要先配置一个对话模型。 + +### 2.1 进入模型配置页面 + +点击左侧导航栏的 "Models" 进入模型配置页面。 + +### 2.2 添加新模型 + +点击 "+" 按钮打开模型配置对话框。 + +### 2.3 填写模型信息 + +填写以下信息: +- **Model Name**:claude-opus-4-1-20250805 +- **Model Provider**:New API +- **Request URL**:你的 API 端点 +- **API Key**:你的 API Key +- **Abilities**:勾选 Vision Ability 和 Function Call + +点击 "Submit" 保存配置。 + +## 第三步:在 Dify 中创建知识库 + +### 3.1 登录 Dify 平台 + +访问 https://cloud.dify.ai 并登录你的账号。 + +### 3.2 进入知识库页面 + +点击顶部导航栏的 "Knowledge" 进入知识库管理页面。 + +### 3.3 创建新知识库 + +点击 "Create Knowledge" 开始创建知识库。 + +### 3.4 选择数据源 + +你可以选择以下方式导入数据: +- **Import from file**:上传文档文件 +- **Sync from Notion**:从 Notion 同步 +- **Sync from website**:爬取网站内容 + +本教程选择 "Import from file" 并上传准备好的 LangBot 文档。 + +### 3.5 上传文档 + +上传文档后,系统会显示文件信息。点击 "Next" 继续。 + +### 3.6 配置文档处理参数 + +在文档处理页面,你可以配置分块设置、索引方式和检索设置: +- **Chunk Settings**:General 模式,最大块长度 1024 字符 +- **Index Method**:High Quality(使用 embedding 模型) +- **Retrieval Setting**:Vector Search + +点击 "Save & Process" 开始处理文档。 + +### 3.7 知识库处理中 + +系统开始处理文档并生成向量嵌入。 + +### 3.8 嵌入完成 + +处理完成后,知识库即可使用。 + +## 第四步:获取 Dify API 信息 + +### 4.1 打开 Service API 面板 + +点击右下角的 "Service API" 按钮。记录以下信息: +- **Service API Endpoint**:https://api.dify.ai/v1 +- **Dataset ID**:从 URL 中获取 + +### 4.2 获取 API Key + +点击 "API Key" 按钮查看 API key。记录你的 API Key,用于后续配置。 + +## 第五步:在 LangBot 中配置外部知识库 + +### 5.1 进入知识库页面 + +在 LangBot WebUI 中,点击左侧导航栏的 "Knowledge"。 + +### 5.2 切换到外部知识库标签页 + +点击 "External" 标签页。 + +### 5.3 添加外部知识库 + +点击 "+" 按钮打开添加外部知识库对话框。在此对话框中,你需要: +1. **Knowledge Base Name**:给知识库起个名字 +2. **Knowledge Base Description**:添加描述(可选) +3. **Retriever**:选择知识检索插件 + +**注意**:使用外部知识库需要先安装对应的知识检索插件。你可以在[插件市场](https://space.langbot.app/market?category=KnowledgeRetriever)中搜索并安装 Dify 知识检索插件。 + +安装插件后,从 Retriever 下拉菜单中选择对应插件,然后填写从 Dify 获取的配置信息(API Endpoint、API Key、Dataset ID)。 + +## 第六步:配置 Pipeline + +配置好外部知识库后,需要在流水线中启用: + +1. 进入 "Pipelines" 页面 +2. 编辑或创建新流水线 +3. 在 "AI Capabilities" 页面,选择 "Built-in Agent" 作为 runner +4. 在知识库选择中,勾选刚才配置的外部知识库 +5. 保存流水线配置 + +## 第七步:测试效果 + +在流水线的 "Conversation Testing" 页面测试,或将流水线绑定到机器人进行实际对话测试。当用户提问时,LangBot 会自动从 Dify 知识库检索相关内容,并结合检索到的知识生成回答。 + +## 常见问题 + +### 1. 如何安装知识检索插件? + +访问 [LangBot 插件市场](https://space.langbot.app/market),搜索 "Knowledge Retriever" 或 "Dify",找到对应插件并点击安装。 + +### 2. 支持哪些外部知识检索服务? + +LangBot 目前通过插件系统支持多种外部知识检索服务,包括: +- Dify +- RAGFlow +- 其他自定义知识检索服务 + +具体支持的服务可在插件市场查看。 + +### 3. 外部知识库和内置知识库有什么区别? + +- **内置知识库**:数据存储在 LangBot 本地,由 LangBot 处理向量化和检索 +- **外部知识库**:数据存储在外部服务(如 Dify),通过 API 调用进行检索 + +外部知识库的优势是可以利用专业 LLMOps 平台的能力,如 Dify 的高级文档处理和多种检索策略。 + +### 4. 可以同时使用多个知识库吗? + +可以。在流水线配置中,你可以同时勾选多个知识库(内置或外部),LangBot 会综合利用这些知识库的内容生成回答。 + +## 总结 + +通过本教程,你学会了如何: +1. 在 Dify 平台上创建知识库并上传文档 +2. 获取 Dify API key 和相关配置信息 +3. 在 LangBot 中配置对话模型 +4. 在 LangBot 中添加外部知识库 +5. 配置流水线使用外部知识库 + +外部知识库功能为 LangBot 提供了更强大、更灵活的知识管理能力。结合 Dify 等专业 LLMOps 平台,可以构建更智能、更专业的对话机器人。 + +## 相关资源 + +- [LangBot 官网](https://langbot.app) +- [LangBot 文档](https://docs.langbot.app) +- [LangBot GitHub](https://github.com/langbot-app/LangBot) +- [Dify 官网](https://dify.ai) +- [LangBot 插件市场](https://space.langbot.app/market) diff --git a/zh/articles/index.mdx b/zh/articles/index.mdx new file mode 100644 index 000000000..e78120498 --- /dev/null +++ b/zh/articles/index.mdx @@ -0,0 +1,30 @@ +--- +title: "LangBot 文章" +description: "同步自 LangBot Blog 的产品动态、技术解析、教程、集成实践与公告。" +--- + +同步自 LangBot Blog 的产品动态、技术解析、教程、集成实践与公告。 + +## 产品动态 + +- [LangBot Cloud 新版上线:多用户 Workspace 也来到开源版](/zh/articles/langbot-cloud-multi-user-workspaces) — 2026-08-25 + +## 技术解析 + +- [LangBot v4.10.0:Agent 沙箱与技能——让 Agent 真正像开发者一样工作](/zh/articles/langbot-v4100-sandbox-skills) — 2026-06-04 +- [LangBot v4.9.0:知识库全面插件化——RAG 引擎、解析器与无边界知识架构](/zh/articles/langbot-v490-rag-plugin-architecture) — 2026-03-10 +- [深入 LangBot 插件系统:进程隔离、事件驱动与组件化架构](/zh/articles/langbot-plugin-system-deep-dive) — 2026-02-23 + +## 教程与集成 + +- [LangTARS:开源 AI Agent 远程控制电脑 — 支持接入 Dify 和 n8n 工作流](/zh/articles/langtars-remote-pc-control-dify-n8n) — 2026-03-23 +- [5分钟将 DeepSeek R1 接入微信、企业微信与 Discord (免费教程)](/zh/articles/connect-deepseek-to-wechat) — 2026-02-21 +- [5 分钟部署你的 AI 机器人到 Discord、Telegram 和微信](/zh/articles/deploy-ai-bot-in-5-minutes) — 2026-02-17 +- [终于让 Dify Agent 在 Discord、Telegram 和 Slack 上跑起来了](/zh/articles/dify-agent-discord-telegram-slack) — 2025-12-11 +- [用 Langflow 拖拽式工作流构建多平台 AI 机器人](/zh/articles/langflow-drag-and-drop-ai-bot) — 2025-12-05 +- [用 n8n 和 LangBot 构建多平台 AI 聊天机器人](/zh/articles/n8n-multi-platform-ai-chatbot) — 2025-12-03 +- [LangBot 4.6.0 外部知识库教程:集成 Dify 实现 RAG 对话](/zh/articles/dify-langbot-rag-knowledge-base) — 2025-12-02 + +## 公告 + +- [LangBot 博客正式上线](/zh/articles/welcome) — 2026-02-17 diff --git a/zh/articles/langbot-cloud-multi-user-workspaces.mdx b/zh/articles/langbot-cloud-multi-user-workspaces.mdx new file mode 100644 index 000000000..595c5e31a --- /dev/null +++ b/zh/articles/langbot-cloud-multi-user-workspaces.mdx @@ -0,0 +1,68 @@ +--- +title: "LangBot Cloud 新版上线:多用户 Workspace 也来到开源版" +description: "LangBot 是连接大模型与聊天平台的开源 AI 机器人平台。新版 Cloud 与开源版现已支持 Workspace 多用户、成员邀请和角色权限。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langbot-cloud-multi-user-workspaces). + +发布于 2026-08-25 · 作者:LangBot Team + +![LangBot 多用户 Workspace 控制台](/images/articles/source/images/cloud-multi-user/oss-dashboard.png) + +新版 [LangBot Cloud](https://cloud.langbot.app) 已经上线。这次先解决一个很具体的问题:多人一起用 LangBot 时,账户、资源和权限怎么分。 + +同一套多用户能力也进入了开源版。Cloud 和自部署版的运维方式不同,但成员、邀请和权限的基本逻辑现在是一致的。 + +## LangBot 是什么? + +LangBot 是一个开源的多平台 AI 机器人开发与部署平台。你可以在同一套控制台里配置机器人、消息流水线、知识库、模型和扩展,再将 AI 能力接入 QQ、微信、企业微信、飞书、钉钉、KOOK、Discord、Telegram、Slack 和 LINE。它也支持 Satori 与 Matrix;通过 Matrix 桥接,还可以覆盖 WhatsApp、Signal、Messenger、Mattermost、Google Chat、IRC、XMPP、Zulip 等网络。 + +模型侧不绑定一家厂商。LangBot 可以连接 OpenAI、Anthropic Claude、DeepSeek、Google Gemini、xAI Grok、Moonshot Kimi、智谱 GLM,也支持通过 Ollama 和 LM Studio 运行本地模型。阿里云百炼、火山方舟、SiliconFlow、ModelScope、GiteeAI 等聚合平台同样可以接入;需要组合现有工作流时,还能连接 Dify 和 MCP。 + +这意味着,同一个团队可以用 LangBot 管理不同聊天平台上的 AI 助手,同时按场景选择云端大模型、本地模型或已有 Agent 工作流。 + +![新版 LangBot Cloud 登录页](/images/articles/source/images/cloud-multi-user/cloud-login.png) + +## Cloud:登录后进入自己的 Workspace + +Cloud 统一使用 LangBot Account 登录。首次使用会进入个人 Workspace,也可以接受邀请加入团队 Workspace;加入多个 Workspace 后,可以在界面中切换当前工作区。 + +机器人、流水线、模型、知识库和扩展都归属于当前 Workspace。切换 Workspace,不会把不同团队的配置和数据混在一起。 + +Cloud 仍然负责托管、更新和运行环境。适合不想自己维护服务器,或者希望团队直接开始配置机器人的用户。 + +## 邀请成员,不再共用一个管理员账号 + +Owner 或有成员管理权限的角色可以发出一次性邀请。被邀请人使用自己的账户接受邀请,随后以分配到的角色进入 Workspace。 + +![LangBot Cloud 成员邀请页(Workspace 名称已脱敏)](/images/articles/source/images/cloud-multi-user/cloud-invitation.png) + +这比共享管理员密码更适合长期使用:每个人有独立身份,权限也能按工作需要分开。 + +当前提供五个固定角色: + +- **Owner**:Workspace 所有者,负责最高权限和成员管理。 +- **Admin**:管理成员和大部分 Workspace 设置。 +- **Developer**:配置机器人、流水线、模型和扩展。 +- **Operator**:负责日常运行与操作。 +- **Viewer**:只读查看。 + +## 开源版:一个实例,一个 Workspace,支持多人 + +自部署版不会变成多 Workspace SaaS。一个 LangBot 实例仍然对应一个 Workspace,但这个 Workspace 可以有多个用户。 + +初始化时创建的账户是 Owner。之后可以邀请其他人加入;配置了 SMTP 时可直接发送邀请邮件,没有配置邮件服务时也可以复制一次性邀请链接,通过可信渠道发给成员。 + +成员进入后,看到的仍是熟悉的 LangBot 控制台。区别在于资源访问会结合 Workspace 和角色校验,而不是默认所有登录用户都拥有完整管理员权限。 + +## 该选哪一个? + +| | LangBot Cloud | 开源自部署版 | +|---|---|---| +| 部署维护 | 由 LangBot 托管 | 自己维护服务器和数据 | +| Workspace | 可拥有或加入多个 | 每个实例固定一个 | +| 多用户与邀请 | 支持 | 支持 | +| 固定角色权限 | 支持 | 支持 | +| 适合 | 快速启用、团队直接协作 | 私有部署、掌握运行环境 | + +想直接使用,可以访问 [cloud.langbot.app](https://cloud.langbot.app)。想把数据和运行环境留在自己的服务器上,可以从 [GitHub](https://github.com/langbot-app/LangBot) 部署开源版。 diff --git a/zh/articles/langbot-plugin-system-deep-dive.mdx b/zh/articles/langbot-plugin-system-deep-dive.mdx new file mode 100644 index 000000000..d8ed073ea --- /dev/null +++ b/zh/articles/langbot-plugin-system-deep-dive.mdx @@ -0,0 +1,464 @@ +--- +title: "深入 LangBot 插件系统:进程隔离、事件驱动与组件化架构" +description: "从源码层面深入剖析 LangBot 4.0 插件系统的架构设计——进程隔离通信、事件驱动钩子、组件化扩展模型,以及与 Dify/MCP 等系统的对比思考。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langbot-plugin-system-deep-dive). + +发布于 2026-02-23 · 作者:LangBot Team + +![LangBot Plugin System](/images/articles/source/images/covers/plugin-system.png) + +大多数聊天机器人框架的"插件系统"不过是一个 Python 模块的动态导入。LangBot 4.0 选择了一条更难但更正确的路——**每个插件运行在独立进程中**,通过结构化的 JSON-RPC 风格协议与宿主通信。 + +这篇文章将从源码出发,完整拆解这套系统的设计。 + +## 整体架构:三层进程模型 + +LangBot 的插件系统由三层进程协作: + +![LangBot 插件系统三层架构](/images/articles/source/images/plugin-system/architecture.png) + +**三个层次各司其职:** + +1. **LangBot 主进程**:运行业务逻辑(消息处理流水线、平台适配、模型调用),通过 `PluginRuntimeConnector` 连接 Runtime。 +2. **Plugin Runtime**:插件的"编排层",负责发现、启动、管理所有插件子进程,接收主进程的指令并分发到对应插件。 +3. **插件子进程**:每个插件独立运行在自己的 Python 进程中,通过 stdio 管道与 Runtime 通信。 + +### 为什么要三层而不是两层? + +直觉的设计是主进程直接管理插件进程。LangBot 选择中间加一层 Runtime 的原因是**部署灵活性**: + +- **本地开发**:主进程通过 stdio 直接启动 Runtime 子进程(零配置) +- **Docker 生产环境**:Runtime 作为独立容器运行,主进程通过 WebSocket 连接 +- **Windows 兼容**:由于 Windows 的 asyncio 不完整支持 stdio 子进程,Windows 上自动降级为 WebSocket 通信 + +这意味着同一套代码,不改配置,就能适配从开发到生产的全部场景。 + +## 通信协议:JSON-RPC 风格的请求/响应 + +所有跨进程通信基于一个统一的协议层。核心数据结构非常简洁: + +```python +# 请求 +class ActionRequest(pydantic.BaseModel): + seq_id: int # 序列号,用于匹配请求和响应 + action: str # 动作名称 + data: dict # 载荷 + +# 响应 +class ActionResponse(pydantic.BaseModel): + seq_id: int + code: int # 0 = 成功 + message: str + data: dict + chunk_status: str # "continue" | "end"(支持流式响应) +``` + +通信层 `Handler` 是整个系统的核心抽象。它同时扮演 RPC 客户端和服务端: + +```python +class Handler: + async def call_action(self, action, data, timeout=15.0) -> dict: + """主动调用对端提供的 action,等待响应""" + self.seq_id_index += 1 + request = ActionRequest.make_request(self.seq_id_index, action.value, data) + future = asyncio.Future() + self.resp_waiters[self.seq_id_index] = future + await self.conn.send(json.dumps(request.model_dump())) + response = await asyncio.wait_for(future, timeout) + return response.data + + @action(SomeAction.DO_SOMETHING) + async def handle_something(data: dict) -> ActionResponse: + """注册一个 action 供对端调用""" + return ActionResponse.success({"result": "ok"}) +``` + +**关键设计点:** + +- 基于 `seq_id` 的请求/响应匹配,支持全双工并发调用 +- 支持流式响应(`chunk_status`),用于命令执行等长时间操作 +- 大消息自动分块传输(stdio 16KB / WebSocket 64KB 分块) +- 文件传输通过 base64 分块机制实现,不走消息通道 + +### Action 枚举:清晰的 API 契约 + +系统通过四组枚举严格定义了所有跨进程调用: + +```python +# 插件 → Runtime(插件进程主动请求) +class PluginToRuntimeAction: + REGISTER_PLUGIN = "register_plugin" + SEND_MESSAGE = "send_message" # 发送消息到平台 + INVOKE_LLM = "invoke_llm" # 调用大模型 + SET_PLUGIN_STORAGE = "set_plugin_storage" # 持久化存储 + # ... + +# Runtime → 插件(Runtime 下发指令) +class RuntimeToPluginAction: + INITIALIZE_PLUGIN = "initialize_plugin" + EMIT_EVENT = "emit_event" # 触发事件 + CALL_TOOL = "call_tool" # 调用工具 + EXECUTE_COMMAND = "execute_command" # 执行命令 + SHUTDOWN = "shutdown" + # ... + +# LangBot 主进程 → Runtime +class LangBotToRuntimeAction: + INSTALL_PLUGIN = "install_plugin" + EMIT_EVENT = "emit_event" + LIST_TOOLS = "list_tools" + # ... + +# Runtime → LangBot 主进程 +class RuntimeToLangBotAction: + GET_PLUGIN_SETTINGS = "get_plugin_settings" + SET_BINARY_STORAGE = "set_binary_storage" + # ... +``` + +这种设计让 API 边界一目了然:插件能做什么、不能做什么,全部由枚举定义。 + +## 插件生命周期 + +一个插件从安装到运行,经历以下阶段: + +### 1. 发现(Discovery) + +Runtime 启动时扫描 `data/plugins/` 目录: + +```python +async def launch_all_plugins(self): + for plugin_path in glob.glob("data/plugins/*"): + if not os.path.isdir(plugin_path): + continue + task = self.launch_plugin(plugin_path) + self.plugin_run_tasks.append(task) +``` + +目录名约定为 `{author}__{name}`,每个目录包含 `manifest.yaml` 和插件代码。 + +### 2. 启动(Launch) + +Runtime 为每个插件启动独立子进程: + +```python +async def launch_plugin(self, plugin_path: str): + python_path = sys.executable + args = ["-m", "langbot_plugin.cli.__init__", "run", "-s", "--prod"] + + ctrl = StdioClientController( + command=python_path, + args=args, + working_dir=plugin_path, # 每个插件在自己的目录下运行 + ) + await ctrl.run(new_plugin_connection_callback) +``` + +**关键细节**:插件进程的工作目录设置为插件自身目录,这实现了天然的文件系统隔离。 + +### 3. 注册(Register) + +插件进程启动后,主动向 Runtime 注册自己: + +```python +# 插件侧 +action = PluginToRuntimeAction.REGISTER_PLUGIN +# 携带:manifest、组件列表、配置 schema 等 + +# Runtime 侧处理注册 +async def register_plugin(self, handler, container_data, debug_plugin=False): + plugin_container = PluginContainer.from_dict(container_data) + # 从主进程获取插件配置 + plugin_settings = await self.context.control_handler.call_action( + RuntimeToLangBotAction.GET_PLUGIN_SETTINGS, {...} + ) + # 初始化插件(下发配置) + await handler.initialize_plugin(plugin_settings) + # 存储插件容器 + self.plugins.append(plugin_container) +``` + +### 4. 运行(Running) + +插件进入 `INITIALIZED` 状态后,即可接收事件、工具调用、命令执行等请求。 + +### 5. 卸载(Shutdown) + +```python +async def shutdown_plugin(self, plugin_container): + # 1. 通知插件进程关闭 + await plugin_container._runtime_plugin_handler.shutdown_plugin() + # 2. 关闭通信连接 + await plugin_container._runtime_plugin_handler.conn.close() + # 3. 终止子进程 + if handler.stdio_process is not None: + handler.stdio_process.kill() + await asyncio.wait_for(handler.stdio_process.wait(), timeout=2) +``` + +## 组件系统:四种扩展类型 + +LangBot 的插件不是一个单一的 hook 函数,而是一个**组件容器**。一个插件可以同时提供多种类型的组件: + +### EventListener(事件监听器) + +最基础的扩展方式——监听流水线中的事件: + +```python +from langbot_plugin.api.definition.components.common.event_listener import EventListener +from langbot_plugin.api.entities.events import PersonNormalMessageReceived +from langbot_plugin.api.entities.context import EventContext + +class MyListener(EventListener): + @EventListener.handler(PersonNormalMessageReceived) + async def on_person_message(self, ctx: EventContext): + event = ctx.event + # 修改用户消息(在发送给 LLM 之前) + event.user_message_alter = "请用诗歌形式回答:" + event.text_message + + # 或者阻止后续处理 + # ctx.prevent_default() + # ctx.prevent_postorder() +``` + +支持的事件类型覆盖消息处理的完整生命周期: + +| 事件 | 触发时机 | +|------|---------| +| `PersonMessageReceived` | 收到私聊消息 | +| `GroupMessageReceived` | 收到群聊消息 | +| `PersonNormalMessageReceived` | 判定为需处理的私聊消息 | +| `GroupNormalMessageReceived` | 判定为需处理的群聊消息 | +| `NormalMessageResponded` | LLM 回复完成 | +| `PromptPreProcessing` | Prompt 预处理阶段 | + +事件传播支持两种中断: +- `prevent_default()`:阻止默认行为(如跳过 LLM 调用) +- `prevent_postorder()`:阻止后续插件执行 + +### Tool(工具) + +供 LLM 的 Function Calling 调用的工具: + +```python +from langbot_plugin.api.definition.components.tool.tool import Tool + +class WeatherTool(Tool): + async def call(self, params: dict, session, query_id: int) -> str: + city = params.get("city", "Beijing") + # 调用天气 API ... + return f"{city} 今天晴,25°C" +``` + +工具的元数据(名称、描述、参数 schema)定义在配套的 YAML manifest 文件中,LangBot 会自动将其转换为 LLM 能理解的 Function 定义。 + +### Command(命令) + +用户通过 `!command` 触发的命令,支持子命令注册: + +```python +from langbot_plugin.api.definition.components.command.command import Command + +class MyCommand(Command): + def __init__(self): + super().__init__() + + @self.subcommand("hello", help="Say hello") + async def hello(self, ctx): + yield CommandReturn(text="Hello from plugin!") + + @self.subcommand("status", help="Show status") + async def status(self, ctx): + yield CommandReturn(text="All systems operational.") +``` + +命令的执行结果通过 `AsyncGenerator` 返回,天然支持流式输出。 + +### KnowledgeRetriever(知识检索器) + +多实例组件,用于接入外部知识库: + +```python +from langbot_plugin.api.definition.components.knowledge_retriever.retriever import KnowledgeRetriever + +class MyRetriever(KnowledgeRetriever): + async def retrieve(self, context) -> list: + # 从外部向量数据库检索 + results = await self.search_external_db(context.query) + return [RetrievalResultEntry(content=r) for r in results] +``` + +KnowledgeRetriever 是**多态组件(PolymorphicComponent)**——同一个检索器类可以创建多个实例,每个实例有独立的配置。这允许用户连接多个不同的外部知识库。 + +## SDK API:插件能做什么 + +插件通过 `BasePlugin` 基类继承的 `LangBotAPIProxy` 获得丰富的能力: + +```python +class LangBotAPIProxy: + # 消息操作 + async def send_message(self, bot_uuid, target_type, target_id, message_chain) + + # 模型调用 + async def get_llm_models(self) -> list[str] + async def invoke_llm(self, model_uuid, messages, funcs=[], extra_args={}) + + # 持久化存储(插件级别隔离) + async def set_plugin_storage(self, key, value: bytes) + async def get_plugin_storage(self, key) -> bytes + + # 工作区存储(跨插件共享) + async def set_workspace_storage(self, key, value: bytes) + async def get_workspace_storage(self, key) -> bytes + + # 系统信息 + async def get_langbot_version(self) -> str + async def get_bots(self) -> list[str] + async def list_plugins_manifest(self) -> list +``` + +**存储 API 的设计值得注意**:提供了两个级别的 KV 存储——`plugin_storage`(插件私有)和 `workspace_storage`(全局共享),数据以 bytes 形式存储(base64 序列化传输),简单但足够灵活。 + +## 事件分发机制 + +事件从主进程到插件的完整路径: + +![事件分发流程](/images/articles/source/images/plugin-system/event-dispatch.png) + +关键源码: + +```python +async def emit_event(self, event_context, include_plugins=None): + for plugin in self.plugins: + if plugin.status != RuntimeContainerStatus.INITIALIZED: + continue + if not plugin.enabled: + continue + + # 流水线级别的插件过滤 + if include_plugins is not None: + plugin_id = f"{plugin.manifest.metadata.author}/{plugin.manifest.metadata.name}" + if plugin_id not in include_plugins: + continue + + resp = await plugin._runtime_plugin_handler.emit_event( + event_context.model_dump() + ) + + event_context = EventContext.model_validate(resp["event_context"]) + + # 插件请求中断后续传播 + if event_context.is_prevented_postorder(): + break + + return emitted_plugins, event_context +``` + +`include_plugins` 参数实现了**流水线级别的插件绑定**——不同的消息处理流水线可以使用不同的插件子集。 + +## 安装与分发 + +插件支持三种安装来源: + +1. **本地上传**:`.lbpkg` 文件(实际上是 zip 包,包含 manifest.yaml 和代码) +2. **插件市场**:从 LangBot Space 在线安装 +3. **GitHub Release**:从 GitHub 仓库的 Release 资产下载 + +安装流程: + +```python +async def install_plugin(self, source, install_info): + yield {"current_action": "downloading plugin package"} + # 1. 获取插件包(解压 zip) + plugin_path, author, name, version = await self.install_plugin_from_file(plugin_file) + + yield {"current_action": "installing dependencies"} + # 2. 安装依赖(pip install -r requirements.txt) + pkgmgr_helper.install_requirements(requirements_file) + + yield {"current_action": "initializing plugin settings"} + # 3. 初始化配置 + await self.context.control_handler.call_action( + RuntimeToLangBotAction.INITIALIZE_PLUGIN_SETTINGS, {...} + ) + + yield {"current_action": "launching plugin"} + # 4. 启动插件进程 + task = self.launch_plugin(plugin_path) +``` + +整个过程通过 `AsyncGenerator` 流式报告进度,前端可以实时显示安装状态。 + +## 调试体验 + +SDK 提供了完善的开发者工具链: + +```bash +# 初始化新插件 +lbp init + +# 添加组件 +lbp component add + +# 本地调试运行 +lbp run + +# 打包发布 +lbp publish +``` + +**调试模式**的设计特别巧妙:开发者的插件通过 WebSocket 连接到已运行的 Runtime(而非 stdio),这意味着可以在不重启 LangBot 的情况下热重载插件代码。调试插件在 UI 中有特殊标记,不会被误操作删除。 + +## 与其他系统的对比 + +### vs Dify 插件 + +Dify 的插件系统(`dify-plugin-daemon`)与 LangBot 有相似的进程隔离理念,但侧重点不同: + +- **Dify**:插件扩展的是工作流节点类型(Tool、Model、Extension),面向 AI 应用编排 +- **LangBot**:插件扩展的是消息处理流水线(Event、Tool、Command、KnowledgeRetriever),面向即时通讯场景 + +LangBot 的 `EventListener` 组件提供了 Dify 没有的能力——在消息处理的任意阶段插入逻辑。 + +### vs MCP(Model Context Protocol) + +MCP 是一个标准化的 AI 工具调用协议。LangBot 的 Tool 组件和 MCP 服务功能上有重叠,但定位不同: + +- **MCP**:通用的"AI 调用外部能力"协议,任何 LLM 应用都能用 +- **LangBot Tool**:深度集成在消息处理上下文中,能访问会话信息、用户身份等 + +实际上,LangBot 已经原生支持 MCP——用户可以在 LangBot 中直接配置 MCP 服务器,无需编写插件。而 LangBot 的 Tool 组件适用于需要访问 LangBot 内部上下文的场景。 + +## 设计决策背后的思考 + +**为什么选择进程隔离而非线程/协程?** + +- 插件代码质量不可控,一个 segfault 不应该崩掉整个服务 +- 依赖隔离:不同插件可能依赖同一个库的不同版本 +- 资源可控:可以对单个插件进程设置资源限制 + +**为什么用 JSON 而非 Protobuf/MessagePack?** + +- 调试友好:开发者可以直接阅读通信日志 +- Python 生态原生支持,无需额外依赖 +- 性能瓶颈不在序列化(插件调用频率远低于数据库查询) + +**为什么 stdio 优先于 WebSocket?** + +- stdio 无需网络栈,延迟更低 +- 进程生命周期管理更简单(父进程退出时子进程自动清理) +- WebSocket 只在不支持 stdio 的场景(Docker、Windows)使用 + +## 总结 + +LangBot 的插件系统是一个**为生产环境设计的、进程隔离的、事件驱动的组件化扩展框架**。 + +它的核心设计原则: +1. **安全第一**:进程隔离确保插件不会影响主服务稳定性 +2. **部署灵活**:stdio/WebSocket 双模式适配所有环境 +3. **开发者友好**:完善的 SDK、CLI 和调试支持 +4. **组件化**:四种组件类型覆盖主要扩展需求 + +如果你有兴趣开发 LangBot 插件,可以从 [插件开发文档](https://docs.langbot.app/zh/plugin/dev/tutor) 开始,或者直接浏览 [插件市场](https://space.langbot.app/market) 中的现有插件获取灵感。 diff --git a/zh/articles/langbot-v4100-sandbox-skills.mdx b/zh/articles/langbot-v4100-sandbox-skills.mdx new file mode 100644 index 000000000..d99cc78f8 --- /dev/null +++ b/zh/articles/langbot-v4100-sandbox-skills.mdx @@ -0,0 +1,113 @@ +--- +title: "LangBot v4.10.0:Agent 沙箱与技能——让 Agent 真正像开发者一样工作" +description: "LangBot v4.10.0 为内置 Agent 引入真正的沙箱(Box Runtime)和按需加载的技能(Skills)系统。Agent 现在能在隔离环境中执行命令、读写文件,并在任务需要时即时调用专业知识。本文深度解读这次更新的设计与用法。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langbot-v4100-sandbox-skills). + +发布于 2026-06-04 · 作者:LangBot Team + +![LangBot v4.10.0 Agentic Sandbox & Skills](/images/articles/source/images/covers/sandbox-skills.png) + +LangBot v4.10.0 是迄今为止幅度最大的一次 Agent 更新。它做了两件事,都指向同一个方向——**让内置 Agent 真正像一个开发者那样工作**: + +1. **沙箱(Sandbox)**:Agent 现在运行在真正隔离的环境里,能执行命令、读写文件。 +2. **技能(Skills)**:Agent 可以在任务需要时按需加载专业知识,而不必把所有东西都塞进上下文。 + +这两项能力均由社区贡献者 [@huanghuoguoguo](https://github.com/huanghuoguoguo) 主导开发。下面分别展开。 + +> **第一次了解 LangBot?** [LangBot](https://github.com/langbot-app/LangBot) 是一个开源的大模型机器人平台(GitHub 15k+ stars),让你用一个实例就能把 AI 聊天机器人部署到 **QQ、微信(个人微信 / 企业微信)、飞书、钉钉、Discord、Telegram、Slack** 等十几个平台。它把 20+ 大语言模型(OpenAI GPT、Anthropic Claude、Google Gemini、DeepSeek 等)接入 13+ 即时通讯平台,内置 Agent、RAG 知识库、MCP 支持和插件生态。你可以用一条 Docker 命令自部署,也可以在 [LangBot 云](https://space.langbot.app/cloud)上使用托管版本。 + +## 📦 沙箱:给 Agent 一个真正的工作空间 + +在此之前,LangBot 的内置 Agent 只能调用预先定义好的工具。它无法"打开终端跑一条命令",也无法"把中间结果写到文件里再读回来"——而这恰恰是人类开发者每天都在做的事。 + +v4.10.0 引入了全新的 **Box Runtime**。它给 Agent 提供一个隔离的沙箱环境,内置六件套原生工具: + +| 工具 | 作用 | +|------|------| +| `exec` | 执行 shell 命令 | +| `read` | 读取文件内容 | +| `write` | 写入文件 | +| `edit` | 对文件做局部修改 | +| `glob` | 按通配符查找文件 | +| `grep` | 在文件内容中检索 | + +有了这套工具,Agent 就能像开发者一样:跑一段脚本、把输出存到文件、再读回来分析、对结果做二次处理。整个过程都发生在隔离环境内,不会污染宿主。 + +![LangBot 沙箱运行界面](/images/articles/source/images/sandbox-skills/sandbox.png) + +### 可插拔的后端 + +沙箱的执行后端是**可插拔**的,LangBot 会根据部署环境自动选择: + +- **Docker**:启动一个独立的 `langbot_box` 容器,通过 WebSocket 与主进程通信。适合容器化部署。 +- **nsjail**:基于 Linux namespace 的轻量级隔离,无需额外容器。适合裸机或单容器部署。 +- **E2B**:云端沙箱,把执行放到远端隔离环境。 + +你不需要手动指定——`box.enabled` 是总开关,开启后 LangBot 会自动探测并选用最合适的后端,探测失败时优雅降级。 + +![沙箱原生工具](/images/articles/source/images/sandbox-skills/sandbox-tools.png) + +### 它还托管 MCP Server + +除了原生工具,Box Runtime 还承担一个重要职责:**托管 stdio 模式的 MCP Server**。 + +过去 stdio 模式的 MCP Server 需要在主进程里直接拉起子进程,既不安全也不好管理。现在它们统一跑在沙箱内,与 Agent 的执行环境共享同一套隔离边界。`http` / `sse` 模式的 MCP 不受影响,照常工作。 + +## 🎯 技能:按需加载的专业能力 + +第二个大更新是**技能(Skills)**。 + +随着 Agent 能做的事越来越多,一个老问题浮现出来:**上下文窗口是有限的**。如果把所有可能用到的指令、流程、参考资料都塞进系统提示词,上下文很快就会被撑爆,而且大部分内容在当前任务里根本用不上。 + +技能的设计思路很直接——**平时只看目录,用时才翻书**。 + +一个技能(Skill)是一个**按需激活的指令包**,包含: + +- **提示词**:告诉 Agent 这个技能是做什么的、什么时候用 +- **流程**:完成某类任务的步骤 +- **脚本**:可直接执行的辅助脚本 +- **参考文件**:API 文档、模板、示例等 + +Agent 平时只能看到**可用技能的列表**(名称 + 简介),这只占用极少的上下文。当它判断某个任务需要某个技能时,再通过 `activate` 动作即时拉取该技能的完整内容。 + +![LangBot 技能系统](/images/articles/source/images/sandbox-skills/skills.png) + +这样做的好处显而易见: + +1. **上下文精简**:不相关的技能内容不会占用窗口。 +2. **能力可扩展**:想给 Agent 加一项新本领?写一个技能包即可,不用改核心代码。 +3. **即时生效**:技能在任务执行中动态加载,无需重启。 + +如果你用过 Claude 的 Skills 或类似机制,会对这个模式很熟悉——它把"Agent 知道什么"和"Agent 此刻需要什么"解耦开来。 + +## 🧩 4.9.x 期间已提前到位的能力 + +以下几项原计划随 v4.10.0 发布,但已在 4.9.x 系列中提前上线: + +- **插件扩展页面**:插件可以通过 iframe + Page SDK 渲染自定义 UI([@TyperBody](https://github.com/TyperBody),#2107) +- **监控**:反馈与消息 ID 关联,并支持反馈数据导出([@6mvp6](https://github.com/6mvp6),#2120) +- **安全加固**:修复路径穿越问题,移除了一个需要鉴权的 RCE 端点([@sebastiondev](https://github.com/sebastiondev),#2087 / #2178) + +## 🚀 如何启用 + +沙箱需要一个执行后端,按部署方式不同: + +- **Docker**:运行 `docker compose --profile all up`,会一并启动 `langbot_box` 容器。 +- **手动 / `uvx`**:自动以 stdio 子进程方式运行,无需额外操作。 +- **LangBot 云**:开箱即用,沙箱已经为你配置好,无需安装。 + +如果你想关闭沙箱,设置 `box.enabled: false` 即可——此时内置工具、技能的创建/编辑,以及 stdio 模式的 MCP 都会停用;`http` / `sse` 模式的 MCP 不受影响。详见[沙箱文档](https://docs.langbot.app/zh/usage/sandbox/readme)。 + +此外,本次更新将插件 SDK 升级至 **`langbot-plugin 0.4.1`**。 + +## 写在最后 + +沙箱和技能这两项能力,本质上是在回答同一个问题:**怎样让 Agent 处理真正复杂、开放的任务?** + +沙箱解决的是"**手**"——让 Agent 有能力执行、有空间试错;技能解决的是"**脑**"——让 Agent 在合适的时机调用合适的知识,而不被无关信息淹没。 + +最快的体验方式是在 [LangBot 云](https://space.langbot.app/cloud)上一键部署一个托管实例,沙箱已经就绪。也可以查看[完整发布说明](https://github.com/langbot-app/LangBot/releases/tag/v4.10.0)了解全部变更。 + +感谢每一位与 LangBot 一起构建的开发者。我们会继续把云端 Agent 的体验做得更稳、更强。 diff --git a/zh/articles/langbot-v490-rag-plugin-architecture.mdx b/zh/articles/langbot-v490-rag-plugin-architecture.mdx new file mode 100644 index 000000000..dfb52abb3 --- /dev/null +++ b/zh/articles/langbot-v490-rag-plugin-architecture.mdx @@ -0,0 +1,295 @@ +--- +title: "LangBot v4.9.0:知识库全面插件化——RAG 引擎、解析器与无边界知识架构" +description: "LangBot v4.9.0 将知识库能力从内置实现重构为插件化架构,引入 RAG 引擎和解析器两大组件类型,实现知识库的无边界扩展。本文深度解读这次架构升级的设计思路、核心变更与开发指南。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langbot-v490-rag-plugin-architecture). + +发布于 2026-03-10 · 作者:LangBot Team + +![LangBot v4.9.0 RAG Plugin Architecture](/images/articles/source/images/covers/rag-plugin.png) + +LangBot v4.9.0 代号 **"Knowledge Without Borders"**(知识无边界),这个命名精准地概括了本次版本的核心变化:**知识库能力从内置实现全面重构为插件化架构**。 + +这不是一次小修小补——它重新定义了 LangBot 中"知识"的边界。 + +## 为什么要做这件事? + +在 v4.9.0 之前,LangBot 的知识库分为两套体系: + +- **内置知识库**:使用 Chroma 作为向量数据库,嵌入模型由 LangBot 直接调用,文档解析、分块、索引全部内置。 +- **外部知识库**:通过 `KnowledgeRetriever` 插件组件桥接 Dify、RAGFlow、FastGPT 等外部服务,只做检索,不管文档摄取。 + +这两套体系在 UI 上以 Tab 切换的方式呈现,数据模型和管理逻辑完全割裂。 + +**问题在于:** + +1. **扩展性差**:想换一个向量数据库?想用自己的分块策略?对不起,内置实现写死了。 +2. **维护成本高**:每次 RAG 能力迭代,都需要改 LangBot 核心代码,发版才能生效。 +3. **体验割裂**:内置和外部两种知识库的管理方式完全不同,用户学习成本高。 + +v4.9.0 的解决方案很直接:**把 RAG 能力从 LangBot 核心中抽出来,交给插件**。 + +## 核心变更一览 + +### 1. 统一知识库模型 + +移除 `internal` / `external` 的区分。所有知识库统一管理,通过 `rag_engine_plugin_id` 区分背后使用的 RAG 引擎。UI 上不再有两个 Tab,只有一个知识库列表,创建时选择引擎即可。 + +### 2. 新增 KnowledgeEngine 组件 + +这是本次最核心的新增。`KnowledgeEngine`(知识引擎)替代了旧的 `KnowledgeRetriever`,承担完整的知识库生命周期管理: + +- **文档摄取(Ingest)**:从文件解析到向量索引的完整流程 +- **知识检索(Retrieve)**:查询时返回相关知识块 +- **文档删除(Delete)**:清理文档及关联的向量数据 +- **生命周期钩子**:知识库创建/删除时的回调 + +换句话说,一个 KnowledgeEngine 插件可以完全控制知识库的索引和检索策略,而不仅仅是做检索。 + +![插件市场中的知识引擎插件](/images/articles/external/b9a33a8551a7-8dd37939-4f10-4046-bd84-cce798005cd4.png) + +### 3. 新增 Parser 组件 + +文档解析也被独立为插件组件。Parser 负责将 PDF、Word、Markdown 等二进制文件转换为结构化文本,然后交给 RAG 引擎做分块和索引。 + +**Parser 和 KnowledgeEngine 的关系:** + +![数据流:Parser → KnowledgeEngine](/images/articles/source/images/rag-plugin/data-flow.png) + +如果 RAG 引擎自身声明了 `DOC_PARSING` 能力,也可以跳过外部 Parser,自行处理文档解析。 + +### 4. 宿主 RAG API + +LangBot 核心不再直接执行 RAG 操作,但仍然提供了关键的基础设施,封装在 `RAGRuntimeService` 中供插件通过 RPC 调用: + +- **嵌入模型调用**:`invoke_embedding()` —— 插件无需自己管理模型连接 +- **向量数据库操作**:`vector_upsert()` / `vector_search()` / `vector_delete()` —— 写入、搜索、删除 +- **文件读取**:`get_knowledge_file_stream()` —— 从存储中获取原始文件 + +这意味着插件可以专注于 RAG 策略(分块方式、检索算法、重排序逻辑),而把向量存储和嵌入模型这些"重"操作交给宿主。 + +### 5. 废弃 KnowledgeRetriever + +旧的 `KnowledgeRetriever` 组件已被移除。如果你之前开发过外部知识库插件,需要迁移到 `KnowledgeEngine`。好消息是 KnowledgeEngine 的 API 更清晰,迁移并不复杂。 + +## 开发一个 RAG 引擎插件 + +以下是开发自定义 RAG 引擎的完整流程。 + +### 创建组件 + +```bash +lbp comp KnowledgeEngine +``` + +按提示输入引擎名称和描述,SDK 会自动生成目录结构: + +![插件目录结构](/images/articles/source/images/rag-plugin/dir-structure.png) + +### 定义配置 Schema + +在 `.yaml` 清单文件中定义两类配置: + +- **`creation_schema`**:用户创建知识库时填写的参数(如分块大小、嵌入模型) +- **`retrieval_schema`**:检索时可调整的参数(如分数阈值、Top-K) + +```yaml +spec: + creation_schema: + - name: chunk_size + label: + zh_Hans: 分块大小 + type: integer + default: 500 + - name: chunk_overlap + label: + zh_Hans: 分块重叠 + type: integer + default: 50 + retrieval_schema: + - name: score_threshold + label: + zh_Hans: 分数阈值 + type: float + default: 0.5 +``` + +LangBot 会根据这些 Schema **动态渲染**创建和检索的配置表单,不同的 RAG 引擎展示不同的配置项。 + +### 声明能力 + +```python +class SimpleRag(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [ + KnowledgeEngineCapability.DOC_INGESTION, # 支持文档上传 + # KnowledgeEngineCapability.DOC_PARSING, # 可选:支持内置文档解析 + ] +``` + +| 能力 | 说明 | +|------|------| +| `DOC_INGESTION` | 支持文档上传和处理。声明后 UI 显示"文档"标签页 | +| `DOC_PARSING` | 支持内置文档解析。未声明则必须安装外部 Parser 插件 | + +### 实现核心方法 + +最关键的三个方法: + +**文档摄取:** + +```python +async def ingest(self, context: IngestionContext) -> IngestionResult: + # 1. 获取文件内容(或使用 Parser 的预解析结果) + if context.parsed_content: + text = context.parsed_content.text + else: + file_bytes = await self.plugin.get_knowledge_file_stream( + context.file_object.storage_path + ) + text = file_bytes.decode('utf-8') + + # 2. 分块 + chunks = self._split_text(text, chunk_size=500) + + # 3. 调用宿主嵌入模型 + vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, chunks + ) + + # 4. 写入宿主向量数据库 + await self.plugin.vector_upsert( + collection_id, vectors, ids, metadata + ) + + return IngestionResult( + document_id=context.file_object.metadata.document_id, + status=DocumentStatus.COMPLETED, + chunks_created=len(chunks), + ) +``` + +**知识检索:** + +```python +async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # 1. 生成查询向量 + query_vectors = await self.plugin.invoke_embedding( + embedding_model_uuid, [context.query] + ) + + # 2. 向量搜索 + results = await self.plugin.vector_search( + collection_id, query_vectors[0], top_k=5 + ) + + # 3. 转换并返回 + return RetrievalResponse(results=entries, total_found=len(entries)) +``` + +**文档删除:** + +```python +async def delete_document(self, kb_id: str, document_id: str) -> bool: + deleted = await self.plugin.vector_delete( + collection_id=kb_id, file_ids=[document_id] + ) + return deleted > 0 +``` + +### 桥接外部知识库服务 + +如果你的目标不是自建 RAG 流程,而是桥接 Dify、RAGFlow、FastGPT 等外部服务,实现方式更简单——**不需要声明 `DOC_INGESTION` 能力**,只实现 `retrieve` 方法即可: + +```python +class DifyRAGEngine(KnowledgeEngine): + + @classmethod + def get_capabilities(cls) -> list[str]: + return [] # 不支持文档上传,由外部服务管理 + + async def retrieve(self, context: RetrievalContext) -> RetrievalResponse: + # 调用 Dify/RAGFlow/FastGPT 的检索 API + ... +``` + +这样在 LangBot 中创建知识库时选择该引擎,不会显示"文档"标签页,知识的管理完全在外部服务中进行。 + +## 开发 Parser 插件 + +Parser 的开发更加简洁: + +```bash +lbp comp Parser +``` + +在清单文件中声明支持的 MIME 类型: + +```yaml +spec: + supported_mime_types: + - application/pdf + - application/vnd.openxmlformats-officedocument.wordprocessingml.document +``` + +实现 `parse` 方法: + +```python +class PdfParser(Parser): + + async def parse(self, context: ParseContext) -> ParseResult: + # context.file_content: 原始文件字节 + # context.mime_type: 文件 MIME 类型 + # context.filename: 原始文件名 + + text = extract_text_from_pdf(context.file_content) + + return ParseResult( + text=text, + sections=[ + TextSection(content=page_text, heading=f"Page {i}", page=i) + for i, page_text in enumerate(pages) + ], + ) +``` + +Parser 和 KnowledgeEngine 之间还支持**跨插件调用**——一个 RAG 引擎插件可以主动调用另一个插件提供的 Parser: + +```python +result = await self.plugin.invoke_parser( + plugin_author="author_name", + plugin_name="plugin_name", + storage_path=context.file_object.storage_path, + mime_type=context.file_object.metadata.mime_type, + filename=context.file_object.metadata.filename, +) +``` + +## 升级须知 + +- 旧版本中创建的内置知识库和外部知识库会由迁移工具**自动迁移**,更新后到知识库页面确认即可。 +- `KnowledgeRetriever` 组件已废弃,旧插件需要迁移到 `KnowledgeEngine`。 +- 在[插件市场](https://space.langbot.app/market?category=KnowledgeEngine)可以找到已有的 RAG 引擎插件。 + +## 写在最后 + +v4.9.0 的知识库插件化是 LangBot 插件系统的又一次扩展。从 v4.0 的事件处理器和工具,到知识检索器,再到现在的 RAG 引擎和解析器——LangBot 的核心能力正在逐步从"内置"走向"可插拔"。 + +这个方向的终局是:**LangBot 核心只提供流水线编排和基础设施,所有业务能力都由插件驱动**。 + +想要自定义分块策略?写个 KnowledgeEngine 插件。想支持 PDF 解析?写个 Parser 插件。想桥接企业内部的知识库服务?同样是一个插件。 + +知识,不再有边界。 + +--- + +**相关链接:** + +- [v4.9.0 Release Notes](https://github.com/langbot-app/LangBot/releases/tag/v4.9.0) +- [知识引擎开发文档](https://docs.langbot.app/zh/plugin/dev/components/knowledge-engine) +- [解析器开发文档](https://docs.langbot.app/zh/plugin/dev/components/parser) +- [插件市场](https://space.langbot.app/market) +- [LangBot Cloud](https://space.langbot.app/cloud) diff --git a/zh/articles/langflow-drag-and-drop-ai-bot.mdx b/zh/articles/langflow-drag-and-drop-ai-bot.mdx new file mode 100644 index 000000000..7be50559e --- /dev/null +++ b/zh/articles/langflow-drag-and-drop-ai-bot.mdx @@ -0,0 +1,207 @@ +--- +title: "用 Langflow 拖拽式工作流构建多平台 AI 机器人" +description: "用 Langflow 拖拽式工作流构建多平台 AI 机器人" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langflow-drag-and-drop-ai-bot). + +发布于 2025-12-05 · 作者:LangBot Team + +![用 Langflow 拖拽式工作流构建多平台 AI 机器人](/images/articles/source/images/covers/langflow.png) + +用可视化工作流驱动 QQ、微信、Telegram、Discord 等平台的聊天机器人,无需编写代码。 + +--- + +[LangBot](https://github.com/langbot-app/LangBot) 是一个开源即时通讯机器人平台,可以连接 Langflow、n8n、Dify、FastGPT、Coze 等 AI 工作流引擎,以及微信、QQ、飞书、钉钉、Telegram、Discord、Slack、LINE 等消息平台。本教程演示如何将 Langflow 的可视化工作流作为 LangBot 的对话引擎。 + +## 为什么选择这套方案 + +- **真正的多平台**:一个工作流同时驱动 8+ 个消息平台 +- **可视化编排**:拖拽式对话设计,支持条件分支、多轮对话、外部 API 调用 +- **灵活的 AI 模型**:支持 OpenAI、Claude、Gemini、DeepSeek 以及本地模型 +- **完全开源**:LangBot 和 Langflow 都是开源项目,可免费部署和二次开发 + +## 准备工作 + +- Python 3.10+ +- Docker(推荐用于快速部署) +- OpenAI API Key 或其他 LLM 服务的 API Key + +## 第一步:部署 LangBot + +用 uvx 一行命令启动: + +```bash +uvx langbot +``` + +首次运行会自动初始化并打开浏览器访问 http://127.0.0.1:5300。 + +![LangBot Initial Page](/images/articles/external/0c8aa2c940ab-01-langbot-initial-page.png) + +注册后登录进入控制台: + +![LangBot Dashboard](/images/articles/external/b93d97b5b830-04-langbot-dashboard.png) + +## 第二步:部署 Langflow + +用 Docker 快速部署: + +```bash +docker run -d --name langflow -p 7860:7860 langflowai/langflow:latest +``` + +访问 http://localhost:7860 进入 Langflow: + +![Langflow Welcome Page](/images/articles/external/7e7ebfc3ba58-01-langflow-welcome.png) + +## 第三步:创建 Langflow 工作流 + +在 Langflow 中选择 "Basic Prompting" 模板快速开始: + +![Langflow Template Selection](/images/articles/external/b304cebf8ce9-02-langflow-template-selection.png) + +这个模板包含四个基础组件: +- **Chat Input**:接收用户消息 +- **Prompt**:设置系统提示词 +- **Language Model**:调用 LLM 生成回复 +- **Chat Output**:返回结果 + +![Langflow Workflow Editor](/images/articles/external/6e24402fd4a8-03-langflow-workflow-editor.png) + +### 配置语言模型 + +点击 Language Model 组件进行配置: + +1. **Model Provider**:选择 OpenAI(或其他兼容的提供商如 SiliconFlow、New API) +2. **Model Name**:选择 gpt-4o-mini 或 deepseek-chat +3. **OpenAI API Key**:填入你的 API Key + +![Langflow OpenAI API Key Configured](/images/articles/external/bcd91ef5e4b3-14-langflow-openai-api-key-configured.png) + +> 提示:你可以使用 OpenAI 兼容的 API 服务,比如 SiliconFlow 或 New API,只需修改 Base URL 即可。 + +配置完成后保存工作流。 + +## 第四步:获取 Langflow API 信息 + +### 生成 API Key + +在 Langflow 右上角:Settings → API Keys,进入 API Keys 页面: + +![Langflow API Keys Page](/images/articles/external/21fc47358066-05-langflow-api-keys-page.png) + +点击 Create New Key: + +![Langflow Create API Key Dialog](/images/articles/external/8f04c7b00759-06-langflow-create-api-key-dialog.png) + +生成并保存 API Key: + +![Langflow API Key Generated](/images/articles/external/e5a019491ef8-07-langflow-api-key-generated.png) + +格式:`sk-xxxxxxxxxxxxxxxxxxxxxxxx` + +### 获取 Flow ID + +从工作流编辑器的 URL 中提取: + +``` +http://localhost:7860/flow/{flow-id} +``` + +记录这个 `flow-id`。 + +## 第五步:在 LangBot 中配置 Langflow + +回到 LangBot 控制台,进入 **Pipelines** 页面。 + +点击 ChatPipeline 进行编辑,在 AI 标签页: + +![LangBot Pipeline AI Tab](/images/articles/external/3c7d6bc96738-08-langbot-pipeline-ai-tab.png) + +配置 **Runner**,选择 **Langflow API**: + +![LangBot Runner Dropdown](/images/articles/external/ef9bbef78165-09-langbot-runner-dropdown.png) + +填写 Langflow 配置: + +![LangBot Langflow Config Form](/images/articles/external/82d5e2ffb9a0-10-langbot-langflow-config-form.png) + +配置项: +- **Base URL**:`http://localhost:7860`(本地)或 `http://langflow:7860`(Docker 网络) +- **API Key**:在 Langflow 中生成的 API Key +- **Flow ID**:之前记录的 Flow ID + +![LangBot Langflow Config Filled](/images/articles/external/2fb54ce0f7a2-11-langbot-langflow-config-filled.png) + +> Docker 提示:如果两个服务都在容器中运行,确保它们在同一个网络,并使用容器名作为 Base URL。 + +点击 **Save** 保存配置。 + +## 第六步:测试对话 + +在 Pipelines 页面点击 **Debug Chat** 打开调试对话界面: + +![LangBot Debug Chat Interface](/images/articles/external/b36d6dea3702-12-langbot-debug-chat-interface.png) + +输入测试消息如 "Hello",查看 AI 回复: + +![LangBot Chat Test Success](/images/articles/external/3d7fa393f210-13-langbot-chat-with-response.png) + +## 工作原理 + +1. 用户在消息平台发送消息 +2. LangBot 接收并传递给 Pipeline +3. Pipeline 调用 Langflow API +4. Langflow 执行工作流:接收输入 → 添加提示词 → 调用 LLM → 返回结果 +5. LangBot 将回复发送给用户 + +## 常见问题 + +**无法连接 Langflow?** + +检查 Base URL。如果是 Docker 部署,确保容器在同一个网络: + +```bash +docker network create langbot_network +docker network connect langbot_network langflow +docker network connect langbot_network langbot +``` + +使用容器名:`http://langflow:7860` + +**API 调用失败?** + +- 确认 API Key 和 Flow ID 正确 +- 验证 Langflow 中的 Language Model 已配置有效的 LLM API Key + +## 高级应用场景 + +Langflow 的强大之处在于可以可视化编排复杂的 AI 工作流: + +- **多轮记忆**:添加 Memory 组件实现上下文理解 +- **条件分支**:根据用户输入执行不同逻辑 +- **外部 API 集成**:连接数据库、搜索引擎、第三方服务 +- **多 Agent 协作**:多个 LLM 模型协同工作 +- **RAG 应用**:集成向量数据库实现知识库问答 + +所有这些都可以通过拖拽完成,无需编写代码。 + +## 总结 + +通过 LangBot + Langflow,你可以快速构建强大的多平台 AI 聊天机器人。Langflow 提供可视化工作流编排,LangBot 负责消息平台接入,两者结合形成了从工作流设计到多平台部署的完整闭环。 + +这套方案特别适合: +- 需要在多个平台提供相同 AI 能力的场景 +- 团队希望快速迭代和测试不同对话流程 +- 开发者希望在不深入编码的情况下构建复杂 AI 应用 + +## 相关资源 + +- [LangBot 官网](https://langbot.app) | [文档](https://docs.langbot.app) | [GitHub](https://github.com/langbot-app/LangBot) +- [Langflow 官网](https://www.langflow.org) | [文档](https://docs.langflow.org) | [GitHub](https://github.com/langflow-ai/langflow) + +--- + +*本文基于 LangBot 最新版本编写。LangBot 还支持集成 Dify、n8n、FastGPT、Coze 等 AI 平台,可根据需求选择合适的工作流引擎。* diff --git a/zh/articles/langtars-remote-pc-control-dify-n8n.mdx b/zh/articles/langtars-remote-pc-control-dify-n8n.mdx new file mode 100644 index 000000000..009a8bc3d --- /dev/null +++ b/zh/articles/langtars-remote-pc-control-dify-n8n.mdx @@ -0,0 +1,175 @@ +--- +title: "LangTARS:开源 AI Agent 远程控制电脑 — 支持接入 Dify 和 n8n 工作流" +description: "LangTARS 是 LangBot 原生插件,让你通过 Telegram、Discord、微信等聊天软件远程控制电脑,并支持接入 Dify、n8n 等 AI 工作流平台。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/langtars-remote-pc-control-dify-n8n). + +发布于 2026-03-23 · 作者:LangBot Team + +![LangTARS Logo](/images/articles/external/3fe5bdc18716-icon.svg) + +**LangBot 原生插件 | 类 OpenClaw 体验 | 一键部署即可使用** + +--- + +## ✨ 什么是 LangTARS? + +**LangTARS** 是 **LangBot 原生的类 OpenClaw 插件**,灵感来自《星际穿越》中忠诚可靠的机器人 TARS。 + +它能让你通过 **Telegram、钉钉、微信** 等聊天软件,远程控制你的 **Mac / Windows / Linux** 电脑! + +> 💡 **部署 LangBot,即可体验 LangTARS!** 无需额外安装,插件市场一键获取。 + +![LangTARS 演示](/images/articles/external/70b26e660a60-tars.gif) + +--- + +## 🎯 能做什么? + +只需发一条消息,AI 就能帮你完成各种任务: + +| 你说 | AI 做 | +|------|-------| +| `!tars 给我打开chrome里的小红书,给我发一篇帖子,标题为来自LangTARS的一封信,内容是你好` | 🌐 自动打开小红书并发布帖子 | +| `!tars 帮我整理桌面文件` | 📁 自动分类整理文件 | +| `!tars 打开浏览器搜索今天的新闻` | 🌐 打开浏览器并搜索 | +| `!tars 创建一个会议笔记` | 📝 自动创建笔记文件 | +| `!tars 查看系统信息` | 💻 获取电脑状态 | + +![使用示例](/images/articles/external/6613b3025b8b-usage-example.png) +![plan模式](/images/articles/external/ff42857251ab-planner-mode.png) + +--- + +## 🚀 为什么选择 LangTARS? + +### 1️⃣ LangBot 原生插件,开箱即用 + +```bash +# 一行命令部署 LangBot +uvx langbot@latest + +# 插件市场安装 LangTARS,配置模型,开始使用! +``` + +**无需复杂配置,无需额外部署,LangBot 用户直接体验!** + +![安装流程](/images/articles/external/2a3a0d5f4ae9-install-flow.png) + +--- + +### 2️⃣ 智能任务规划,自主执行 + +基于 **ReAct 循环**的 AI 规划引擎: + +``` +你的指令 → 理解需求 → 制定计划 → 逐步执行 → 反馈结果 +``` + +AI 会像人一样思考,自动拆解复杂任务! + +--- + +### 3️⃣ 多浏览器支持 + +| 浏览器 | macOS | Windows | Linux | +|--------|-------|---------|-------| +| Playwright(无头) | ✅ | ✅ | ✅ | +| Safari | ✅ | - | - | +| Chrome | ✅ | ✅ | ✅ | +| Edge | - | ✅ | - | +| Firefox | - | - | ✅ | + +--- + +### 4️⃣ 安全优先设计 + +- 🚫 **危险命令拦截** — `rm -rf /` 等命令自动阻止 +- 📂 **工作区隔离** — 文件操作限制在安全目录 +- 📋 **命令白名单** — 可配置允许的命令 +- 👤 **用户访问控制** — 限制特定用户使用 + +![安全特性](/images/articles/external/a618d3d41416-security.png) + +--- + +## 📱 快速开始 + +### Step 1: 部署 LangBot + +```bash +uvx langbot@latest +``` + +### Step 2: 配置聊天平台 + +按照文档配置 Telegram / 钉钉 / 微信机器人 + +### Step 3: 安装 LangTARS + +在 LangBot 插件市场搜索 **LangTARS** 并安装 + +### Step 4: 开始对话 + +``` +!tars 你好,告诉我你能做什么 +``` + + +> 📱 **推荐**:在 **Telegram** 或 **钉钉** 上使用,体验最佳! + +--- + +## 🎮 常用命令 + +| 命令 | 功能 | +|------|------| +| `!tars <任务描述>` | 执行任务 | +| `!tars stop` | 停止当前任务 | +| `!tars what` | 查看执行状态 | +| `!tars reset` | 重置对话 | +| `!tars help` | 显示帮助 | + +--- + +## 🌟 项目信息 + +| 项目 | 信息 | +|------|------| +| **GitHub** | [github.com/langbot-app/LangTARS](https://github.com/langbot-app/LangTARS) | +| **语言** | Python 100% | +| **许可证** | CC BY-NC-ND 4.0 | +| **平台** | macOS / Windows / Linux | + +--- + +## 🔗 相关链接 + +- 📖 **LangBot 文档**: [docs.langbot.app](https://docs.langbot.app) +- 💬 **问题反馈**: [GitHub Issues](https://github.com/langbot-app/LangTARS/issues) +- ⭐ **Star 支持**: [GitHub](https://github.com/langbot-app/LangTARS) + +--- + +## 🎉 部署 LangBot,体验 LangTARS! + +**让 AI 成为你忠诚的数字助手,就像 TARS 一样。** + +```bash +uvx langbot@latest +``` + +**#LangTARS #LangBot #AI助手 #效率工具 #开源** + +--- + +## 🔗 搭配 Dify & n8n,释放更强大能力 + +LangTARS 搭配 AI 工作流平台使用效果更佳: + +- **Dify 集成**:将 LangBot 作为 [Dify](https://dify.ai) 的消息前端,在 Dify 可视化编辑器中构建复杂 AI 工作流,然后通过 Telegram/Discord 触发。例如:自动生成报告 → 创建文件 → 发送邮件通知,全部通过一条聊天消息完成。 +- **n8n 集成**:结合 [n8n](https://n8n.io) 工作流与 LangBot,将 LangTARS 的电脑控制能力与 n8n 的 400+ 集成组合,实现无限可能。 +- **同时支持**:Langflow、Coze 以及任何 OpenAI 兼容 API。 + +> 💡 **示例**:"TARS,运行我的 Dify 工作流分析今天的销售数据,把报告保存到桌面" — LangTARS 处理整个链路。 diff --git a/zh/articles/n8n-multi-platform-ai-chatbot.mdx b/zh/articles/n8n-multi-platform-ai-chatbot.mdx new file mode 100644 index 000000000..1b082d3f5 --- /dev/null +++ b/zh/articles/n8n-multi-platform-ai-chatbot.mdx @@ -0,0 +1,184 @@ +--- +title: "用 n8n 和 LangBot 构建多平台 AI 聊天机器人" +description: "用 n8n 和 LangBot 构建多平台 AI 聊天机器人" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/n8n-multi-platform-ai-chatbot). + +发布于 2025-12-03 · 作者:LangBot Team + +![用 n8n 和 LangBot 构建多平台 AI 聊天机器人](/images/articles/source/images/covers/n8n.png) + +将 n8n 的可视化工作流自动化与 LangBot 的多平台机器人框架相结合,可以在 QQ、微信、Discord、Telegram、Slack 等平台上以无代码方式部署 AI 聊天机器人。本教程演示如何在几分钟内完成集成。 + +## 你需要准备 + +- 已安装 Python 3.8+ +- 已安装 Node.js 18+ +- 可用的 npm 或 npx +- 15 分钟时间 + +## 三行命令部署 LangBot + +LangBot 是一个生产级的机器人框架,支持连接多种消息平台和 AI 服务,包括 Dify、FastGPT、Coze、OpenAI、Claude 和 Gemini。一键部署: + +```bash +cd your-workspace +mkdir -p langbot-instance && cd langbot-instance +uvx langbot@latest +``` + +首次启动时 LangBot 会自动初始化。在浏览器打开 `http://127.0.0.1:5300`。 + +![LangBot initialization screen](/images/articles/external/70ee40a6d232-01-langbot-initialization.png) + +按提示注册管理员账号。注册成功后进入控制台,可以管理机器人、模型、流水线和集成。 + +![LangBot dashboard](/images/articles/external/4f1f5c28fbfc-03-langbot-dashboard.png) + +## 搭建 n8n 工作流自动化 + +n8n 是一个开源自动化平台,拥有 400+ 集成和强大的 AI 能力。本地启动: + +```bash +cd your-workspace +mkdir -p n8n-data +export N8N_USER_FOLDER=$(pwd)/n8n-data +npx n8n +``` + +访问 `http://127.0.0.1:5678` 创建你的主账号。 + +![n8n initial setup](/images/articles/external/12d0e04600c5-05-n8n-setup.png) + +## 构建 AI 工作流 + +在 n8n 中创建新工作流。你需要两个核心节点: + +![n8n workflow editor](/images/articles/external/e36d04ca4a5b-07-n8n-workflow-editor.png) + +### 添加 Webhook 触发器 + +点击画布上的 "+" 添加 **Webhook** 节点。配置如下: + +- **HTTP Method**:POST +- **Response Mode**:Streaming(启用实时聊天响应) +- **Authentication**:None(生产环境请调整) + +![Webhook node configuration](/images/articles/external/03443176ae5c-08-n8n-webhook-node.png) + +### 添加 AI Agent + +按 Tab 键,导航到 "AI" 分类,选择 **AI Agent**。 + +**配置对话模型**:点击 "Chat Model" 选择 "OpenAI Chat Model"。添加凭据: + +- **API Key**:你的 OpenAI API key(或兼容服务的 key) +- **Base URL**:如果使用 Claude、Gemini 或本地模型等其他提供商,更新为对应的 endpoint + +**关键步骤 - 修复 Prompt 来源**:默认情况下 AI Agent 期望 Chat Trigger 节点,这与 webhook 不兼容。修复方法: + +1. 在 AI Agent 设置中找到 "Source for Prompt (User Message)" +2. 从 "Connected Chat Trigger Node" 改为 "Define below" +3. 切换到 "Expression" 模式 +4. 输入:`{{ $json.body }}` + +这个表达式从 webhook 请求体中提取用户消息。 + +![Configured webhook with AI Agent](/images/articles/external/621f3d526678-09-n8n-webhook-configured.png) + +### 激活并获取 Webhook URL + +保存工作流并切换右上角的激活开关。切换到 "Production URL" 标签页,复制 webhook URL: + +``` +http://localhost:5678/webhook/{your-webhook-id} +``` + +## 连接 LangBot 到 n8n + +回到 LangBot 控制台,进入 **Pipelines** 页面,点击默认的 "ChatPipeline"。 + +![LangBot pipelines page](/images/articles/external/ef2b2f83bd16-04-langbot-pipelines.png) + +切换到 **AI** 标签页,在 Runner 下拉菜单中选择 "n8n Workflow API"。配置: + +- **Webhook URL**:粘贴你的 n8n 生产环境 webhook URL +- **Authentication Type**:None(与 n8n webhook 设置保持一致) +- **Timeout**:120 秒 +- **Output Key**:response + +点击 **Save** 保存。 + +## 测试一下 + +在 Pipeline 编辑器中点击左侧边栏的 "Debug Chat"。发送测试消息如 "What is LangBot?" + +如果一切正常,你会看到 LangBot 将消息发送到 n8n,AI Agent 处理后将响应流式返回。 + +## 故障排查 + +**错误:"Expected to find the prompt in an input field called 'chatInput'"** + +这意味着 AI Agent 仍配置为 Chat Trigger 节点。修复: + +1. 打开 AI Agent 配置 +2. 将 "Source for Prompt (User Message)" 设为 "Define below" +3. 切换到 Expression 模式 +4. 输入:`{{ $json.body }}` + +**直接测试 Webhook** + +用 curl 验证 webhook 是否工作: + +```bash +curl -X POST http://localhost:5678/webhook/your-webhook-id \ + -H "Content-Type: application/json" \ + -d '{"body": "Hello, can you introduce yourself?"}' +``` + +你应该收到包含 AI 响应的流式 JSON。 + +## 集成工作原理 + +完整流程如下: + +1. 用户通过 QQ、微信、Discord、Telegram、Slack、LINE 或任何 LangBot 支持的平台发送消息 +2. LangBot 的 Pipeline 接收消息并调用 n8n Workflow API +3. n8n 的 Webhook 节点捕获请求并传递给 AI Agent +4. AI Agent 使用 OpenAI、Claude、Gemini 或你配置的 LLM 生成回复 +5. n8n 将响应流式返回给 LangBot +6. LangBot 将回复送达用户原来的平台 + +## 为什么这套组合很强大 + +**LangBot + n8n** 解锁了强大的能力: + +1. **无代码 AI 逻辑**:在 n8n 中以可视化方式设计对话流程,无需触碰代码 +2. **多平台覆盖**:同时在 QQ、微信、Discord、Telegram、Slack、LINE、钉钉、飞书部署相同的 AI +3. **灵活的 AI 模型**:在 OpenAI GPT、Anthropic Claude、Google Gemini、Coze、Dify、本地模型等之间自由切换 +4. **丰富的集成**:连接 n8n 的 400+ 集成——数据库、API、Notion、Airtable、Google Sheets、Slack 等 +5. **工具调用 Agent**:AI Agent 可以触发 n8n 工具,如数据库查询、API 调用或自定义函数 +6. **工作流扩展**:添加预处理、内容审核、日志记录或自定义业务逻辑 + +**适合场景**: +- 企业客服机器人 +- 知识库问答系统 +- 多平台社群管理 +- 任务自动化助手 +- 团队统一聊天界面 + +## 下一步 + +进一步扩展你的机器人: + +- 集成 Dify 或 FastGPT 实现高级 RAG(检索增强生成) +- 添加向量数据库节点(Pinecone、Qdrant、Weaviate)实现知识检索 +- 连接业务 API 获取实时数据 +- 实现对话记忆和上下文追踪 +- 添加内容过滤和审核工作流 +- 使用 Langflow 或 Coze 进行额外的 AI 编排 + +这套集成为你提供了基于代码的 AI 框架(如 LangChain)的灵活性,以及可视化工作流构建器的简洁性——同时覆盖所有主流消息平台。 + +准备好部署你的多平台 AI 助手了吗?立即开始使用 LangBot 和 n8n。 diff --git a/zh/articles/welcome.mdx b/zh/articles/welcome.mdx new file mode 100644 index 000000000..17cf01641 --- /dev/null +++ b/zh/articles/welcome.mdx @@ -0,0 +1,34 @@ +--- +title: "LangBot 博客正式上线" +description: "欢迎来到 LangBot 官方博客。在这里获取产品更新、新功能和里程碑信息。" +--- + +本文同步自 LangBot Blog。 [阅读 Blog 原文](https://langbot.app/zh/blog/welcome). + +发布于 2026-02-17 · 作者:LangBot Team + +![LangBot Blog](/images/articles/source/images/covers/welcome.png) + +我们很高兴推出 LangBot 官方博客!在这里,我们将分享产品更新、新功能、里程碑和来自 LangBot 团队的见解。 + +## 什么是 LangBot? + +LangBot 是一个开源的大语言模型(LLM)原生即时通信机器人平台。它支持多种消息平台和模型供应商,并集成了 Dify、阿里云百炼等 LLMOps 平台。LangBot 还提供了 WebUI,方便用户快速部署和管理。 + +## 博客内容 + +在这个博客上,你将看到: + +- **版本更新** - 每个新版本的详细说明 +- **功能亮点** - 深入介绍新功能 +- **里程碑** - 项目成长和社区成就 +- **教程与技巧** - 充分利用 LangBot 的最佳实践 + +## 保持联系 + +- [GitHub](https://github.com/langbot-app/LangBot) - 给我们点个 Star,关注开发动态 +- [文档](https://docs.langbot.app) - 完整的使用指南和 API 参考 +- [LangBot 主页](https://langbot.app) - 官方网站 +- [插件市场](https://space.langbot.app) - 发现更多插件和扩展 + +敬请期待更多更新!