fix: user message not showing on quick tasks (when using queue)

This commit is contained in:
a7m-1st 2025-10-23 23:51:33 +03:00
parent f95a315fbf
commit 47b1d8569a
2 changed files with 7 additions and 4 deletions

View file

@ -558,8 +558,7 @@ async def step_solve(options: Chat, request: Request, task_lock: TaskLock):
task_lock.add_conversation('assistant', answer_content)
# Send response to user
yield sse_json("confirmed", {"question": new_task_content})
# Send response to user (don't send confirmed if simple response)
yield sse_json("wait_confirm", {"content": answer_content, "question": new_task_content})
except Exception as e:
logger.error(f"Error generating simple answer in multi-turn: {e}")

View file

@ -624,8 +624,12 @@ const chatStore = (initial?: Partial<ChatStore>) => createStore<ChatStore>()(
const currentChatStore = getCurrentChatStore();
//Make sure to add user Message on replay and avoid duplication of first msg
if(type === "replay" && question &&
!(currentChatStore.tasks[currentTaskId].messages.length === 1)) {
if(question && !(currentChatStore.tasks[currentTaskId].messages.length === 1)) {
//Replace the optimistic update if existent.
const lastMessage = currentChatStore.tasks[currentTaskId]?.messages.at(-1);
if(lastMessage?.role === "user" && lastMessage.id && lastMessage.content === question) {
currentChatStore.removeMessage(currentTaskId, lastMessage.id)
}
addMessages(currentTaskId, {
id: generateUniqueId(),
role: "user",