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
+19
-8
@@ -1210,19 +1210,30 @@ class ScheduledTaskService:
|
||||
f"未满足输出要求:需生成 Markdown(.md) 文件,且文件正文不少于 {_MARKDOWN_MIN_CHARS} 字"
|
||||
)
|
||||
|
||||
# 2) Load reference style/layout from a favorite if one was selected.
|
||||
# 2) Load reference style/layout. 参考来源有两种:
|
||||
# - ``tpl:<id>``:内置 HTML 模板(no.1/no.2),抽其 CSS+结构骨架当风格参考;
|
||||
# - 普通 id:用户在执行记录里收藏的页面(html store)。
|
||||
reference_style = None
|
||||
reference_layout = None
|
||||
if reference_favorite_id:
|
||||
store = self._html_store
|
||||
if store is not None:
|
||||
tpl_id = template_fill.reference_template_id(str(reference_favorite_id))
|
||||
if tpl_id is not None:
|
||||
try:
|
||||
favorite = await store.get_favorite(str(reference_favorite_id))
|
||||
ref = template_fill.style_reference(tpl_id)
|
||||
reference_style = ref.get("style") or None
|
||||
reference_layout = ref.get("layout") or None
|
||||
except Exception:
|
||||
favorite = None
|
||||
if favorite is not None:
|
||||
reference_style = favorite.get("reuse_prompt") or favorite.get("style_summary")
|
||||
reference_layout = favorite.get("layout_summary")
|
||||
logger.warning("加载模板样式参考失败:%s", reference_favorite_id, exc_info=True)
|
||||
else:
|
||||
store = self._html_store
|
||||
if store is not None:
|
||||
try:
|
||||
favorite = await store.get_favorite(str(reference_favorite_id))
|
||||
except Exception:
|
||||
favorite = None
|
||||
if favorite is not None:
|
||||
reference_style = favorite.get("reuse_prompt") or favorite.get("style_summary")
|
||||
reference_layout = favorite.get("layout_summary")
|
||||
|
||||
# 3) Render with the chosen model, injecting any enabled HTML skills.
|
||||
skill_instructions = self._collect_html_skill_instructions()
|
||||
|
||||
Reference in new issue
Block a user