简历诊断添加日志
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""简历诊断 AI 引擎:并行诊断 + 汇总评价"""
|
||||
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
from langchain_core.output_parsers import StrOutputParser
|
||||
from langchain_core.prompts import ChatPromptTemplate
|
||||
@@ -94,12 +95,18 @@ async def polish_content(module_type: str, reference_content: list[dict] | str |
|
||||
|
||||
async def _safe_invoke(task: dict) -> dict:
|
||||
"""单条记录诊断,失败返回空结果"""
|
||||
module_type = task.get("module_type", "unknown")
|
||||
log.info(f"AI诊断[{module_type}]开始")
|
||||
start = time.time()
|
||||
raw = ""
|
||||
try:
|
||||
raw = await _diagnose_chain.ainvoke(task)
|
||||
elapsed = time.time() - start
|
||||
log.info(f"AI诊断[{module_type}]完成, 耗时{elapsed:.2f}s")
|
||||
return parse_llm_json(raw)
|
||||
except Exception as e:
|
||||
log.warning(f"AI诊断[{task.get('module_type', '')}]失败: {e}\n原始输出: {raw[:500]}")
|
||||
elapsed = time.time() - start
|
||||
log.warning(f"AI诊断[{module_type}]失败, 耗时{elapsed:.2f}s: {e}\n原始输出: {raw[:500]}")
|
||||
return _empty_result()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user