mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-14 16:42:47 +00:00
fix: isolate new chat state from current replaying chat
This commit is contained in:
parent
e235ba3284
commit
ee353b63ee
2 changed files with 7 additions and 3 deletions
|
|
@ -102,7 +102,6 @@ export default function ChatBox(): JSX.Element {
|
|||
const task = chatStore.tasks[_taskId];
|
||||
const isTaskBusy = (
|
||||
// running or paused counts as busy
|
||||
// TODO: Bug where when replay end hasMessages = false & status = running
|
||||
(task.status === 'running' && !task.hasMessages) || task.status === 'pause' ||
|
||||
// splitting phase: has to_sub_tasks not confirmed OR skeleton computing
|
||||
task.messages.some(m => m.step === 'to_sub_tasks' && !m.isConfirm) ||
|
||||
|
|
@ -111,6 +110,10 @@ export default function ChatBox(): JSX.Element {
|
|||
(!!task.messages.find(m => m.step === 'to_sub_tasks' && !m.isConfirm) && task.status === 'pending')
|
||||
);
|
||||
|
||||
//Fixes bug where doesn't matter the SSE order or final state of the chatStore
|
||||
const isReplayChatStore = chatStore.tasks[_taskId as string]?.type === "replay";
|
||||
const queueTask = isTaskBusy && !isReplayChatStore;
|
||||
|
||||
console.log(`Current task is ${isTaskBusy} with ${task}`);
|
||||
|
||||
if (textareaRef.current) textareaRef.current.style.height = "60px";
|
||||
|
|
@ -152,7 +155,7 @@ export default function ChatBox(): JSX.Element {
|
|||
}
|
||||
} else {
|
||||
// If current task is busy (splitting/confirm/running), queue the new message instead of sending immediately
|
||||
if (isTaskBusy) {
|
||||
if (queueTask) {
|
||||
const project_id = projectStore.activeProjectId;
|
||||
// Queue the message locally; do not send to backend yet.
|
||||
const currentAttaches = JSON.parse(JSON.stringify(task.attaches)) || [];
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ const projectStore = create<ProjectStore>()((set, get) => ({
|
|||
queuedMessages: [], // Initialize empty queued messages array
|
||||
metadata: {
|
||||
status: 'active',
|
||||
historyId: historyId
|
||||
historyId: historyId,
|
||||
tags: type === ProjectType.REPLAY ? ["replay"] : []
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue