fix: improve task status
This commit is contained in:
parent
886d408c3b
commit
4dc3d84d38
2 changed files with 8 additions and 8 deletions
|
|
@ -275,9 +275,9 @@ async fn execute_agent_run(
|
|||
)
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
|
||||
|
||||
let (logs, answer) = match agent.run().await {
|
||||
Ok((logs, answer)) => (logs, answer),
|
||||
Err(e) => (format!("Execution failed: {}", e), None),
|
||||
let (logs, answer, status) = match agent.run().await {
|
||||
Ok((logs, answer)) => (logs, answer, "completed".to_string()),
|
||||
Err(e) => (format!("Execution failed: {}", e), None, "failed".to_string()),
|
||||
};
|
||||
|
||||
// Update with final logs and status
|
||||
|
|
@ -293,7 +293,7 @@ async fn execute_agent_run(
|
|||
|
||||
run.logs = Set(logs.clone());
|
||||
run.answer = Set(answer.clone());
|
||||
run.status = Set("completed".to_string());
|
||||
run.status = Set(status);
|
||||
|
||||
run.update(&state.db)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue