feat(ui): 配置面板补 verifyCmd / 项目级 model 输入项

在 #configPanel 新增一行 form-row,包含「校验命令」(cfgVerifyCmd) 和
「项目 Model」(cfgModel) 两个文本输入;打开面板时从 project 读取当前值,
保存时通过 PATCH /api/projects/:id 写入(空白 → null 清空)。

任务 ID:tsk_kmdMuWSn0HUS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-13 03:32:23 +08:00
parent 740d2c2637
commit f2c2d9aebd
2 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -1216,6 +1216,8 @@ document.addEventListener('click', (ev) => {
if (p) {
$('#cfgConcurrency').value = p.concurrency ?? 1;
$('#cfgAutonomy').value = AUTONOMY_LABEL[p.autonomy] ? p.autonomy : 'manual';
$('#cfgVerifyCmd').value = p.verifyCmd ?? '';
$('#cfgModel').value = p.model ?? '';
}
}
break;
@@ -1225,9 +1227,11 @@ document.addEventListener('click', (ev) => {
const cc = Number($('#cfgConcurrency').value);
if (!Number.isInteger(cc) || cc < 1) { toast('最大并发必须是 ≥1 的整数'); break; }
const autonomy = $('#cfgAutonomy').value;
const verifyCmd = $('#cfgVerifyCmd').value.trim() || null;
const model = $('#cfgModel').value.trim() || null;
act(async () => {
await api(`/api/projects/${S.currentProjectId}`, {
method: 'PATCH', body: JSON.stringify({ concurrency: cc, autonomy }),
method: 'PATCH', body: JSON.stringify({ concurrency: cc, autonomy, verifyCmd, model }),
});
await loadProjects(); // 刷新当前值显示
$('#configPanel').hidden = true; // 保存成功自动收起
+8
View File
@@ -77,6 +77,14 @@
<button class="btn btn-solid" data-action="save-config">保存配置</button>
<button class="btn" data-action="toggle-config">收起</button>
</div>
<div class="form-row">
<label class="grow">校验命令
<input id="cfgVerifyCmd" type="text" placeholder="npm test · go test ./... (可空)" autocomplete="off">
</label>
<label class="grow">项目 Model
<input id="cfgModel" type="text" placeholder="claude-opus-4-5(可空,留空用全局默认)" autocomplete="off">
</label>
</div>
<div class="form-row cfg-sync-row">
<span id="syncMeta" class="sync-meta"></span>
<button id="btnSync" class="btn btn-xs" data-action="sync-todo">⟳ 同步 todo</button>