feat(shipping-notice): 增强订单抽取功能,添加进度事件和诊断运行管理,优化数据模型和访问控制
This commit is contained in:
1 parent
ce26d6d0c4
commit
c4095b08da
175 files changed
+13064
-1814
No files matched your search
@@ -20,7 +20,12 @@ def compute_dashboard_summary() -> dict:
|
||||
agent_count、user_count、total_conversations、avg_score。
|
||||
"""
|
||||
total_users = db.session.query(func.count(User.id)).scalar() or 0
|
||||
active_agents = db.session.query(func.count(Agent.id)).filter_by(is_active=True).scalar() or 0
|
||||
active_agents = (
|
||||
db.session.query(func.count(Agent.id))
|
||||
.filter(Agent.is_active.is_(True), Agent.exposure_mode == 'workspace')
|
||||
.scalar()
|
||||
or 0
|
||||
)
|
||||
total_conversations = db.session.query(func.count(ChatLog.id)).scalar() or 0
|
||||
avg_score = db.session.query(func.avg(Feedback.score)).scalar()
|
||||
avg_score = round(float(avg_score), 1) if avg_score else 0.0
|
||||
@@ -39,7 +44,13 @@ def compute_dashboard_badges() -> dict:
|
||||
pending_approvals、pending_requests。
|
||||
"""
|
||||
pending_approvals = db.session.query(func.count(User.id)).filter_by(status='pending').scalar() or 0
|
||||
pending_requests = db.session.query(func.count(PermissionRequest.id)).filter_by(status='pending').scalar() or 0
|
||||
pending_requests = (
|
||||
db.session.query(func.count(PermissionRequest.id))
|
||||
.join(Agent, Agent.id == PermissionRequest.agent_id)
|
||||
.filter(PermissionRequest.status == 'pending', Agent.exposure_mode == 'workspace')
|
||||
.scalar()
|
||||
or 0
|
||||
)
|
||||
return {
|
||||
'pending_approvals': pending_approvals,
|
||||
'pending_requests': pending_requests,
|
||||
|
||||
Reference in new issue
Block a user