make some overall QoL improvements
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user