mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-16 19:50:50 +00:00
commit
df4ba3ff25
1 changed files with 15 additions and 8 deletions
|
|
@ -145,9 +145,12 @@ function HeaderWin() {
|
|||
return;
|
||||
}
|
||||
|
||||
const projectId = projectStore.activeProjectId;
|
||||
const historyId = projectId ? projectStore.getHistoryId(projectId) : null;
|
||||
|
||||
try {
|
||||
const task = chatStore.tasks[taskId];
|
||||
|
||||
|
||||
// Stop the task if it's running
|
||||
if (task && task.status === 'running') {
|
||||
await fetchPut(`/task/${taskId}/take-control`, {
|
||||
|
|
@ -162,11 +165,15 @@ function HeaderWin() {
|
|||
console.log("Task may not exist on backend:", error);
|
||||
}
|
||||
|
||||
// Delete from history
|
||||
try {
|
||||
await proxyFetchDelete(`/api/chat/history/${taskId}`);
|
||||
} catch (error) {
|
||||
console.log("Task may not exist in history:", error);
|
||||
// Delete from history using historyId
|
||||
if (historyId) {
|
||||
try {
|
||||
await proxyFetchDelete(`/api/chat/history/${historyId}`);
|
||||
} catch (error) {
|
||||
console.log("History may not exist:", error);
|
||||
}
|
||||
} else {
|
||||
console.warn("No historyId found for project, skipping history deletion");
|
||||
}
|
||||
|
||||
// Remove from local store
|
||||
|
|
@ -176,8 +183,8 @@ function HeaderWin() {
|
|||
const newTaskId = chatStore.create();
|
||||
chatStore.setActiveTaskId(newTaskId);
|
||||
|
||||
// Navigate to home
|
||||
navigate("/");
|
||||
// Navigate to home with replace to force refresh
|
||||
navigate("/", { replace: true });
|
||||
|
||||
toast.success(t("layout.project-ended-successfully"), {
|
||||
closeButton: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue