feat: 多模型 Worker 池(#41,Codex 重写:绑定配置不可用时报错而非回退)

Code authored by Codex CLI (gpt-6-astra main implementation; gpt-6-sol / gpt-6-astra continuation passes).
This commit is contained in:
RuoJi6 committed 2026-10-24 22:22:05 +08:00
1 parent 6ffe04cf3d
commit d1b2b5a996
9 files changed
+733 -29

No files matched your search

+1
View File
@@ -3338,6 +3338,7 @@ export const settings: Settings = {
global_proxy: "",
python_interpreter: "/usr/bin/python3",
workers: 3,
worker_pools: [],
llm_pool_enabled: true,
llm_pool_bind_fallback: false,
noa_compaction: false,
+11 -2
View File
@@ -2249,7 +2249,15 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
if (path === "/traffic") return D.traffic;
if (path === "/traffic/exchange") return D.trafficDetail;
if (path === "/settings" && m === "GET") return D.settings;
if (path === "/settings" && m === "PUT") return { ...D.settings, ...b };
if (path === "/settings" && m === "PUT") {
const next = { ...D.settings, ...b };
if (!Array.isArray(next.worker_pools)) next.worker_pools = D.settings.worker_pools;
if (next.worker_pools.length > 0) {
next.workers = next.worker_pools.reduce((sum, pool) => sum + Number(pool.workers), 0);
}
Object.assign(D.settings, next);
return next;
}
if (path === "/settings/basic-auth" && m === "GET") return { enabled: false, username: "", password_set: false };
if (path === "/settings/basic-auth" && m === "PUT")
throw new Error("演示模式不支持修改 HTTP Basic Auth,请在实际部署中配置");
@@ -2467,7 +2475,8 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
const from = q.get("from") || "";
const to = q.get("to") || "";
if (status && !["pending", "allowed", "denied", "timeout"].includes(status)) throw new Error("无效审批状态");
if (decisionSource && !["model", "rule", "manual", "unknown"].includes(decisionSource)) throw new Error("无效判定来源");
if (decisionSource && !["model", "rule", "manual", "unknown"].includes(decisionSource))
throw new Error("无效判定来源");
if ([...search].length > 200) throw new Error("搜索关键词不能超过 200 个字符");
if (search.startsWith("#") && !/^#[1-9]\d*$/.test(search)) throw new Error("审批编号必须为 # 后接正整数");
for (const value of [from, to]) {
+6
View File
@@ -968,6 +968,7 @@ export interface Settings {
global_proxy?: string;
python_interpreter?: string; // 自定义脚本工具的 python 解释器路径(空=运行时检测)
workers?: number; // 并发工作 agent 数(默认3);对之后启动的任务生效
worker_pools: WorkerPool[];
// 任务并发上限:同时「运行中」的任务数上限。关闭=不限;开启后新建任务超限则排队,有空位自动启动。
task_concurrency_enabled?: boolean; // 默认 false
task_concurrency_limit?: number; // 开启后默认 5
@@ -989,6 +990,11 @@ export interface Settings {
notify_digest_interval_min?: number; // 汇总模式周期(分钟),默认 30
}
export interface WorkerPool {
profile_id: string;
workers: number;
}
// ---- 漏洞 IM 推送 ----
// NotificationFilter 是渠道的过滤条件,字段全部可选,缺省即不过滤。