From ef6ad1b91a0072e63e8e5da7926c7db61a897069 Mon Sep 17 00:00:00 2001 From: matevip Date: Tue, 12 May 2026 11:25:38 +0800 Subject: [PATCH] feat(wiki): expose per-template model picker in the transformations modal --- .../service/WikiTransformationService.java | 4 +- mateclaw-ui/src/i18n/locales/en-US.ts | 3 + mateclaw-ui/src/i18n/locales/zh-CN.ts | 3 + .../Wiki/components/TransformationsPanel.vue | 55 ++++++++++++++++++- 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiTransformationService.java b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiTransformationService.java index fecacb2f..30d15445 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiTransformationService.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiTransformationService.java @@ -106,7 +106,9 @@ public class WikiTransformationService { entity.setPromptTemplate(input.getPromptTemplate()); entity.setApplyDefault(Boolean.TRUE.equals(input.getApplyDefault())); entity.setEnabled(input.getEnabled() == null ? Boolean.TRUE : input.getEnabled()); - entity.setModelId(input.getModelId()); + // Treat negative values as the "clear / use default" sentinel so the + // create and update paths accept the same payload from the UI. + entity.setModelId(input.getModelId() != null && input.getModelId() < 0 ? null : input.getModelId()); entity.setOutputTarget(normalizeOutputTarget(input.getOutputTarget())); transformationMapper.insert(entity); log.info("[WikiTransformation] created id={} name={} kbId={}", diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 687dcd3a..27e11789 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1810,6 +1810,9 @@ export default { applyDefault: 'Apply by default', applyDefaultOn: 'Runs automatically after each ingest completes', applyDefaultOff: 'Manual or agent-tool runs only', + modelLabel: 'Model', + modelDefault: 'Default (KB / system)', + modelHelp: 'Falls back to the KB-bound chat model or the system default; once chosen this template always uses the specified model', outputTargetLabel: 'Output target', outputTargetNone: 'None — output stays in run history', outputTargetPage: 'Save as wiki page (searchable / agent-accessible / linkable)', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index fbda6b1f..98be6463 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1822,6 +1822,9 @@ export default { applyDefault: '默认运行', applyDefaultOn: '每次新材料完成后自动跑', applyDefaultOff: '仅在手动 / Agent 调用时运行', + modelLabel: '模型', + modelDefault: '默认(KB / 系统默认)', + modelHelp: '默认走 KB 绑定模型或系统默认 chat 模型;选定后该模板始终使用指定模型', outputTargetLabel: '输出去向', outputTargetNone: '不保存(仅留在运行历史)', outputTargetPage: '保存为 Wiki 页面(可被搜索 / Agent / 关系图引用)', diff --git a/mateclaw-ui/src/views/Wiki/components/TransformationsPanel.vue b/mateclaw-ui/src/views/Wiki/components/TransformationsPanel.vue index 42c87a5d..a336fb1b 100644 --- a/mateclaw-ui/src/views/Wiki/components/TransformationsPanel.vue +++ b/mateclaw-ui/src/views/Wiki/components/TransformationsPanel.vue @@ -41,6 +41,9 @@ {{ t('wiki.transformations.outputTargetPageBadge') }} + + {{ modelLabelFor(tpl.modelId) }} + {{ tpl.enabled === false ? t('wiki.transformations.disabled') : t('wiki.transformations.enabled') }} @@ -154,6 +157,17 @@ /> + +