```
feat(ai_agent): 新增openclaw_hermes混合AI适配器 新增OpenClawHermesAdapter适配器,结合Hermes记忆功能和OpenClaw执行能力, 实现AI问答流程中的记忆召回、执行操作和记忆存储的完整闭环。 同时更新NoopAdapter提示信息,添加新的模型提供商选项。 feat(business): 新增考勤、工作报告和风险事件业务模型 新增AttendanceRecord、WorkReport、RiskEvent和LegacySyncRun四个业务模型, 扩展业务领域注册表,支持考勤管理、工作报告生成和风险事件跟踪等核心业务功能。 feat(reports): 实现考勤汇总和工作日报周报生成功能 新增attendance_summary方法用于统计每日考勤情况, 新增generate_work_report方法用于生成日/周经营报告, 包含任务完成情况、待处理事项和风险指标等综合信息。 feat(risk): 扩展风险管理API端点和供应商风险检测 新增供应商风险查询端点和风险事件管理端点, 提供风险事件列表查询和自动生成功能, 增强供应商风险评估能力。 feat(feishu): 添加考勤查询命令和风险摘要增强 集成考勤汇总查询功能到飞书命令系统, 在风险摘要中添加供应商风险和开放风险事件统计, 丰富日常经营管理信息展示。 refactor(service): 优化业务服务数据验证和类型转换 重构_model_payload函数实现数据验证和类型转换, 添加列值类型强制转换逻辑,提高API数据处理的准确性和安全性。 build(deps): 添加postgresql数据库驱动依赖 在Dockerfile中添加psycopg[binary]==3.2.3依赖包, 支持PostgreSQL数据库连接和操作。 chore(config): 更新.gitignore文件排除备份和迁移目录 在.gitignore中添加AGENTS.md.bak-*和migration/目录排除规则, 避免备份文件和本地迁移工作区被提交到版本控制系统。 ```
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
from datetime import date, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
_db = tempfile.NamedTemporaryFile(delete=False, suffix=".db")
|
||||
@@ -154,6 +155,71 @@ def test_approval_gate_for_high_risk_update() -> None:
|
||||
assert update_response.json()["data"]["current_balance"] == 100.0
|
||||
|
||||
|
||||
def test_new_ledgers_reports_and_risk_events() -> None:
|
||||
domains_response = client.get("/api/v1/business/domains", headers=headers)
|
||||
assert domains_response.status_code == 200
|
||||
domains = domains_response.json()["domains"]
|
||||
assert "attendance-records" in domains
|
||||
assert "work-reports" in domains
|
||||
assert "risk-events" in domains
|
||||
|
||||
today = date.today()
|
||||
attendance_response = client.post(
|
||||
"/api/v1/business/attendance-records",
|
||||
headers=headers,
|
||||
json={
|
||||
"actor": "pytest",
|
||||
"data": {
|
||||
"code": "ATT-SMOKE-001",
|
||||
"employee_name": "Tester",
|
||||
"department": "QA",
|
||||
"work_date": today.isoformat(),
|
||||
"status": "正常",
|
||||
},
|
||||
},
|
||||
)
|
||||
assert attendance_response.status_code == 200
|
||||
|
||||
task_response = client.post(
|
||||
"/api/v1/business/tasks",
|
||||
headers=headers,
|
||||
json={
|
||||
"actor": "pytest",
|
||||
"data": {
|
||||
"code": "TASK-RISK-001",
|
||||
"title": "Overdue smoke task",
|
||||
"owner": "tester",
|
||||
"status": "待办",
|
||||
"due_date": (today - timedelta(days=1)).isoformat(),
|
||||
},
|
||||
},
|
||||
)
|
||||
assert task_response.status_code == 200
|
||||
|
||||
attendance_summary = client.get("/api/v1/reports/attendance-summary", headers=headers)
|
||||
assert attendance_summary.status_code == 200
|
||||
assert attendance_summary.json()["total"] >= 1
|
||||
|
||||
report_response = client.post(
|
||||
"/api/v1/reports/work-reports/generate",
|
||||
headers=headers,
|
||||
json={"report_type": "daily", "reporter": "pytest", "actor": "pytest"},
|
||||
)
|
||||
assert report_response.status_code == 200
|
||||
assert report_response.json()["data"]["report_type"] == "daily"
|
||||
|
||||
risk_response = client.post(
|
||||
"/api/v1/risks/events/generate?actor=pytest",
|
||||
headers=headers,
|
||||
)
|
||||
assert risk_response.status_code == 200
|
||||
assert risk_response.json()["created"] >= 1
|
||||
|
||||
events_response = client.get("/api/v1/risks/events?status=open", headers=headers)
|
||||
assert events_response.status_code == 200
|
||||
assert any(item["risk_type"] == "overdue_task" for item in events_response.json()["items"])
|
||||
|
||||
|
||||
def test_ai_noop_provider() -> None:
|
||||
response = client.post(
|
||||
"/api/v1/ai/ask",
|
||||
|
||||
Reference in New Issue
Block a user