feat(定时任务): 必须生成HTML的「参考收藏页面」加入 no.1/no.2 模板作为风格参考
- 引擎 template_fill.style_reference:抽取模板 <style> CSS + 去脚本结构骨架(~13-28KB), 剥掉巨大数据常量,供 require_html 渲染模型模仿风格;reference_template_id 解析 tpl:<id> - 调度器 _run_html_page_attempt:参考来源为 tpl:<id> 时用模板风格参考,否则走收藏 store - 前端 ScheduledTasksPage:require_html 模式下「参考收藏页面」列表加入「模板:no.1/no.2」, 值存 tpl:<id>;htmlTemplates 在 require_html 时也拉取 - 文档同步 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ae3788a87d
commit
ec60b77a71
4 files changed
+86
-10
No files matched your search
@@ -341,7 +341,10 @@ export default function ScheduledTasksPage() {
|
||||
// 模板填充模式:选中内置「模板数据转换器」agent。此时表单露出 HTML 模板下拉,
|
||||
// 并隐藏「必须生成 HTML/Markdown」开关(本模式必产出 HTML)。
|
||||
const isTemplateAgent = form.execution_agent_name === TEMPLATE_BUILDER_AGENT_ID;
|
||||
const { data: htmlTemplates = [] } = useHtmlTemplates(isTemplateAgent);
|
||||
// 模板清单:模板填充模式需要(选模板),require_html 模式也需要(作为「参考收藏页面」选项)。
|
||||
const { data: htmlTemplates = [] } = useHtmlTemplates(
|
||||
isTemplateAgent || form.require_html,
|
||||
);
|
||||
const selectedTemplate = htmlTemplates.find((t) => t.id === form.template_id);
|
||||
// 选中的模板是「只展示」型(convertible===false)时,不需要源 JSON,隐藏上传/输入。
|
||||
const templateDisplayOnly =
|
||||
@@ -1305,6 +1308,30 @@ export default function ScheduledTasksPage() {
|
||||
>
|
||||
不参考(默认)
|
||||
</button>
|
||||
{/* 内置 HTML 模板作为风格参考:值存为 ``tpl:<id>``,生成时参照其 CSS/版式。 */}
|
||||
{htmlTemplates.map((tpl) => {
|
||||
const refValue = `tpl:${tpl.id}`;
|
||||
const selected = form.html_reference_favorite_id === refValue;
|
||||
return (
|
||||
<button
|
||||
key={refValue}
|
||||
type="button"
|
||||
onClick={() =>
|
||||
setForm((value) => ({
|
||||
...value,
|
||||
html_reference_favorite_id: refValue,
|
||||
}))
|
||||
}
|
||||
className={cn(
|
||||
"rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent/60",
|
||||
selected && "bg-accent",
|
||||
)}
|
||||
title={`参照模板「${tpl.name}」的视觉风格与版式`}
|
||||
>
|
||||
模板:{tpl.name}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
{htmlFavorites.map((fav) => {
|
||||
const selected = form.html_reference_favorite_id === fav.id;
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user