feat(定时任务): 选内置模板时加「执行数据抽取」开关,关闭则直接用默认数据
- html_config.template_extract(默认关,仅参考选 tpl:<id> 时显示开关): 关闭→跳过检索/转换,直接用模板默认数据填充;开启→才执行检索+转换抽取 - 后端 _run_html_template_reference 在只展示分支后先判开关 - 前端 ScheduledTasksPage:参考选内置模板时显示 Switch,存进 html_config.template_extract,编辑回显 - 测试覆盖 开/关 两条路径 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4898ea0a85
commit
6673121f3f
4 files changed
+45
-1
No files matched your search
@@ -22,6 +22,8 @@ export type HtmlPageConfig = {
|
||||
negative_prompt?: string | null;
|
||||
reference_favorite_id?: string | null;
|
||||
model_name?: string | null;
|
||||
/** 仅当参考选了内置模板(tpl:<id>)时生效:关闭则直接用模板默认数据,开启才检索抽取。 */
|
||||
template_extract?: boolean;
|
||||
};
|
||||
|
||||
/** 选中内置「模板数据转换器」agent 后,要把源 JSON 填充进的 HTML 模板。
|
||||
|
||||
@@ -133,6 +133,8 @@ const emptyForm = {
|
||||
html_negative_prompt: "",
|
||||
html_reference_favorite_id: "",
|
||||
html_model_name: "",
|
||||
// 参考选了内置模板(tpl:<id>)时的「数据抽取」开关:关闭=用模板默认数据,开启=检索抽取。
|
||||
html_template_extract: false,
|
||||
};
|
||||
|
||||
/** 覆盖 Textarea 默认 field-sizing-content,避免输入过多时撑破弹窗 */
|
||||
@@ -320,6 +322,7 @@ export default function ScheduledTasksPage() {
|
||||
html_negative_prompt: html.negative_prompt ?? "",
|
||||
html_reference_favorite_id: html.reference_favorite_id ?? "",
|
||||
html_model_name: html.model_name ?? "",
|
||||
html_template_extract: !!html.template_extract,
|
||||
});
|
||||
// Prefer the canonical cron_expr over the user-typed schedule_text: the
|
||||
// latter may be natural language ("每天9点") that parseCron can't read,
|
||||
@@ -388,6 +391,10 @@ export default function ScheduledTasksPage() {
|
||||
// Send the user's selection; fall back to the first configured model,
|
||||
// else null (backend then uses the system default). No hardcoded GLM-5.
|
||||
model_name: form.html_model_name.trim() || availableModels[0]?.name || null,
|
||||
// 仅当参考是内置模板(tpl:<id>)时有意义:关闭=用模板默认数据,开启=检索抽取。
|
||||
template_extract: form.html_reference_favorite_id.startsWith("tpl:")
|
||||
? form.html_template_extract
|
||||
: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1370,6 +1377,23 @@ export default function ScheduledTasksPage() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* 参考选了内置模板(tpl:<id>)时:数据抽取开关。关闭=用模板默认数据。 */}
|
||||
{form.html_reference_favorite_id.startsWith("tpl:") && (
|
||||
<div className="flex items-center justify-between rounded-md border p-3">
|
||||
<div className="min-w-0 pr-3">
|
||||
<p className="text-sm font-medium">执行数据抽取</p>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
关闭则直接用所选模板的默认数据生成(含全部子页面);开启才检索并按模板结构抽取数据填充。
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={form.html_template_extract}
|
||||
onCheckedChange={(v) =>
|
||||
setForm((value) => ({ ...value, html_template_extract: v }))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<p className="text-muted-foreground text-xs">生成模型</p>
|
||||
<Select
|
||||
|
||||
Reference in new issue
Block a user