mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-07 05:11:51 +08:00
feat(intercept): 未命中规则的命令接入 LLM 兜底审批
在正则/字符串规则之外新增一套独立的模型兜底层:规则命中直接按规则走; 一条规则都没命中时,才由模型做语义判定(ALLOW/ASK/DENY),人工审批兜底。 - intercept: DefaultJudgePrompt(三态判定提示词)+ ParseVerdict;Reviewer 回调注入; Judge() 读全局 llm_judge_* 配置、超时/失败回退、ask 填审批超时、模型判定加 [模型] 前缀 - guard: applyIntercept 未命中分支调 Judge;模型 allow 不落库,deny/ask 带 reason 入库 - db: intercept_pending 加 reason 列(带 ALTER IF NOT EXISTS 补旧库); create 函数支持 reason 与 ruleID 0→NULL;历史查询带出 reason - server: 用 providerForProfile + 单次 Stream 收集注入裁判;GET/PUT /api/intercept/judge - web: 拦截页拆「拦截规则 / 模型配置」两 tab;拦截范围提为共用信息条; 模型配置双栏布局(提示词直接展开编辑);审批/任务拦截页标注「模型判定」+ 理由 配置默认值:失败回退 allow、审批超时动作 deny、模型 allow 不落库、 提示词默认即内置模板(清空回退模板)。无需 DB 结构性迁移(judge 走 settings KV)。 Claude-Session: https://claude.ai/code/session_019QXSCDmzimwnjntBNCgUD7
This commit is contained in:
1 parent
f63a451b87
commit
95d2309935
14 files changed
+860
-66
No files matched your search
@@ -943,6 +943,17 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
if (seg[0] === "intercept" && seg[1] === "task")
|
||||
return { items: D.interceptHistory.filter((r) => r.task_id === seg[2]) };
|
||||
if (path === "/intercept/tool-config") return { enabled_tools: ["bash"] };
|
||||
if (path === "/intercept/judge" && m === "GET")
|
||||
return {
|
||||
enabled: false,
|
||||
profile_id: 0,
|
||||
prompt: "",
|
||||
timeout_seconds: 15,
|
||||
fail_action: "allow",
|
||||
ask_timeout_seconds: 300,
|
||||
ask_timeout_action: "deny",
|
||||
};
|
||||
if (path === "/intercept/judge" && m === "PUT") return { ok: true };
|
||||
|
||||
// ── 写操作兜底:成功但不落库 ──
|
||||
if (["POST", "PUT", "PATCH", "DELETE"].includes(m)) return { ok: true };
|
||||
|
||||
Reference in new issue
Block a user