fix(v0.5.2): 模型选择立即同步界面

This commit is contained in:
qyh15 2026-11-19 10:17:45 +08:00
parent 6fdf34ba0e
commit b0a46428f9
4 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# 三省六部(dsh-sansheng)· v0.5.1
# 三省六部(dsh-sansheng)· v0.5.2
在 DSH 里为每个项目提供固定的十席角色(丞相、中书、门下、尚书、吏部、户部、礼部、兵部、刑部、工部),
每席绑定一个独立的原生 root Session,模型与补充说明按项目独立保存。中间复用宿主原生会话,不替换聊天引擎。
@ -10,6 +10,7 @@
- 部门工具:丞相用 `sansheng_dispatch_task` 派工到目标部门已绑定的真实会话;部门用 `sansheng_task_report` 回报执行中/完成/失败,结果关联真实部门会话;丞相可查询真实任务与结果,不能用同名子代理或普通 agent 冒充部门。
- 任务记录区分待执行/已派工/执行中/已完成/已取消/失败,支持重复投递去重、取消后迟到结果留档(不改回取消状态)。
- 打开部门对话只核实并进入原绑定会话,不会重复新建;会话被删除时标记「会话缺失」,由用户确认重建,旧历史保留;部门标题固定为两字角色名。
- 模型选择立即生效并同步界面,不再出现选完又跳回「请选择模型」;模型按项目/席位保存,开启部门或下次打开继续使用。
**本包尚未安装到任何 DSH profile,也未改动用户的日常 DSH 配置。**

View File

@ -1401,8 +1401,13 @@ function apply(ctx) {
const model = modelFromValue(value);
if (!model) return;
try {
await request("configure", { projectId, seatId, model });
const saved = await request("configure", { projectId, seatId, model });
if (!alive.current) return;
setView((prev) => {
if (!prev || !prev.project) return prev;
const seats = Array.isArray(prev.project.seats) ? prev.project.seats.map((seat) => seat && seat.id === seatId ? { ...seat, ...saved && saved.seat ? saved.seat : { model } } : seat) : prev.project.seats;
return { ...prev, revision: (prev.revision ?? 0) + 1, project: { ...prev.project, seats } };
});
setDraft((prev) => clearDraft(prev, seatId));
setNotice("已记住「" + wb.selected.name + "」的模型,下次打开继续使用");
} catch (error2) {

View File

@ -1,6 +1,6 @@
{
"name": "dsh-sansheng-liubu",
"version": "0.5.1",
"version": "0.5.2",
"description": "三省六部:每个项目固定十席角色与独立会话的 DSH 插件(第一版)。",
"keywords": [
"dsh-plugin",

View File

@ -509,8 +509,19 @@ export function apply(ctx) {
const model = modelFromValue(value)
if (!model) return
try {
await request('configure', { projectId, seatId, model })
const saved = await request('configure', { projectId, seatId, model })
if (!alive.current) return
// 保存成功后同步本地项目视图:否则受控 select 仍读旧 view 的 model=null,
// 会显示回「请选择模型」,用户以为选择没生效。
setView(prev => {
if (!prev || !prev.project) return prev
const seats = Array.isArray(prev.project.seats)
? prev.project.seats.map(seat => (seat && seat.id === seatId
? { ...seat, ...(saved && saved.seat ? saved.seat : { model }) }
: seat))
: prev.project.seats
return { ...prev, revision: (prev.revision ?? 0) + 1, project: { ...prev.project, seats } }
})
setDraft(prev => clearDraft(prev, seatId))
setNotice('已记住「' + wb.selected.name + '」的模型,下次打开继续使用')
} catch (error) {