mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-13 15:34:31 +00:00
fix: task shown 2 times in the frontend
This commit is contained in:
parent
16821d1f26
commit
2d24b8151e
1 changed files with 16 additions and 7 deletions
|
|
@ -604,7 +604,7 @@ const chatStore = create<ChatStore>()(
|
|||
|
||||
// The following logic is for when the task actually starts executing (running)
|
||||
if (taskAssigning && taskAssigning[assigneeAgentIndex]) {
|
||||
// const exist = taskAssigning[assigneeAgentIndex].tasks.find(item => item.id === task_id);
|
||||
const exist = taskAssigning[assigneeAgentIndex].tasks.find(item => item.id === task_id);
|
||||
let taskTemp = null
|
||||
if (task) {
|
||||
taskTemp = JSON.parse(JSON.stringify(task))
|
||||
|
|
@ -613,12 +613,21 @@ const chatStore = create<ChatStore>()(
|
|||
taskTemp.toolkits = []
|
||||
taskTemp.report = ""
|
||||
}
|
||||
taskAssigning[assigneeAgentIndex].tasks.push(taskTemp ?? { id: task_id, content, status: "running", });
|
||||
// if (exist) {
|
||||
// exist.status = "running";
|
||||
// } else {
|
||||
// taskAssigning[assigneeAgentIndex].tasks.push(taskTemp ?? { id: task_id, content, status: "running", });
|
||||
// }
|
||||
if (exist) {
|
||||
// Update existing task instead of adding duplicate
|
||||
const existingIndex = taskAssigning[assigneeAgentIndex].tasks.findIndex(item => item.id === task_id);
|
||||
if (existingIndex !== -1) {
|
||||
taskAssigning[assigneeAgentIndex].tasks[existingIndex] = {
|
||||
...exist,
|
||||
status: "running",
|
||||
failure_count: 0,
|
||||
toolkits: [],
|
||||
report: ""
|
||||
};
|
||||
}
|
||||
} else {
|
||||
taskAssigning[assigneeAgentIndex].tasks.push(taskTemp ?? { id: task_id, content, status: "running", });
|
||||
}
|
||||
}
|
||||
if (taskRunningIndex === -1) {
|
||||
taskRunning!.push(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue