feat(server): 新增智能体运行服务,优化知识库索引存储结构,增强运行时状态管理
This commit is contained in:
@@ -115,6 +115,38 @@ class AgentRunService:
|
||||
logger.info("Updated agent run run_id=%s status=%s", updated.run_id, updated.status)
|
||||
return self._serialize_run(updated)
|
||||
|
||||
def merge_route_json(
|
||||
self,
|
||||
run_id: str,
|
||||
route_patch: dict[str, Any],
|
||||
*,
|
||||
status: str | None = None,
|
||||
result_summary: str | None = None,
|
||||
error_message: str | None = None,
|
||||
finished_at: datetime | None = None,
|
||||
) -> AgentRunRead:
|
||||
self._ensure_ready()
|
||||
run = self.repository.get_by_run_id(run_id)
|
||||
if run is None:
|
||||
raise LookupError("Run not found")
|
||||
|
||||
route_json = dict(run.route_json or {})
|
||||
route_json.update(route_patch or {})
|
||||
run.route_json = route_json
|
||||
|
||||
if status is not None:
|
||||
run.status = status
|
||||
if result_summary is not None:
|
||||
run.result_summary = result_summary
|
||||
if error_message is not None:
|
||||
run.error_message = error_message
|
||||
if finished_at is not None:
|
||||
run.finished_at = finished_at
|
||||
|
||||
updated = self.repository.save_run(run)
|
||||
logger.info("Merged route_json for agent run run_id=%s status=%s", updated.run_id, updated.status)
|
||||
return self._serialize_run(updated)
|
||||
|
||||
def record_tool_call(
|
||||
self,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user