fix: 修复日报 AI 摘要崩溃('str' object has no attribute 'model')

- _llm_summarize 内 3 处 _llm_call 调用仍传 model 字符串,
  与 _llm_call(config: LLMConfig) 新签名不匹配,生产日报 AI 摘要必崩
- 统一改为传 config 对象;删除不再使用的 model 局部变量
- 新增回归测试:单块/多分块 _llm_summarize → _llm_call 全链路(传 config)
This commit is contained in:
2026-08-12 12:32:55 +08:00
parent 8f2db92d9c
commit 182f788857
2 changed files with 25 additions and 4 deletions
+3 -4
View File
@@ -556,11 +556,10 @@ def _llm_summarize(client, config: LLMConfig, lines: list[str], day_str: str) ->
config 为 llm.client.LLMConfig(daily_report 场景),提供 model / temperature。
"""
model = config.model
chunks = _split_lines_into_chunks(lines)
if len(chunks) == 1:
return _llm_call(client, model, _build_prompt(chunks[0], day_str))
return _llm_call(client, config, _build_prompt(chunks[0], day_str))
# 多块:每块独立总结
partials: list[str] = []
@@ -570,7 +569,7 @@ def _llm_summarize(client, config: LLMConfig, lines: list[str], day_str: str) ->
{chr(10).join(chunk)}
直接输出要点列表:"""
result = _llm_call(client, model, prompt, max_tokens=800)
result = _llm_call(client, config, prompt, max_tokens=800)
if result:
partials.append(result)
logger.info("AI 摘要: 分块 {}/{} 完成 ({} 字)", i, len(chunks), len(result))
@@ -596,7 +595,7 @@ def _llm_summarize(client, config: LLMConfig, lines: list[str], day_str: str) ->
6. 总字数 500 字以内
直接输出要点列表:"""
return _llm_call(client, model, merge_prompt, max_tokens=1500)
return _llm_call(client, config, merge_prompt, max_tokens=1500)
def _build_prompt(lines: list[str], day_str: str) -> str: