Open
Conversation
添加对智谱 AI GLM 系列模型(如 GLM-5)的支持,使 Conway Automaton
能够使用国产大模型运行。
主要变更:
- types.ts: 新增 openaiApiBaseUrl 配置项
- inference.ts: GLM 模型自动检测和 API 端点适配
- 自动识别 glm-* 模型并路由到 OpenAI 兼容后端
- 适配 GLM Coding Plan 的 /chat/completions 端点
- index.ts: 传递 openaiApiBaseUrl 到推理客户端
- context.ts: 修复 temperature=0 问题(GLM-5 要求 >0)
使用方法:
在 automaton.json 中配置:
{
"openaiApiKey": "your-glm-api-key",
"openaiApiBaseUrl": "https://open.bigmodel.cn/api/coding/paas/v4",
"inferenceModel": "glm-5"
}
问题:PR Conway-Research#221 缺少模型注册表修改,导致 GLM-5 不在 STATIC_MODEL_BASELINE 中 解决:添加 GLM-5 到模型基线和 DEFAULT_ROUTING_MATRIX
合并官方 main 分支最新更新: - Ollama 本地模型支持 - Orchestrator 弹性修复 (PR Conway-Research#227) - SQL 通配符转义修复 - 多项 bug 修复 GLM-5 配置优化: - maxTokens: 4096 → 32768(最大化 token 限制) - costPer1kInput/Output: 0(GLM Coding Plan 已付费) - 添加详细注释说明
hanzhcn
pushed a commit
to hanzhcn/automaton
that referenced
this pull request
Feb 25, 2026
- costPer1kInput: 1 → 0 - costPer1kOutput: 1 → 0 - gpt-5.2 enabled: false → true(保留官方模型后备) - 与 PR Conway-Research#221 保持一致
问题:
- 用户配置 inferenceModel: "glm-5" 被路由矩阵覆盖
- 顶层配置字段未桥接到 modelStrategyConfig
修复:
1. loop.ts: 桥接顶层 inferenceModel/maxTokensPerTurn 到 modelStrategyConfig
2. router.ts: 用户配置的 inferenceModel 优先于路由矩阵
3. types.ts: 恢复官方路由矩阵(不硬编码 glm-5)
现在的优先级:
- 用户配置的 inferenceModel > 路由矩阵 > 其他配置模型
配置示例:
{
"openaiApiKey": "your-glm-key",
"openaiApiBaseUrl": "https://open.bigmodel.cn/api/coding/paas/v4",
"inferenceModel": "glm-5"
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 添加了对智谱 AI GLM 系列模型(如 GLM-5)作为推理后端的支持,使 Conway Automaton 能够使用国产大模型运行。
背景
智谱 AI 的 GLM 系列是中国领先的国产大语言模型,具有以下优势:
技术变更
1. 新增配置项 (
src/types.ts)2. 配置桥接修复 (
src/agent/loop.ts) ⭐ 关键修复问题:顶层配置
inferenceModel未传递到modelStrategyConfig,导致用户配置被忽略。修复:桥接顶层配置字段到
modelStrategyConfig:3. 模型选择优先级修复 (
src/inference/router.ts) ⭐ 关键修复问题:路由矩阵优先于用户配置,导致
gpt-5.2覆盖用户配置的glm-5。修复:用户配置的
inferenceModel现在具有最高优先级:优先级顺序:
inferenceModel(最高优先级)4. 推理客户端适配 (
src/conway/inference.ts)模型识别:自动检测 GLM 模型并路由到 OpenAI 兼容后端
API 端点适配:GLM Coding Plan 使用
/chat/completions而非标准 OpenAI 的/v1/chat/completions5. 上下文温度修复 (
src/agent/context.ts)GLM-5 要求
temperature在开区间 (0, 1) 内,不能为 0:6. 模型注册 (
src/inference/types.ts)添加 GLM-5 到
STATIC_MODEL_BASELINE:使用方法
在
automaton.json中配置:{ "openaiApiKey": "your-glm-api-key", "openaiApiBaseUrl": "https://open.bigmodel.cn/api/coding/paas/v4", "inferenceModel": "glm-5" }重要:只需配置顶层
inferenceModel,无需配置嵌套的modelStrategy。测试
已在生产环境验证:
inferenceModel优先于路由矩阵兼容性
openaiApiBaseUrl配置时启用新功能相关链接