feat: 新增票据夹模块并优化 OCR 与员工画像服务

后端新增票据夹端点、数据模型和服务模块,优化 OCR 端点
Schema 和附件操作逻辑,完善员工行为画像服务和辅助函数,
前端新增票据夹视图和服务层,优化文档中心样式和侧边栏导
航,完善员工画像详情弹窗和权限控制,补充单元测试。
This commit is contained in:
caoxiaozhu
2026-05-29 14:51:18 +08:00
parent 678f64d772
commit 4c59941ec6
33 changed files with 2855 additions and 551 deletions

View File

@@ -171,6 +171,22 @@ class EmployeeBehaviorProfileMetricHelpers:
total += max(0, len(text) // 4)
return total
def _sum_agent_run_duration_ms(self, runs: list[AgentRun]) -> int:
return sum(self._agent_run_duration_ms(run) for run in runs)
def _agent_run_duration_ms(self, run: AgentRun) -> int:
if run.started_at is not None and run.finished_at is not None:
try:
if run.finished_at > run.started_at:
return min(
int((run.finished_at - run.started_at).total_seconds() * 1000),
24 * 60 * 60 * 1000,
)
except TypeError:
pass
return sum(max(0, int(tool.duration_ms or 0)) for tool in run.tool_calls)
@staticmethod
def _is_missing_value(value: Any) -> bool:
text = str(value or "").strip()