feat: 添加生命周期报告和AI规则管理功能

- 在Dockerfile中添加pillow依赖包用于图像处理
- 实现生命周期报告调度任务,支持日报和周报两种类型
- 新增TASK_RUN_LIFECYCLE任务常量和相关配置选项
- 扩展AI Agent服务以支持用户规则,并在分析时应用规则
- 添加AI用户规则创建、更新和查询接口
- 增加项目生命周期和财务需求分析技能
- 扩展现有模型以支持更完整的业务数据字段
- 实现飞书图片上传功能用于报告展示
```
This commit is contained in:
2026-07-12 17:44:49 +08:00
parent bf309ecdf7
commit 9cf7c44393
45 changed files with 5036 additions and 49 deletions

View File

@@ -15,6 +15,7 @@ from app.modules.reports.constants import (
ReportPushStatus,
ReportResponseKey,
)
from app.modules.reports.chart import lifecycle_chart_alt, render_lifecycle_chart
class ReportDeliveryMixin:
@@ -39,12 +40,24 @@ class ReportDeliveryMixin:
actor=actor,
)
)
card = FeishuService.build_basic_card(
report[ReportResponseKey.TITLE],
report[ReportResponseKey.LINES],
)
try:
result = FeishuService(self.db).send_card(card, receive_id, receive_id_type, actor)
feishu = FeishuService(self.db)
image_key = None
image_alt = None
chart_data = report.get("chart_data")
if chart_data:
image_result = feishu.upload_image(render_lifecycle_chart(chart_data), actor)
image_key = (image_result.get("data") or {}).get("image_key")
if not image_key:
raise ValueError("Feishu image upload did not return image_key")
image_alt = lifecycle_chart_alt(chart_data)
card = FeishuService.build_basic_card(
report[ReportResponseKey.TITLE],
report[ReportResponseKey.LINES],
image_key=image_key,
image_alt=image_alt,
)
result = feishu.send_card(card, receive_id, receive_id_type, actor)
except Exception as exc:
failed_run = self.update_push_run(
push_run.code,