mirror of
https://github.com/open-webui/computer.git
synced 2026-11-23 14:10:45 -05:00
refac
This commit is contained in:
1 parent
9171d7285e
commit
d11988c3d0
6 files changed
+42
-8
No files matched your search
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.7] - 2026-06-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🔄 **Messages no longer disappear after sending.** Fixed a race condition where the frontend needed a separate GET request after sending a message, creating a window where socket events were dropped. The POST now returns the created messages directly, eliminating the round-trip and the race.
|
||||
|
||||
## [0.1.6] - 2026-06-07
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.7",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
|
||||
@@ -36,6 +36,8 @@ export interface SendMessageResult {
|
||||
chat_id: string;
|
||||
message_id: string;
|
||||
queued?: boolean;
|
||||
user_message?: ChatMessageRow;
|
||||
assistant_message?: ChatMessageRow;
|
||||
}
|
||||
|
||||
// ── Queries ─────────────────────────────────────────────────
|
||||
|
||||
@@ -541,8 +541,9 @@
|
||||
created_at: Date.now()
|
||||
}
|
||||
];
|
||||
} else {
|
||||
await loadChat(result.chat_id);
|
||||
} else if (result.assistant_message) {
|
||||
allMessages = [...allMessages, result.assistant_message];
|
||||
currentMessageId = result.message_id;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[chat] send (queue) error', e);
|
||||
@@ -588,7 +589,17 @@
|
||||
undefined,
|
||||
files
|
||||
);
|
||||
await loadChat(result.chat_id);
|
||||
|
||||
// Swap optimistic temp msg with real messages from backend.
|
||||
chatId = result.chat_id;
|
||||
const withoutTemp = allMessages.filter((m) => m.id !== tempId);
|
||||
if (result.user_message && result.assistant_message) {
|
||||
allMessages = [...withoutTemp, result.user_message, result.assistant_message];
|
||||
} else if (result.assistant_message) {
|
||||
allMessages = [...withoutTemp, result.assistant_message];
|
||||
}
|
||||
currentMessageId = result.message_id;
|
||||
|
||||
if (isNew && tabId) {
|
||||
updateTab(tabId, result.chat_id, text.slice(0, 40) || 'Chat');
|
||||
}
|
||||
@@ -737,7 +748,10 @@
|
||||
tool_approval_mode: mode,
|
||||
plan_mode: get(planMode)
|
||||
});
|
||||
await loadChat(result.chat_id);
|
||||
if (result.assistant_message) {
|
||||
allMessages = [...allMessages, result.assistant_message];
|
||||
currentMessageId = result.message_id;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[chat] regenerate error', e);
|
||||
}
|
||||
@@ -777,7 +791,10 @@
|
||||
msg.parent_id,
|
||||
{ tool_approval_mode: get(toolApprovalMode), plan_mode: get(planMode) }
|
||||
);
|
||||
await loadChat(result.chat_id);
|
||||
if (result.user_message && result.assistant_message) {
|
||||
allMessages = [...allMessages, result.user_message, result.assistant_message];
|
||||
currentMessageId = result.message_id;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[chat] edit-send error', e);
|
||||
}
|
||||
|
||||
+10
-1
@@ -423,7 +423,16 @@ async def send_message(body: SendMessageRequest, request: Request):
|
||||
regeneration_prompt=body.regeneration_prompt,
|
||||
)
|
||||
|
||||
return {"chat_id": chat.id, "message_id": assistant_msg.id}
|
||||
# Return the created messages so the frontend can append them
|
||||
# directly — no separate GET needed, no client-side construction.
|
||||
resp: dict = {
|
||||
"chat_id": chat.id,
|
||||
"message_id": assistant_msg.id,
|
||||
"assistant_message": _message_dict(assistant_msg),
|
||||
}
|
||||
if parent_msg is None or parent_msg.role != "user":
|
||||
resp["user_message"] = _message_dict(user_msg)
|
||||
return resp
|
||||
|
||||
|
||||
# ── Approve / reject a pending tool call ────────────────────
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "cptr"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
description = "Your computer, from anywhere. Code, manage, and control your machine from the web."
|
||||
license = {file = "LICENSE"}
|
||||
readme = "README.md"
|
||||
|
||||
Reference in new issue
Block a user