From 8c253958058f3abd6106253d63deef8ee6a36a74 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Fri, 22 May 2026 10:39:04 +0800 Subject: [PATCH] feat(models): support gemini-3.5-flash --- agent/tools/vision/vision.py | 2 +- channel/web/web_channel.py | 8 ++++---- common/const.py | 3 ++- docs/models/gemini.mdx | 4 ++-- docs/models/index.mdx | 2 +- models/gemini/google_gemini_bot.py | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/agent/tools/vision/vision.py b/agent/tools/vision/vision.py index 6fe6250f..7e997086 100644 --- a/agent/tools/vision/vision.py +++ b/agent/tools/vision/vision.py @@ -53,7 +53,7 @@ _DISCOVERABLE_MODELS = [ ("ark_api_key", const.DOUBAO, const.DOUBAO_SEED_2_PRO, "Doubao"), ("dashscope_api_key", const.QWEN_DASHSCOPE, const.QWEN36_PLUS, "DashScope"), ("claude_api_key", const.CLAUDEAPI, const.CLAUDE_4_6_SONNET, "Claude"), - ("gemini_api_key", const.GEMINI, const.GEMINI_31_FLASH_LITE_PRE, "Gemini"), + ("gemini_api_key", const.GEMINI, const.GEMINI_35_FLASH, "Gemini"), ("qianfan_api_key", const.QIANFAN, const.ERNIE_45_TURBO_VL, "Qianfan"), ("zhipu_ai_api_key", const.ZHIPU_AI, const.GLM_4_7, "ZhipuAI"), ("minimax_api_key", const.MiniMax, const.MINIMAX_M2_7, "MiniMax"), diff --git a/channel/web/web_channel.py b/channel/web/web_channel.py index bf217f16..f320dfd2 100644 --- a/channel/web/web_channel.py +++ b/channel/web/web_channel.py @@ -1267,7 +1267,7 @@ class ConfigHandler: const.DEEPSEEK_V4_FLASH, const.DEEPSEEK_V4_PRO, const.DEEPSEEK_CHAT, const.DEEPSEEK_REASONER, const.MINIMAX_M2_7_HIGHSPEED, const.MINIMAX_M2_7, const.MINIMAX_M2_5, const.MINIMAX_M2_1, const.MINIMAX_M2_1_LIGHTNING, const.CLAUDE_4_6_SONNET, const.CLAUDE_4_7_OPUS, const.CLAUDE_4_6_OPUS, const.CLAUDE_4_5_SONNET, - const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE, + const.GEMINI_35_FLASH, const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE, const.GPT_54, const.GPT_54_MINI, const.GPT_54_NANO, const.GPT_5, const.GPT_41, const.GPT_4o, const.GLM_5_1, const.GLM_5_TURBO, const.GLM_5, const.GLM_4_7, const.QWEN36_PLUS, const.QWEN35_PLUS, const.QWEN3_MAX, @@ -1318,7 +1318,7 @@ class ConfigHandler: "api_base_key": "gemini_api_base", "api_base_default": "https://generativelanguage.googleapis.com", "api_base_placeholder": _PLACEHOLDER_GEMINI, - "models": [const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE], + "models": [const.GEMINI_35_FLASH, const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE], }), ("openai", { "label": "OpenAI", @@ -1791,7 +1791,7 @@ class ModelsHandler: "moonshot": [const.KIMI_K2_6], "dashscope": [const.QWEN36_PLUS, const.QWEN35_PLUS, const.QWEN3_MAX], "claudeAPI": [const.CLAUDE_4_6_SONNET, const.CLAUDE_4_7_OPUS, const.CLAUDE_4_6_OPUS], - "gemini": [const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE], + "gemini": [const.GEMINI_35_FLASH, const.GEMINI_31_FLASH_LITE_PRE, const.GEMINI_31_PRO_PRE, const.GEMINI_3_FLASH_PRE], "qianfan": [const.ERNIE_45_TURBO_VL], # Zhipu's bot hard-codes the call to glm-5v-turbo regardless of what # name is passed in (see models/zhipuai/zhipuai_bot.py::call_vision), @@ -1927,7 +1927,7 @@ class ModelsHandler: ("doubao", "ark_api_key", const.DOUBAO_SEED_2_PRO), ("dashscope", "dashscope_api_key", const.QWEN36_PLUS), ("claudeAPI", "claude_api_key", const.CLAUDE_4_6_SONNET), - ("gemini", "gemini_api_key", const.GEMINI_31_FLASH_LITE_PRE), + ("gemini", "gemini_api_key", const.GEMINI_35_FLASH), ("qianfan", "qianfan_api_key", const.ERNIE_45_TURBO_VL), ("zhipu", "zhipu_ai_api_key", const.GLM_5V_TURBO), ("minimax", "minimax_api_key", const.MINIMAX_TEXT_01), diff --git a/common/const.py b/common/const.py index 12c82724..3d51b29c 100644 --- a/common/const.py +++ b/common/const.py @@ -47,6 +47,7 @@ GEMINI_3_FLASH_PRE = "gemini-3-flash-preview" # Gemini 3 Flash Preview - Agent GEMINI_3_PRO_PRE = "gemini-3-pro-preview" # Gemini 3 Pro Preview GEMINI_31_PRO_PRE = "gemini-3.1-pro-preview" # Gemini 3.1 Pro Preview - Agent推荐模型 GEMINI_31_FLASH_LITE_PRE = "gemini-3.1-flash-lite-preview" # Gemini 3.1 Flash Lite Preview - Agent推荐模型 +GEMINI_35_FLASH = "gemini-3.5-flash" # Gemini 3.5 Flash - Agent推荐模型 # OpenAI GPT35 = "gpt-3.5-turbo" @@ -185,7 +186,7 @@ MODEL_LIST = [ "claude", "claude-3-haiku", "claude-3-sonnet", "claude-3-opus", "claude-3.5-sonnet", # Gemini - GEMINI_31_FLASH_LITE_PRE, GEMINI_31_PRO_PRE, GEMINI_3_PRO_PRE, GEMINI_3_FLASH_PRE, GEMINI_25_PRO_PRE, GEMINI_25_FLASH_PRE, + GEMINI_35_FLASH, GEMINI_31_FLASH_LITE_PRE, GEMINI_31_PRO_PRE, GEMINI_3_PRO_PRE, GEMINI_3_FLASH_PRE, GEMINI_25_PRO_PRE, GEMINI_25_FLASH_PRE, GEMINI_20_FLASH, GEMINI_20_flash_exp, GEMINI_15_PRO, GEMINI_15_flash, GEMINI_PRO, GEMINI, # OpenAI diff --git a/docs/models/gemini.mdx b/docs/models/gemini.mdx index b758399b..f1c8991a 100644 --- a/docs/models/gemini.mdx +++ b/docs/models/gemini.mdx @@ -13,14 +13,14 @@ Google Gemini 支持文本对话、图像理解和图像生成(Nano Banana 系 ```json { - "model": "gemini-3.1-pro-preview", + "model": "gemini-3.5-flash", "gemini_api_key": "YOUR_API_KEY" } ``` | 参数 | 说明 | | --- | --- | -| `model` | 支持 `gemini-3.1-pro-preview`、`gemini-3.1-flash-lite-preview`、`gemini-3-flash-preview`、`gemini-3-pro-preview` 等,参考 [官方文档](https://ai.google.dev/gemini-api/docs/models) | +| `model` | 推荐 `gemini-3.5-flash`,亦支持 `gemini-3.1-pro-preview`、`gemini-3.1-flash-lite-preview`、`gemini-3-flash-preview`、`gemini-3-pro-preview` 等,参考 [官方文档](https://ai.google.dev/gemini-api/docs/models) | | `gemini_api_key` | 在 [Google AI Studio](https://aistudio.google.com/app/apikey) 创建 | | `gemini_api_base` | 可选,默认为 `https://generativelanguage.googleapis.com`,可改为第三方代理 | diff --git a/docs/models/index.mdx b/docs/models/index.mdx index d16e6fd9..369fc4c3 100644 --- a/docs/models/index.mdx +++ b/docs/models/index.mdx @@ -6,7 +6,7 @@ description: CowAgent 支持的模型厂商及能力矩阵 CowAgent 支持国内外主流厂商的大语言模型,模型接口实现在项目的 `models/` 目录下。除文本对话外,部分厂商还提供视觉理解、图像生成、语音识别、语音合成、向量等能力,可在 Agent 流程中按需调用。 - Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.1-pro-preview、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.1。 + Agent 模式下推荐使用以下模型,可根据效果及成本综合选择:deepseek-v4-flash、MiniMax-M2.7、claude-sonnet-4-6、gemini-3.5-flash、glm-5.1、qwen3.6-plus、kimi-k2.6、ernie-5.1。 同时支持使用 [LinkAI](https://link-ai.tech) 平台接口,一个 Key 即可灵活切换多家厂商,并附带知识库、工作流、插件等能力。 diff --git a/models/gemini/google_gemini_bot.py b/models/gemini/google_gemini_bot.py index 6716e971..3c9ac9ae 100644 --- a/models/gemini/google_gemini_bot.py +++ b/models/gemini/google_gemini_bot.py @@ -38,9 +38,9 @@ class GoogleGeminiBot(Bot): @property def model(self): - model_name = conf().get("model") or "gemini-3.1-pro-preview" + model_name = conf().get("model") or "gemini-3.5-flash" if model_name == "gemini": - model_name = "gemini-3.1-pro-preview" + model_name = "gemini-3.5-flash" return model_name @property