diff --git a/README.md b/README.md index 8658aa61..a8c25a4b 100644 --- a/README.md +++ b/README.md @@ -285,13 +285,13 @@ volumes: "model": "gpt-5.4", "open_ai_api_key": "YOUR_API_KEY", "open_ai_api_base": "https://api.openai.com/v1", - "bot_type": "chatGPT" + "bot_type": "openai" } ``` - `model`: 与OpenAI接口的 [model参数](https://platform.openai.com/docs/models) 一致,支持包括 gpt-5.4、o系列、gpt-4.1等模型,Agent模式推荐使用 `gpt-5.4` - `open_ai_api_base`: 如果需要接入第三方代理接口,可通过修改该参数进行接入 - - `bot_type`: 使用OpenAI相关模型时无需填写。当使用第三方代理接口接入Claude等非OpenAI官方模型时,该参数设为 `chatGPT` + - `bot_type`: 使用OpenAI相关模型时无需填写。当使用第三方代理接口接入Claude等非OpenAI官方模型时,该参数设为 `openai`
@@ -332,7 +332,7 @@ volumes: 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "MiniMax-M2.5", "open_ai_api_base": "https://api.minimaxi.com/v1", "open_ai_api_key": "" @@ -361,7 +361,7 @@ volumes: 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "glm-5", "open_ai_api_base": "https://open.bigmodel.cn/api/paas/v4", "open_ai_api_key": "" @@ -390,7 +390,7 @@ volumes: 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "qwen3.5-plus", "open_ai_api_base": "https://dashscope.aliyuncs.com/compatible-mode/v1", "open_ai_api_key": "sk-qVxxxxG" @@ -419,7 +419,7 @@ volumes: 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "kimi-k2.5", "open_ai_api_base": "https://api.moonshot.cn/v1", "open_ai_api_key": "" @@ -489,8 +489,8 @@ API Key创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn) { "model": "deepseek-chat", "open_ai_api_key": "sk-xxxxxxxxxxx", - "open_ai_api_base": "https://api.deepseek.com/v1", - "bot_type": "chatGPT" + "open_ai_api_base": "https://api.deepseek.com/v1", + "bot_type": "openai" } ``` @@ -545,7 +545,7 @@ API Key创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn) 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "ERNIE-4.0-Turbo-8K", "open_ai_api_base": "https://qianfan.baidubce.com/v2", "open_ai_api_key": "bce-v3/ALTxxxxxxd2b" @@ -581,7 +581,7 @@ API Key创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn) 方式二:OpenAI兼容方式接入,配置如下: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "4.0Ultra", "open_ai_api_base": "https://spark-api-open.xf-yun.com/v1", "open_ai_api_key": "" @@ -613,6 +613,23 @@ API Key创建:在 [控制台](https://aistudio.google.com/app/apikey?hl=zh-cn) - `text_to_image`: 图像生成模型,参考[模型列表](https://www.modelscope.cn/models?filter=inference_type&page=1)
+
+Coding Plan (编程包月套餐) + +Coding Plan 是各厂商推出的编程包月套餐,所有厂商均可通过 OpenAI 兼容方式接入: + +```json +{ + "bot_type": "openai", + "model": "模型名称", + "open_ai_api_base": "厂商 Coding Plan API Base", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +目前支持阿里云、MiniMax、智谱GLM、Kimi、火山引擎等厂商,各厂商详细配置请参考 [Coding Plan 文档](https://docs.cowagent.ai/models/coding-plan)。 +
+ ## 通道说明 diff --git a/agent/protocol/agent_stream.py b/agent/protocol/agent_stream.py index 6e1703c1..1aa18b84 100644 --- a/agent/protocol/agent_stream.py +++ b/agent/protocol/agent_stream.py @@ -609,14 +609,14 @@ class AgentStreamExecutor: "arguments": "" } - if "id" in tc_delta: + if tc_delta.get("id"): tool_calls_buffer[index]["id"] = tc_delta["id"] if "function" in tc_delta: func = tc_delta["function"] - if "name" in func: + if func.get("name"): tool_calls_buffer[index]["name"] = func["name"] - if "arguments" in func: + if func.get("arguments"): tool_calls_buffer[index]["arguments"] += func["arguments"] # Preserve _gemini_raw_parts for Gemini thoughtSignature round-trip @@ -720,9 +720,9 @@ class AgentStreamExecutor: ) else: if retry_count >= max_retries: - logger.error(f"❌ LLM API error after {max_retries} retries: {e}") + logger.error(f"❌ LLM API error after {max_retries} retries: {e}", exc_info=True) else: - logger.error(f"❌ LLM call error (non-retryable): {e}") + logger.error(f"❌ LLM call error (non-retryable): {e}", exc_info=True) raise # Parse tool calls diff --git a/bridge/agent_bridge.py b/bridge/agent_bridge.py index 2f27661f..7e5e605a 100644 --- a/bridge/agent_bridge.py +++ b/bridge/agent_bridge.py @@ -106,7 +106,7 @@ class AgentLLMModel(LLMModel): return configured_bot_type if not model_name or not isinstance(model_name, str): - return const.CHATGPT + return const.OPENAI if model_name in self._MODEL_BOT_TYPE_MAP: return self._MODEL_BOT_TYPE_MAP[model_name] if model_name.lower().startswith("minimax") or model_name in ["abab6.5-chat"]: @@ -116,11 +116,11 @@ class AgentLLMModel(LLMModel): if model_name in [const.MOONSHOT, "moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"]: return const.MOONSHOT if model_name in [const.DEEPSEEK_CHAT, const.DEEPSEEK_REASONER]: - return const.CHATGPT + return const.OPENAI for prefix, btype in self._MODEL_PREFIX_MAP: if model_name.startswith(prefix): return btype - return const.CHATGPT + return const.OPENAI @property def bot(self): diff --git a/bridge/bridge.py b/bridge/bridge.py index a4a50111..6c2dcb2d 100644 --- a/bridge/bridge.py +++ b/bridge/bridge.py @@ -13,7 +13,7 @@ from voice.factory import create_voice class Bridge(object): def __init__(self): self.btype = { - "chat": const.CHATGPT, + "chat": const.OPENAI, "voice_to_text": conf().get("voice_to_text", "openai"), "text_to_voice": conf().get("text_to_voice", "google"), "translate": conf().get("translate", "baidu"), diff --git a/channel/web/static/js/console.js b/channel/web/static/js/console.js index daf4f276..fcd4ec88 100644 --- a/channel/web/static/js/console.js +++ b/channel/web/static/js/console.js @@ -992,7 +992,6 @@ let configProviders = {}; let configApiBases = {}; let configApiKeys = {}; let configCurrentModel = ''; -let configHasBotType = false; let cfgProviderValue = ''; let cfgModelValue = ''; @@ -1052,7 +1051,6 @@ function initConfigView(data) { configApiBases = data.api_bases || {}; configApiKeys = data.api_keys || {}; configCurrentModel = data.model || ''; - configHasBotType = !!data.has_bot_type; const providerEl = document.getElementById('cfg-provider'); const providerOpts = Object.entries(configProviders).map(([pid, p]) => ({ value: pid, label: p.label })); @@ -1214,8 +1212,10 @@ function saveModelConfig() { const updates = { model: model }; const p = configProviders[cfgProviderValue]; updates.use_linkai = (cfgProviderValue === 'linkai'); - if (configHasBotType) { - updates.bot_type = (cfgProviderValue === 'linkai') ? '' : cfgProviderValue; + if (cfgProviderValue === 'linkai') { + updates.bot_type = ''; + } else { + updates.bot_type = cfgProviderValue; } if (p && p.api_base_key) { const base = document.getElementById('cfg-api-base').value.trim(); diff --git a/channel/web/web_channel.py b/channel/web/web_channel.py index 6f5dd989..1535b616 100644 --- a/channel/web/web_channel.py +++ b/channel/web/web_channel.py @@ -551,7 +551,7 @@ class ConfigHandler: "api_base_default": "https://generativelanguage.googleapis.com", "models": [const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE], }), - ("chatGPT", { + ("openai", { "label": "OpenAI", "api_key_field": "open_ai_api_key", "api_base_key": "open_ai_api_base", @@ -625,8 +625,7 @@ class ConfigHandler: "use_agent": use_agent, "title": title, "model": local_config.get("model", ""), - "bot_type": local_config.get("bot_type", ""), - "has_bot_type": "bot_type" in local_config, + "bot_type": "openai" if local_config.get("bot_type") == "chatGPT" else local_config.get("bot_type", ""), "use_linkai": bool(local_config.get("use_linkai", False)), "channel_type": local_config.get("channel_type", ""), "agent_max_context_tokens": local_config.get("agent_max_context_tokens", 50000), @@ -671,9 +670,6 @@ class ConfigHandler: file_cfg = json.load(f) else: file_cfg = {} - if "bot_type" in applied and "bot_type" not in file_cfg: - del applied["bot_type"] - local_config.pop("bot_type", None) file_cfg.update(applied) with open(config_path, "w", encoding="utf-8") as f: json.dump(file_cfg, f, indent=4, ensure_ascii=False) diff --git a/common/const.py b/common/const.py index 02833ce2..845af25b 100644 --- a/common/const.py +++ b/common/const.py @@ -1,6 +1,7 @@ # 厂商类型 OPEN_AI = "openAI" -CHATGPT = "chatGPT" +OPENAI = "openai" +CHATGPT = "chatGPT" # legacy alias for OPENAI, kept for backward compatibility BAIDU = "baidu" XUNFEI = "xunfei" CHATGPTONAZURE = "chatGPTOnAzure" diff --git a/config.py b/config.py index 93e3d6e9..f0fcc854 100644 --- a/config.py +++ b/config.py @@ -20,7 +20,7 @@ available_setting = { "proxy": "", # openai使用的代理 # chatgpt模型, 当use_azure_chatgpt为true时,其名称为Azure上model deployment名称 "model": "gpt-3.5-turbo", # 可选择: gpt-4o, pt-4o-mini, gpt-4-turbo, claude-3-sonnet, wenxin, moonshot, qwen-turbo, xunfei, glm-4, minimax, gemini等模型,全部可选模型详见common/const.py文件 - "bot_type": "", # 可选配置,使用兼容openai格式的三方服务时候,需填"chatGPT"。bot具体名称详见common/const.py文件列出的bot_type,如不填根据model名称判断, + "bot_type": "", # 可选配置,使用兼容openai格式的三方服务时候,需填"openai"(历史值"chatGPT"仍兼容)。bot具体名称详见common/const.py文件,如不填根据model名称判断 "use_azure_chatgpt": False, # 是否使用azure的chatgpt "azure_deployment_id": "", # azure 模型部署名称 "azure_api_version": "", # azure api版本 diff --git a/docs/docs.json b/docs/docs.json index ebfe8772..96986fff 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -80,7 +80,8 @@ "models/gemini", "models/openai", "models/deepseek", - "models/linkai" + "models/linkai", + "models/coding-plan" ] } ] @@ -171,6 +172,7 @@ "group": "发布记录", "pages": [ "releases/overview", + "releases/v2.0.3", "releases/v2.0.2", "releases/v2.0.1", "releases/v2.0.0" @@ -224,7 +226,8 @@ "en/models/gemini", "en/models/openai", "en/models/deepseek", - "en/models/linkai" + "en/models/linkai", + "en/models/coding-plan" ] } ] diff --git a/docs/en/README.md b/docs/en/README.md index 2f5d052c..f40b3d0b 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -133,6 +133,28 @@ Supports mainstream model providers. Recommended models for Agent mode: For detailed configuration of each model, see the [Models documentation](https://docs.cowagent.ai/en/models/index). +### Coding Plan + +Coding Plan is a monthly subscription package offered by various providers, ideal for high-frequency Agent usage. All providers can be accessed via OpenAI-compatible mode: + +```json +{ + "bot_type": "openai", + "model": "MODEL_NAME", + "open_ai_api_base": "PROVIDER_CODING_PLAN_API_BASE", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +- `bot_type`: Must be `openai` +- `model`: Model name supported by the provider +- `open_ai_api_base`: Provider's Coding Plan API Base (different from standard pay-as-you-go) +- `open_ai_api_key`: Provider's Coding Plan API Key + +> Note: Coding Plan API Base and API Key are usually separate from standard pay-as-you-go ones. Please obtain them from each provider's platform. + +Supported providers include Alibaba Cloud, MiniMax, Zhipu GLM, Kimi, Volcengine, and more. For detailed configuration of each provider, see the [Coding Plan documentation](https://docs.cowagent.ai/en/models/coding-plan). +
## Channels diff --git a/docs/en/models/coding-plan.mdx b/docs/en/models/coding-plan.mdx new file mode 100644 index 00000000..994dee20 --- /dev/null +++ b/docs/en/models/coding-plan.mdx @@ -0,0 +1,139 @@ +--- +title: Coding Plan +description: Coding Plan model configuration +--- + +> Coding Plan is a monthly subscription package offered by various providers, ideal for high-frequency Agent usage. CowAgent supports all Coding Plan providers via OpenAI-compatible mode. + + + Coding Plan API Base and API Key are usually separate from the standard pay-as-you-go ones. Please obtain them from each provider's platform. + + +## General Configuration + +All providers can be accessed via the OpenAI-compatible protocol, and can be quickly configured through the web console. Set the model provider to **OpenAI**, select a custom model and enter the model code, then fill in the corresponding provider's API Base and API Key: + + + +You can also configure directly in `config.json`: + +```json +{ + "bot_type": "openai", + "model": "MODEL_NAME", + "open_ai_api_base": "PROVIDER_CODING_PLAN_API_BASE", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `bot_type` | Must be `openai` (OpenAI-compatible mode) | +| `model` | Model name supported by the provider | +| `open_ai_api_base` | Provider's Coding Plan API Base URL | +| `open_ai_api_key` | Provider's Coding Plan API Key | + +--- + +## Alibaba Cloud + +```json +{ + "bot_type": "openai", + "model": "qwen3.5-plus", + "open_ai_api_base": "https://coding.dashscope.aliyuncs.com/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `model` | `qwen3.5-plus`, `qwen3-max-2026-01-23`, `qwen3-coder-next`, `qwen3-coder-plus`, `glm-5`, `glm-4.7`, `kimi-k2.5`, `MiniMax-M2.5` | +| `open_ai_api_base` | `https://coding.dashscope.aliyuncs.com/v1` | +| `open_ai_api_key` | Coding Plan specific key (not shared with pay-as-you-go) | + +Reference: [Quick Start](https://help.aliyun.com/zh/model-studio/coding-plan-quickstart?spm=a2c4g.11186623.help-menu-2400256.d_0_2_1.70115203zi5Igc), [Model List](https://help.aliyun.com/zh/model-studio/coding-plan) + +--- + +## MiniMax + +```json +{ + "bot_type": "openai", + "model": "MiniMax-M2.5", + "open_ai_api_base": "https://api.minimaxi.com/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `model` | `MiniMax-M2.5`, `MiniMax-M2.5-highspeed`, `MiniMax-M2.1`, `MiniMax-M2` | +| `open_ai_api_base` | China: `https://api.minimaxi.com/v1`; Global: `https://api.minimax.io/v1` | +| `open_ai_api_key` | Coding Plan specific key (not shared with pay-as-you-go) | + +Reference: [China Key](https://platform.minimaxi.com/docs/coding-plan/quickstart), [Model List](https://platform.minimaxi.com/docs/guides/pricing-coding-plan), [Global Key](https://platform.minimax.io/docs/coding-plan/quickstart) + +--- + +## Zhipu GLM + +```json +{ + "bot_type": "openai", + "model": "glm-4.7", + "open_ai_api_base": "https://open.bigmodel.cn/api/coding/paas/v4", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `model` | `glm-5`, `glm-4.7`, `glm-4.6`, `glm-4.5`, `glm-4.5-air` | +| `open_ai_api_base` | China: `https://open.bigmodel.cn/api/coding/paas/v4`; Global: `https://api.z.ai/api/coding/paas/v4` | +| `open_ai_api_key` | Shared with standard API | + +Reference: [China Quick Start](https://docs.bigmodel.cn/cn/coding-plan/quick-start), [Global Quick Start](https://docs.z.ai/devpack/quick-start) + +--- + +## Kimi + +```json +{ + "bot_type": "openai", + "model": "kimi-for-coding", + "open_ai_api_base": "https://api.kimi.com/coding/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `model` | `kimi-for-coding` | +| `open_ai_api_base` | `https://api.kimi.com/coding/v1` | +| `open_ai_api_key` | Coding Plan specific key (not shared with pay-as-you-go) | + +Reference: [Key & Docs](https://www.kimi.com/code/docs/) + +--- + +## Volcengine + +```json +{ + "bot_type": "openai", + "model": "Doubao-Seed-2.0-Code", + "open_ai_api_base": "https://ark.cn-beijing.volces.com/api/coding/v3", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| Parameter | Description | +| --- | --- | +| `model` | `Doubao-Seed-2.0-Code`, `Doubao-Seed-2.0-pro`, `Doubao-Seed-2.0-lite`, `Doubao-Seed-Code`, `MiniMax-M2.5`, `Kimi-K2.5`, `GLM-4.7`, `DeepSeek-V3.2` | +| `open_ai_api_base` | `https://ark.cn-beijing.volces.com/api/coding/v3` | +| `open_ai_api_key` | Shared with standard API | + +Reference: [Quick Start](https://www.volcengine.com/docs/82379/1928261?lang=zh) diff --git a/docs/en/models/deepseek.mdx b/docs/en/models/deepseek.mdx index a60ca68c..3d7f721c 100644 --- a/docs/en/models/deepseek.mdx +++ b/docs/en/models/deepseek.mdx @@ -8,7 +8,7 @@ Use OpenAI-compatible configuration: ```json { "model": "deepseek-chat", - "bot_type": "chatGPT", + "bot_type": "openai", "open_ai_api_key": "YOUR_API_KEY", "open_ai_api_base": "https://api.deepseek.com/v1" } @@ -17,6 +17,6 @@ Use OpenAI-compatible configuration: | Parameter | Description | | --- | --- | | `model` | `deepseek-chat` (DeepSeek-V3), `deepseek-reasoner` (DeepSeek-R1) | -| `bot_type` | Must be `chatGPT` (OpenAI-compatible mode) | +| `bot_type` | Must be `openai` (OpenAI-compatible mode) | | `open_ai_api_key` | Create at [DeepSeek Platform](https://platform.deepseek.com/api_keys) | | `open_ai_api_base` | DeepSeek platform BASE URL | diff --git a/docs/en/models/glm.mdx b/docs/en/models/glm.mdx index 54ee484a..56ea8193 100644 --- a/docs/en/models/glm.mdx +++ b/docs/en/models/glm.mdx @@ -19,7 +19,7 @@ OpenAI-compatible configuration is also supported: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "glm-5", "open_ai_api_base": "https://open.bigmodel.cn/api/paas/v4", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/en/models/index.mdx b/docs/en/models/index.mdx index 35a78720..1ac9506d 100644 --- a/docs/en/models/index.mdx +++ b/docs/en/models/index.mdx @@ -11,7 +11,7 @@ CowAgent supports mainstream LLMs from domestic and international providers. Mod ## Configuration -Configure the model name and API key in `config.json` according to your chosen model. Each model also supports OpenAI-compatible access by setting `bot_type` to `chatGPT` and configuring `open_ai_api_base` and `open_ai_api_key`. +Configure the model name and API key in `config.json` according to your chosen model. Each model also supports OpenAI-compatible access by setting `bot_type` to `openai` and configuring `open_ai_api_base` and `open_ai_api_key`. You can also use the [LinkAI](https://link-ai.tech) platform interface to flexibly switch between multiple models with support for knowledge base, workflows, and other Agent capabilities. diff --git a/docs/en/models/kimi.mdx b/docs/en/models/kimi.mdx index 3470e859..f843bb46 100644 --- a/docs/en/models/kimi.mdx +++ b/docs/en/models/kimi.mdx @@ -19,7 +19,7 @@ OpenAI-compatible configuration is also supported: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "kimi-k2.5", "open_ai_api_base": "https://api.moonshot.cn/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/en/models/minimax.mdx b/docs/en/models/minimax.mdx index 6b4dfe76..981153d9 100644 --- a/docs/en/models/minimax.mdx +++ b/docs/en/models/minimax.mdx @@ -19,7 +19,7 @@ OpenAI-compatible configuration is also supported: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "MiniMax-M2.5", "open_ai_api_base": "https://api.minimaxi.com/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/en/models/openai.mdx b/docs/en/models/openai.mdx index 3a1203ee..dc2c0be7 100644 --- a/docs/en/models/openai.mdx +++ b/docs/en/models/openai.mdx @@ -16,4 +16,4 @@ description: OpenAI model configuration | `model` | Matches the [model parameter](https://platform.openai.com/docs/models) of the OpenAI API. Supports o-series, gpt-5.4, gpt-5 series, gpt-4.1, etc. Recommended for Agent mode: `gpt-5.4` | | `open_ai_api_key` | Create at [OpenAI Platform](https://platform.openai.com/api-keys) | | `open_ai_api_base` | Optional. Change to use third-party proxy | -| `bot_type` | Not required for official OpenAI models. Set to `chatGPT` when using Claude or other non-OpenAI models via proxy | +| `bot_type` | Not required for official OpenAI models. Set to `openai` when using Claude or other non-OpenAI models via proxy | diff --git a/docs/en/models/qwen.mdx b/docs/en/models/qwen.mdx index a17771f0..50dff08b 100644 --- a/docs/en/models/qwen.mdx +++ b/docs/en/models/qwen.mdx @@ -19,7 +19,7 @@ OpenAI-compatible configuration is also supported: ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "qwen3.5-plus", "open_ai_api_base": "https://dashscope.aliyuncs.com/compatible-mode/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/models/coding-plan.mdx b/docs/models/coding-plan.mdx new file mode 100644 index 00000000..b7d674e4 --- /dev/null +++ b/docs/models/coding-plan.mdx @@ -0,0 +1,140 @@ +--- +title: Coding Plan +description: Coding Plan 模式模型配置 +--- + +> Coding Plan 是各厂商推出的编程包月套餐,适合高频使用 Agent 的场景。CowAgent 支持通过 OpenAI 兼容方式接入各厂商的 Coding Plan 接口。 + + + Coding Plan 的 API Base 和 API Key 通常与普通按量计费接口不通用,请在各厂商平台单独获取。 + + +## 通用配置格式 + +所有厂商均可使用 OpenAI 兼容协议接入,可在web控制台快速配置。设置模型厂商为**OpenAI**,选择自定义模型并填入模型编码,最后填写对应厂商的API Base 和 API Key: + + + +也可通过 `config.json` 配置文件直接修改: + +```json +{ + "bot_type": "openai", + "model": "模型名称", + "open_ai_api_base": "厂商 Coding Plan API Base", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `bot_type` | 固定为 `openai`(OpenAI 兼容方式) | +| `model` | 各厂商支持的模型名称 | +| `open_ai_api_base` | 各厂商 Coding Plan 专用 API Base | +| `open_ai_api_key` | 各厂商 Coding Plan 专用 API Key | + +--- + +## 阿里云 + +```json +{ + "bot_type": "openai", + "model": "qwen3.5-plus", + "open_ai_api_base": "https://coding.dashscope.aliyuncs.com/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `model` | `qwen3.5-plus`、`qwen3-max-2026-01-23`、`qwen3-coder-next`、`qwen3-coder-plus`、`glm-5`、`glm-4.7`、`kimi-k2.5`、`MiniMax-M2.5` | +| `open_ai_api_base` | `https://coding.dashscope.aliyuncs.com/v1` | +| `open_ai_api_key` | Coding Plan 专用 Key(与按量计费接口不通用) | + +官方文档:[快速开始](https://help.aliyun.com/zh/model-studio/coding-plan-quickstart?spm=a2c4g.11186623.help-menu-2400256.d_0_2_1.70115203zi5Igc)、[模型列表](https://help.aliyun.com/zh/model-studio/coding-plan) + +--- + +## MiniMax + +```json +{ + "bot_type": "openai", + "model": "MiniMax-M2.5", + "open_ai_api_base": "https://api.minimaxi.com/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `model` | `MiniMax-M2.5`、`MiniMax-M2.5-highspeed`、`MiniMax-M2.1`、`MiniMax-M2` | +| `open_ai_api_base` | 国内:`https://api.minimaxi.com/v1`;海外:`https://api.minimax.io/v1` | +| `open_ai_api_key` | Coding Plan 专用 Key(与按量计费接口不通用) | + +官方文档:[国内 Key 获取](https://platform.minimaxi.com/docs/coding-plan/quickstart)、[模型列表](https://platform.minimaxi.com/docs/guides/pricing-coding-plan)、[国际 Key 获取](https://platform.minimax.io/docs/coding-plan/quickstart) + +--- + + +## 智谱 GLM + +```json +{ + "bot_type": "openai", + "model": "glm-4.7", + "open_ai_api_base": "https://open.bigmodel.cn/api/coding/paas/v4", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `model` | `glm-5`、`glm-4.7`、`glm-4.6`、`glm-4.5`、`glm-4.5-air` | +| `open_ai_api_base` | 中国区:`https://open.bigmodel.cn/api/coding/paas/v4`;全球区:`https://api.z.ai/api/coding/paas/v4` | +| `open_ai_api_key` | API Key 与普通接口通用 | + +官方文档:[国内版快速开始](https://docs.bigmodel.cn/cn/coding-plan/quick-start)、[国际版快速开始](https://docs.z.ai/devpack/quick-start) + +--- + +## Kimi + +```json +{ + "bot_type": "openai", + "model": "kimi-for-coding", + "open_ai_api_base": "https://api.kimi.com/coding/v1", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `model` | `kimi-for-coding` | +| `open_ai_api_base` | `https://api.kimi.com/coding/v1` | +| `open_ai_api_key` | Coding Plan 专用 Key(与按量计费接口不通用) | + +官方文档:[Key 获取](https://www.kimi.com/code/docs/) + +--- + +## 火山引擎 + +```json +{ + "bot_type": "openai", + "model": "Doubao-Seed-2.0-Code", + "open_ai_api_base": "https://ark.cn-beijing.volces.com/api/coding/v3", + "open_ai_api_key": "YOUR_API_KEY" +} +``` + +| 参数 | 说明 | +| --- | --- | +| `model` | `Doubao-Seed-2.0-Code`、`Doubao-Seed-2.0-pro`、`Doubao-Seed-2.0-lite`、`Doubao-Seed-Code`、`MiniMax-M2.5`、`Kimi-K2.5`、`GLM-4.7`、`DeepSeek-V3.2` | +| `open_ai_api_base` | `https://ark.cn-beijing.volces.com/api/coding/v3` | +| `open_ai_api_key` | API Key 与普通接口通用 | + +官方文档:[快速开始](https://www.volcengine.com/docs/82379/1928261?lang=zh) diff --git a/docs/models/deepseek.mdx b/docs/models/deepseek.mdx index 38580852..32d9b5b7 100644 --- a/docs/models/deepseek.mdx +++ b/docs/models/deepseek.mdx @@ -10,13 +10,13 @@ description: DeepSeek 模型配置 "model": "deepseek-chat", "open_ai_api_key": "YOUR_API_KEY", "open_ai_api_base": "https://api.deepseek.com/v1", - "bot_type": "chatGPT" + "bot_type": "openai" } ``` | 参数 | 说明 | | --- | --- | | `model` | `deepseek-chat`(DeepSeek-V3)、`deepseek-reasoner`(DeepSeek-R1) | -| `bot_type` | 固定为 `chatGPT`(OpenAI 兼容方式) | +| `bot_type` | 固定为 `openai`(OpenAI 兼容方式) | | `open_ai_api_key` | 在 [DeepSeek 平台](https://platform.deepseek.com/api_keys) 创建 | | `open_ai_api_base` | DeepSeek 平台 BASE URL | diff --git a/docs/models/glm.mdx b/docs/models/glm.mdx index bc393db8..1d37230a 100644 --- a/docs/models/glm.mdx +++ b/docs/models/glm.mdx @@ -19,7 +19,7 @@ description: 智谱AI GLM 模型配置 ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "glm-5", "open_ai_api_base": "https://open.bigmodel.cn/api/paas/v4", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/models/index.mdx b/docs/models/index.mdx index 03998717..76827f83 100644 --- a/docs/models/index.mdx +++ b/docs/models/index.mdx @@ -11,9 +11,13 @@ CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在 ## 配置方式 -根据所选模型,在 `config.json` 中填写对应的模型名称和 API Key 即可。每个模型也支持 OpenAI 兼容方式接入,将 `bot_type` 设为 `chatGPT`,配置 `open_ai_api_base` 和 `open_ai_api_key`。 +根据所选模型,在 `config.json` 中填写对应的模型名称和 API Key 即可。每个模型也支持 OpenAI 兼容方式接入,将 `bot_type` 设为 `openai`,配置 `open_ai_api_base` 和 `open_ai_api_key`。 -同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,可灵活切换多种模型并支持知识库、工作流等 Agent 能力。 +同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,可灵活切换多种模型,并支持知识库、工作流、插件等 Agent 能力。 + +也可以通过 [Web 控制台](/channels/web) 在线管理模型配置,无需手动编辑配置文件: + + ## 支持的模型 diff --git a/docs/models/kimi.mdx b/docs/models/kimi.mdx index 1ddf8a6f..6543cbcf 100644 --- a/docs/models/kimi.mdx +++ b/docs/models/kimi.mdx @@ -19,7 +19,7 @@ description: Kimi (Moonshot) 模型配置 ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "kimi-k2.5", "open_ai_api_base": "https://api.moonshot.cn/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/models/minimax.mdx b/docs/models/minimax.mdx index 59014701..b842f886 100644 --- a/docs/models/minimax.mdx +++ b/docs/models/minimax.mdx @@ -19,7 +19,7 @@ description: MiniMax 模型配置 ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "MiniMax-M2.5", "open_ai_api_base": "https://api.minimaxi.com/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/models/openai.mdx b/docs/models/openai.mdx index 07139ac2..64058af2 100644 --- a/docs/models/openai.mdx +++ b/docs/models/openai.mdx @@ -16,4 +16,4 @@ description: OpenAI 模型配置 | `model` | 与 OpenAI 接口的 [model 参数](https://platform.openai.com/docs/models) 一致,支持 o 系列、gpt-5.4、gpt-5 系列、gpt-4.1 等,Agent 模式推荐使用 `gpt-5.4` | | `open_ai_api_key` | 在 [OpenAI 平台](https://platform.openai.com/api-keys) 创建 | | `open_ai_api_base` | 可选,修改可接入第三方代理接口 | -| `bot_type` | 使用 OpenAI 官方模型时无需填写。当通过代理接口使用 Claude 等非 OpenAI 模型时,设为 `chatGPT` | +| `bot_type` | 使用 OpenAI 官方模型时无需填写。当通过代理接口使用 Claude 等非 OpenAI 模型时,设为 `openai` | diff --git a/docs/models/qwen.mdx b/docs/models/qwen.mdx index f3c75063..df670937 100644 --- a/docs/models/qwen.mdx +++ b/docs/models/qwen.mdx @@ -19,7 +19,7 @@ description: 通义千问模型配置 ```json { - "bot_type": "chatGPT", + "bot_type": "openai", "model": "qwen3.5-plus", "open_ai_api_base": "https://dashscope.aliyuncs.com/compatible-mode/v1", "open_ai_api_key": "YOUR_API_KEY" diff --git a/docs/releases/overview.mdx b/docs/releases/overview.mdx index db89afcd..5429f552 100644 --- a/docs/releases/overview.mdx +++ b/docs/releases/overview.mdx @@ -5,6 +5,7 @@ description: CowAgent 版本更新历史 | 版本 | 日期 | 说明 | | --- | --- | --- | +| [2.0.3](/releases/v2.0.3) | 2026.03.18 | 新增企微智能机器人和 QQ 通道、Web 控制台文件处理、记忆系统升级 | | [2.0.2](/releases/v2.0.2) | 2026.02.27 | Web 控制台升级、多通道同时运行、会话持久化 | | [2.0.1](/releases/v2.0.1) | 2026.02.13 | 内置 Web Search 工具、智能上下文管理、多项修复 | | [2.0.0](/releases/v2.0.0) | 2026.02.03 | 全面升级为超级 Agent 助理 | diff --git a/docs/releases/v2.0.3.mdx b/docs/releases/v2.0.3.mdx new file mode 100644 index 00000000..3e669cff --- /dev/null +++ b/docs/releases/v2.0.3.mdx @@ -0,0 +1,79 @@ +--- +title: v2.0.3 +description: CowAgent 2.0.3 - 新增企微智能机器人和 QQ 通道、Web 控制台文件处理、记忆系统升级 +--- + +## 🔌 新增接入通道 + +### 企业微信智能机器人 + +新增企业微信智能机器人(`wecom_bot`)通道,支持流式卡片消息输出,支持文本和图片消息的接收与回复,可在 Web 控制台中进行通道配置和管理。 + +接入文档:[企微智能机器人接入](/channels/wecom-bot)。 + +相关提交:[d4480b6](https://github.com/zhayujie/chatgpt-on-wechat/commit/d4480b6), [a42f31f](https://github.com/zhayujie/chatgpt-on-wechat/commit/a42f31f), [4ecd4df](https://github.com/zhayujie/chatgpt-on-wechat/commit/4ecd4df), [8b45d6c](https://github.com/zhayujie/chatgpt-on-wechat/commit/8b45d6c) + +### QQ 通道 + +新增 QQ 官方机器人(`qq`)通道,支持文本和图片消息的接收与回复,支持私聊和群聊场景。 + +接入文档参考: [QQ机器人接入](/channels/qq)。 + +相关提交:[005a0e1](https://github.com/zhayujie/chatgpt-on-wechat/commit/005a0e1), [a4d54f5](https://github.com/zhayujie/chatgpt-on-wechat/commit/a4d54f5) + +## 🖥️ Web 控制台支持文件输入和处理 + +Web 控制台对话界面支持文件和图片上传,可直接发送文件给 Agent 进行处理。同时 Read 工具新增对 Office 文档(Word、Excel、PPT)的解析能力。 + +相关提交:[30c6d9b](https://github.com/zhayujie/chatgpt-on-wechat/commit/30c6d9b) + +## 🤖 新增模型 + +- **GPT-5.4**:新增 `gpt-5.4` 模型支持 ([1623deb](https://github.com/zhayujie/chatgpt-on-wechat/commit/1623deb)) +- **Gemini 3.1 Flash Lite Preview**:新增 `gemini-3.1-flash-lite-preview` 模型支持 ([ba915f2](https://github.com/zhayujie/chatgpt-on-wechat/commit/ba915f2)) + +## 💰 Coding Plan 支持 + +新增各厂商 Coding Plan(编程包月套餐)的接入支持,通过 OpenAI 兼容方式统一接入。目前已支持阿里云、MiniMax、智谱 GLM、Kimi、火山引擎等厂商。 + +详细配置参考 [Coding Plan 文档](/models/coding-plan)。 + +## 🧠 记忆系统升级 + +记忆冲刷(Memory Flush)系统全面升级: + +- 使用 LLM 对超出上下文窗口的对话内容进行智能摘要,生成精炼的每日记忆条目 +- 摘要在后台线程异步执行,不阻塞回复 +- 优化上下文批量裁剪策略,降低冲刷频率 +- 新增每日定时冲刷兜底机制,避免低活跃场景下记忆丢失 +- 修复上下文记忆丢失问题 + +相关提交:[022c13f](https://github.com/zhayujie/chatgpt-on-wechat/commit/022c13f), [c116235](https://github.com/zhayujie/chatgpt-on-wechat/commit/c116235) + +## 🔧 工具重构 + +- **图片识别**:将图片识别(Image Vision)从 Skill 重构为内置 Tool,新增独立的图片视觉提供方(Vision Provider)配置,提升稳定性和可维护性 ([a50fafa](https://github.com/zhayujie/chatgpt-on-wechat/commit/a50fafa), [3b8b562](https://github.com/zhayujie/chatgpt-on-wechat/commit/3b8b562)) +- **网页抓取**:将网页抓取(Web Fetch)从 Skill 重构为内置 Tool,支持远程文档文件(PDF、Word、Excel、PPT)的下载和解析 ([ccb9030](https://github.com/zhayujie/chatgpt-on-wechat/commit/ccb9030), [fa61744](https://github.com/zhayujie/chatgpt-on-wechat/commit/fa61744)) + +## ⚡ 性能优化 + +- **启动加速**:飞书通道采用懒加载方式导入依赖,避免 4-10 秒的启动延迟 ([924dc79](https://github.com/zhayujie/chatgpt-on-wechat/commit/924dc79)) +- **通道稳定性**:优化通道连接稳定性,支持通道配置通过环境变量设置 ([f1c04bc](https://github.com/zhayujie/chatgpt-on-wechat/commit/f1c04bc), [46d97fd](https://github.com/zhayujie/chatgpt-on-wechat/commit/46d97fd)) + +## 🐛 问题修复 + +- **bot_type 配置**:修复 Agent 模式下 `bot_type` 配置传递问题 ([36d54ca](https://github.com/zhayujie/chatgpt-on-wechat/commit/36d54ca)) ([#2691](https://github.com/zhayujie/chatgpt-on-wechat/pull/2691)) Thanks [@Weikjssss](https://github.com/Weikjssss) +- **bot_type 优先级**:调整 Agent 模式下 `bot_type` 的解析优先级 ([d0a70d3](https://github.com/zhayujie/chatgpt-on-wechat/commit/d0a70d3)) ([#2692](https://github.com/zhayujie/chatgpt-on-wechat/pull/2692)) Thanks [@6vision](https://github.com/6vision) +- **智谱模型配置**:修复智谱 `bot_type` 命名、Web 控制台持久化及正则转义问题 ([c4a93b7](https://github.com/zhayujie/chatgpt-on-wechat/commit/c4a93b7)) ([#2693](https://github.com/zhayujie/chatgpt-on-wechat/pull/2693)) Thanks [@6vision](https://github.com/6vision) +- **OpenAI 兼容层**:使用 `openai_compat` 层统一错误处理 ([f1e888f](https://github.com/zhayujie/chatgpt-on-wechat/commit/f1e888f)) ([#2688](https://github.com/zhayujie/chatgpt-on-wechat/pull/2688)) Thanks [@JasonOA888](https://github.com/JasonOA888) +- **OpenAI 兼容迁移**:完成所有模型 Bot 的 `openai_compat` 迁移 ([d5d0b94](https://github.com/zhayujie/chatgpt-on-wechat/commit/d5d0b94)) ([#2689](https://github.com/zhayujie/chatgpt-on-wechat/pull/2689)) +- **Gemini 工具调用**:修复 Gemini 模型的工具调用匹配问题 ([eda82ba](https://github.com/zhayujie/chatgpt-on-wechat/commit/eda82ba)) +- **会话并发**:修复会话并发场景下的竞态条件问题 ([9879878](https://github.com/zhayujie/chatgpt-on-wechat/commit/9879878)) +- **历史消息恢复**:修复历史会话消息不完整问题,仅恢复 user/assistant 文本消息,剥离工具调用 ([b788a3d](https://github.com/zhayujie/chatgpt-on-wechat/commit/b788a3d), [a33ce97](https://github.com/zhayujie/chatgpt-on-wechat/commit/a33ce97)) +- **飞书群聊**:移除飞书群聊场景下对 `bot_name` 的依赖 ([b641bff](https://github.com/zhayujie/chatgpt-on-wechat/commit/b641bff)) +- **Safari 兼容**:修复 Safari 浏览器 IME 回车键误触发消息发送问题 ([0687916](https://github.com/zhayujie/chatgpt-on-wechat/commit/0687916)) +- **Windows 兼容**:修复 Windows 下 bash 风格 `$VAR` 环境变量转换为 `%VAR%` 的问题 ([7c67513](https://github.com/zhayujie/chatgpt-on-wechat/commit/7c67513)) +- **MiniMax 参数**:增加 MiniMax 模型的 `max_tokens` 限制 ([1767413](https://github.com/zhayujie/chatgpt-on-wechat/commit/1767413)) +- **.gitignore 更新**:添加 Python 目录忽略规则 ([9318138](https://github.com/zhayujie/chatgpt-on-wechat/commit/9318138)) ([#2683](https://github.com/zhayujie/chatgpt-on-wechat/pull/2683)) Thanks [@pelioo](https://github.com/pelioo) + +**发布日期**:2026.03.18 | [Full Changelog](https://github.com/zhayujie/chatgpt-on-wechat/compare/2.0.2...master) diff --git a/models/bot_factory.py b/models/bot_factory.py index e6e6f92e..26111b6d 100644 --- a/models/bot_factory.py +++ b/models/bot_factory.py @@ -17,7 +17,7 @@ def create_bot(bot_type): from models.baidu.baidu_wenxin import BaiduWenxinBot return BaiduWenxinBot() - elif bot_type in (const.CHATGPT, const.DEEPSEEK): # DeepSeek uses OpenAI-compatible API + elif bot_type in (const.OPENAI, const.CHATGPT, const.DEEPSEEK): # OpenAI-compatible API from models.chatgpt.chat_gpt_bot import ChatGPTBot return ChatGPTBot() diff --git a/plugins/dungeon/dungeon.py b/plugins/dungeon/dungeon.py index b3eda23b..81b686f0 100644 --- a/plugins/dungeon/dungeon.py +++ b/plugins/dungeon/dungeon.py @@ -64,7 +64,7 @@ class Dungeon(Plugin): if e_context["context"].type != ContextType.TEXT: return bottype = Bridge().get_bot_type("chat") - if bottype not in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI]: + if bottype not in [const.OPEN_AI, const.OPENAI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI]: return bot = Bridge().get_bot("chat") content = e_context["context"].content[:] diff --git a/plugins/godcmd/godcmd.py b/plugins/godcmd/godcmd.py index 065d8597..d844a506 100644 --- a/plugins/godcmd/godcmd.py +++ b/plugins/godcmd/godcmd.py @@ -315,7 +315,7 @@ class Godcmd(Plugin): except Exception as e: ok, result = False, "你没有设置私有GPT模型" elif cmd == "reset": - if bottype in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI, const.BAIDU, const.XUNFEI, const.QWEN, const.GEMINI, const.ZHIPU_AI, const.CLAUDEAPI]: + if bottype in [const.OPEN_AI, const.OPENAI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI, const.BAIDU, const.XUNFEI, const.QWEN, const.GEMINI, const.ZHIPU_AI, const.CLAUDEAPI]: bot.sessions.clear_session(session_id) if Bridge().chat_bots.get(bottype): Bridge().chat_bots.get(bottype).sessions.clear_session(session_id) @@ -340,7 +340,7 @@ class Godcmd(Plugin): load_config() ok, result = True, "配置已重载" elif cmd == "resetall": - if bottype in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI, + if bottype in [const.OPEN_AI, const.OPENAI, const.CHATGPT, const.CHATGPTONAZURE, const.LINKAI, const.BAIDU, const.XUNFEI, const.QWEN, const.GEMINI, const.ZHIPU_AI, const.MOONSHOT, const.MODELSCOPE]: channel.cancel_all_session() diff --git a/plugins/role/role.py b/plugins/role/role.py index b4e392d0..adec6c82 100644 --- a/plugins/role/role.py +++ b/plugins/role/role.py @@ -99,7 +99,7 @@ class Role(Plugin): if e_context["context"].type != ContextType.TEXT: return btype = Bridge().get_bot_type("chat") - if btype not in [const.OPEN_AI, const.CHATGPT, const.CHATGPTONAZURE, const.QWEN_DASHSCOPE, const.XUNFEI, const.BAIDU, const.ZHIPU_AI, const.MOONSHOT, const.MiniMax, const.LINKAI,const.MODELSCOPE]: + if btype not in [const.OPEN_AI, const.OPENAI, const.CHATGPT, const.CHATGPTONAZURE, const.QWEN_DASHSCOPE, const.XUNFEI, const.BAIDU, const.ZHIPU_AI, const.MOONSHOT, const.MiniMax, const.LINKAI, const.MODELSCOPE]: logger.debug(f'不支持的bot: {btype}') return bot = Bridge().get_bot("chat") diff --git a/plugins/tool/tool.py b/plugins/tool/tool.py index 8121ae48..eaacd5f0 100644 --- a/plugins/tool/tool.py +++ b/plugins/tool/tool.py @@ -52,6 +52,7 @@ class Tool(Plugin): # 暂时不支持未来扩展的bot if Bridge().get_bot_type("chat") not in ( + const.OPENAI, const.CHATGPT, const.OPEN_AI, const.CHATGPTONAZURE,