feat(admin): 面板暴露 contextWindow(可见可改)+ DocumentRef 语义注释同步

- 面板读写面与 maxTokens 逐处对齐:读 DTO 增 contextWindow(omitempty)、写请求 ContextWindow *int(缺失=保留、显式 0=未声明同义、负数 400)、回写 models.json;负数红线仍由 runtimeconfig.Group.Validate 唯一裁决,网关守卫只做「更早失败 + 面板可读字段名」。前端:类型 + 表单字段(提交前 /^\d+$/ 校验)+ 分组行角标 + Notice + 目录候选用早已解析却没人用的 contextLimit 预填。文案写明「重启后生效」(推导只在进程启动时算一次)。

- 顺手修既有红线违反:ProviderFields 87→76(抽 ApiKeyAndBudgetField)、LlmProviderForm 113→74(buildRequest 提为模块级纯函数)——本次碰过的文件里已无 >80 的函数,行为/文案逐字未变。

- DocumentRef 的 chars/truncated 注释从「抽取侧」改为「本回合注入侧」(全文长度只在 document-read 的 totalChars、extractTruncated 专指撞 8 MiB 安全上限);机械校验为空 ⇒ 代码零改动。

- 主会话独立验收:隔离 worktree Go 侧 build/vet + gateway/history 两包绿;主树 npx tsc --noEmit exit 0、npm run build 成功并 copy 到 internal/webui/dist;注释机械校验为空;变异由子代理复现(写路径不认该键 ⇒ 3 红;去掉网关负数守卫 ⇒ 400 变 500)。
This commit is contained in:
AskaEth committed 2026-10-04 18:11:43 +08:00
1 parent 3a01b4e236
commit 47e56ca13c
11 files changed
+355 -68

No files matched your search

+4
View File
@@ -146,6 +146,10 @@ export interface AdminLlmProvider {
/** The group's token budget. Absent/0 = unset (the runtime falls back to
* LLM_FALLBACK_MAX_TOKENS on the last step, then the adapter default). */
maxTokens?: number;
/** 该组声明的**模型上下文窗口**(token)。缺失/0 = **未声明**:后端按回落窗口
* (128 Ki token)保守估算并记一条 WARN。只有填了该模型的真实窗口(如
* `1048576`)才能吃到按窗口推导的上下文预算。 */
contextWindow?: number;
/** 该组的推理开关形状。后端始终下发(kind 可能为空串),旧构建则整个字段缺失。 */
reasoning?: AdminLlmReasoning;
/** persona → 模型名的路由表(裁决 03.4.1);缺失 = 该组没有 per-persona 绑定。 */
+3
View File
@@ -40,6 +40,9 @@ export interface LlmProviderRequest {
fallback?: string;
/** Absent = keep the stored budget (or leave unset for a new group). */
maxTokens?: number;
/** 该组声明的模型上下文窗口(token)。**Absent = 保留已存窗口**;显式 `0` 与
* absent 同义(都表示未声明、按回落窗口推导);负数后端回 400。 */
contextWindow?: number;
/** 推理开关形状:**缺省 = 保留已存形状**;给出(哪怕 `{}`)= 用其中的 kind
* 覆盖,kind 缺省/空串 = 回到「未声明」(等同 auto)。取值见
* AdminLlmConfig.reasoningKinds —— 非法 kind 后端回 400。 */