sync update from LAN repo (source dhk-1 @ fc974e93)

This commit is contained in:
gozeros committed 2026-11-17 11:28:44 +08:00
1 parent a1fa13a238
commit e2fea6a801
432 files changed
+68707 -2270

No files matched your search

@@ -1519,6 +1519,9 @@ class ScheduledTaskService:
parsed = html_page_utils.extract_json_object(raw)
if parsed is None:
last_problems = ["模型未返回可解析的 JSON 对象"]
# 记录原始输出预览,便于诊断模型行为(截断到 600 字符)。
preview = repr(raw[:600]) if isinstance(raw, str) else repr(raw)
logger.info("模板填充[run=%s]模型原始输出预览: %s", run_id, preview)
else:
candidate = parsed # 记住最后一个可解析结果,供重试耗尽时尽力返回
errors = [f"结构错误:{e}" for e in template_fill.validate_data(template_id, candidate)]
@@ -1706,9 +1709,22 @@ class ScheduledTaskService:
page_title, page_subtitle = template_fill.pop_page_titles(converted)
# 子页面没抽到有效内容的,回退模板原有数据,避免子页面空白。
data_obj = template_fill.merge_with_reference(tpl_id, converted)
# 分支级诊断:记录哪些顶层分支被回退(空内容/字段错位)。
_branch_lines = []
for _k, _v in converted.items():
_n_new = len(_v) if isinstance(_v, list) else "-"
_n_final = len(data_obj.get(_k) or []) if isinstance(data_obj.get(_k), list) else "-"
if _n_new != "-" and _n_final == "-":
_branch_lines.append(f"{_k}: 转换{_n_new}条→回退原数据")
elif _n_new != "-" and _n_new != _n_final:
_branch_lines.append(f"{_k}: 转换{_n_new}条→合并{_n_final}条")
if _branch_lines:
logger.info("模板参考[run=%s]分支合并情况: %s", run_id, ";".join(_branch_lines))
# 字段管理里「接受抽取更新」被关闭(锁定)的字段,恢复模板现有值,
# 抽取结果不覆盖——对本次产物与(开启时的)数据写回同时生效。
data_obj = template_store.restore_locked_fields(tpl_id, data_obj)
# 隐藏字段为值级:抽取合并后清空其值,防止任务把隐藏字段重新填回页面。
template_store.clear_hidden_field_values(tpl_id, data_obj)
content = f"已检索数据并套用模板「{spec.name}」(空子页面回退原数据,含全部子页面)"
used_default = False
if writeback: