make some overall QoL improvements
CI / check (22) (push) Failing after 16m26s
CI / check (24) (push) Failing after 15m50s

This commit is contained in:
Frederik Spirgi
2026-10-08 11:02:32 +02:00
parent 0f58a996ec
commit 8666e09049
7 changed files with 271 additions and 50 deletions
+9 -3
View File
@@ -1,7 +1,7 @@
import {post, put, del} from "./api.js";
import {regenerateInline} from "./regeneration.js";
export function createMessageActions({conversation, setNotice, promptPopup, confirmPopup, setActiveChat, openCreatedChat, setLoadingState, loadSummary, renderMessages, addMessage, setMessageContent, webSearchToggle, reasoningToggle, modelSelect, messagesDiv, msgInput}) {
export function createMessageActions({conversation, setNotice, promptPopup, confirmPopup, setActiveChat, openCreatedChat, setLoadingState, loadSummary, renderMessages, addMessage, setMessageContent, announceReply, announceResponseStatus, webSearchToggle, reasoningToggle, modelSelect, messagesDiv, msgInput}) {
function getMessageIndexById(messageId) {
return conversation.currentMessages.findIndex((message) => message.id === messageId);
}
@@ -106,8 +106,12 @@ export function createMessageActions({conversation, setNotice, promptPopup, conf
webSearch: webSearchToggle.enabled,
confirmed: true
}, {timeoutMs: 660000});
if (res.error) return setNotice(res.error, "error");
if (conversation.activeChatId === sourceChatId) await openCreatedChat(res.chat);
if (res.error) { announceResponseStatus(res.error); return setNotice(res.error, "error"); }
if (conversation.activeChatId === sourceChatId) {
await openCreatedChat(res.chat);
const reply = conversation.currentMessages.at(-1);
if (reply?.role === "bot") announceReply(reply.content);
}
return setNotice("Created the edited chat branch.", "success");
} finally {
conversation.regenerationChatId = null;
@@ -184,11 +188,13 @@ export function createMessageActions({conversation, setNotice, promptPopup, conf
syncRetryStateFromMessage(conversation.currentMessages[index]);
const rendered = addMessage(conversation.currentMessages[index], false, false, { messageIndex: index, detached: true });
card.replaceChildren(...rendered.childNodes);
announceReply(message.content);
}
});
reasoningToggle.reset();
setNotice("Reply regenerated.", "success");
} catch (error) {
announceResponseStatus(error.message || "Unable to regenerate message.");
setNotice(error.message || "Unable to regenerate message.", "error");
} finally {
conversation.regenerationChatId = null;