feat(agent): 增加 LLM 路由与诊断日志
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from django.urls import reverse
|
||||
|
||||
from review_agent.models import Message
|
||||
@@ -9,10 +11,14 @@ from ..services.report import generate_markdown_report
|
||||
from .base import BaseSkill, SkillResult, WorkflowContext
|
||||
|
||||
|
||||
logger = logging.getLogger("review_agent.file_summary.skills.summary_report")
|
||||
|
||||
|
||||
class SummaryReportSkill(BaseSkill):
|
||||
name = "summary_report"
|
||||
|
||||
def run(self, context: WorkflowContext) -> SkillResult:
|
||||
logger.info("Summary report started", extra={"batch_id": context.batch.pk})
|
||||
markdown_export, summary_table = generate_markdown_report(context.batch)
|
||||
excel_export = generate_excel_export(context.batch)
|
||||
markdown_url = reverse("file_summary_export_download", args=[markdown_export.pk])
|
||||
@@ -27,6 +33,14 @@ class SummaryReportSkill(BaseSkill):
|
||||
role=Message.Role.ASSISTANT,
|
||||
content=content,
|
||||
)
|
||||
logger.info(
|
||||
"Summary report finished",
|
||||
extra={
|
||||
"batch_id": context.batch.pk,
|
||||
"markdown_export_id": markdown_export.pk,
|
||||
"excel_export_id": excel_export.pk,
|
||||
},
|
||||
)
|
||||
return SkillResult(
|
||||
success=True,
|
||||
data={"markdown_export_id": markdown_export.pk, "excel_export_id": excel_export.pk},
|
||||
|
||||
Reference in New Issue
Block a user