```
feat: 添加生命周期报告和AI规则管理功能 - 在Dockerfile中添加pillow依赖包用于图像处理 - 实现生命周期报告调度任务,支持日报和周报两种类型 - 新增TASK_RUN_LIFECYCLE任务常量和相关配置选项 - 扩展AI Agent服务以支持用户规则,并在分析时应用规则 - 添加AI用户规则创建、更新和查询接口 - 增加项目生命周期和财务需求分析技能 - 扩展现有模型以支持更完整的业务数据字段 - 实现飞书图片上传功能用于报告展示 ```
This commit is contained in:
@@ -3,6 +3,7 @@ from typing import Any
|
||||
|
||||
|
||||
from app.core.constants import ActorValue
|
||||
from app.core.config import get_settings
|
||||
from app.modules.reports.constants import (
|
||||
LifecycleFilterKey,
|
||||
LifecycleResponseKey,
|
||||
@@ -63,6 +64,17 @@ class ReportLifecycleReportMixin:
|
||||
risk_stats,
|
||||
include_global_risk,
|
||||
)
|
||||
finance = (
|
||||
self.project_finance_needs_report(
|
||||
project_code=project_code,
|
||||
owner=owner,
|
||||
as_of=period_end,
|
||||
include_ai=False,
|
||||
actor=actor,
|
||||
)
|
||||
if get_settings().finance_needs_enabled
|
||||
else None
|
||||
)
|
||||
|
||||
metrics = {
|
||||
LifecycleSection.HEALTH: health,
|
||||
@@ -74,12 +86,15 @@ class ReportLifecycleReportMixin:
|
||||
LifecycleSection.SUPPLIERS: supplier_stats,
|
||||
LifecycleSection.ATTENDANCE: attendance_stats,
|
||||
LifecycleSection.RISKS: risk_stats,
|
||||
LifecycleSection.FINANCE: finance["summary"] if finance else {"status": "未启用"},
|
||||
}
|
||||
lines = self._lifecycle_lines(
|
||||
filters[LifecycleFilterKey.LABELS],
|
||||
metrics,
|
||||
recommendations,
|
||||
)
|
||||
if finance:
|
||||
lines.extend(finance[LifecycleResponseKey.LINES])
|
||||
report = {
|
||||
LifecycleResponseKey.TITLE: ReportTitle.PROJECT_LIFECYCLE,
|
||||
LifecycleResponseKey.FILTERS: filters[LifecycleFilterKey.LABELS],
|
||||
@@ -88,6 +103,9 @@ class ReportLifecycleReportMixin:
|
||||
LifecycleResponseKey.RECOMMENDATIONS: recommendations,
|
||||
LifecycleResponseKey.LINES: lines,
|
||||
LifecycleResponseKey.CONTENT: "\n".join(lines),
|
||||
"source_lifecycle": self.source_project_lifecycle_summary(project_code, owner),
|
||||
"finance": finance,
|
||||
"finance_chart_data": finance["finance_chart_data"] if finance else None,
|
||||
}
|
||||
if include_ai:
|
||||
report[LifecycleResponseKey.AI_ANALYSIS] = self._lifecycle_ai_analysis(report, actor)
|
||||
|
||||
Reference in New Issue
Block a user