|
@@ -195,7 +195,7 @@ class TaskManager:
|
|
"list": response_data,
|
|
"list": response_data,
|
|
}
|
|
}
|
|
|
|
|
|
- def create_task(self, agent_id: int, model_id: int) -> Dict:
|
|
|
|
|
|
+ def create_task(self, agent_id: int, model_id: int ) -> Dict:
|
|
"""创建新任务"""
|
|
"""创建新任务"""
|
|
|
|
|
|
conn = self.db.get_connection()
|
|
conn = self.db.get_connection()
|
|
@@ -265,7 +265,7 @@ class TaskManager:
|
|
(status, task_conversations_id)
|
|
(status, task_conversations_id)
|
|
)
|
|
)
|
|
|
|
|
|
- def update_task_conversations_res(self, task_conversations_id: int, status: int, score: float):
|
|
|
|
|
|
+ def update_task_conversations_res(self, task_conversations_id: int, status: int, score: str):
|
|
"""更新子任务状态"""
|
|
"""更新子任务状态"""
|
|
self.db.execute(
|
|
self.db.execute(
|
|
f"""UPDATE {self.test_task_conversations_table} SET status = %s, score = %s WHERE id = %s""",
|
|
f"""UPDATE {self.test_task_conversations_table} SET status = %s, score = %s WHERE id = %s""",
|
|
@@ -383,7 +383,7 @@ class TaskManager:
|
|
# 模拟任务执行 - 在实际应用中替换为实际业务逻辑
|
|
# 模拟任务执行 - 在实际应用中替换为实际业务逻辑
|
|
# TODO 后续改成实际任务执行
|
|
# TODO 后续改成实际任务执行
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
- score = random.random()
|
|
|
|
|
|
+ score = '{"score":0.05}'
|
|
# 更新子任务状态为已完成
|
|
# 更新子任务状态为已完成
|
|
self.update_task_conversations_res(task_conversation['id'],
|
|
self.update_task_conversations_res(task_conversation['id'],
|
|
TestTaskConversationsStatus.SUCCESS.value, score)
|
|
TestTaskConversationsStatus.SUCCESS.value, score)
|