diff --git a/index.html b/index.html index 9cc13ac..20baa8b 100644 --- a/index.html +++ b/index.html @@ -66,16 +66,11 @@ if (!!data.reader) addMessageStream(data, response) } - function alterTextArea(textArea) { - textArea.style.height = 'auto'; - textArea.style.height = (textArea.scrollHeight + 2) + 'px'; - } + function updateMessage(data, message, updated) { + const index = data.messages.indexOf(message) - function checkSubmit(e, data) { - if (e.key == 'Enter' && !e.shiftKey && !data.busy) { - e.preventDefault() - sendMessage(data, { role: 'user', content: data.content }) - } + data.messages[index] = { ...message, ...updated } + Messages.update(message.id, updated) } function deleteMessage(data, message, drop = false) { @@ -87,6 +82,20 @@ Messages.remove(message.id, drop) } + // + + function alterTextArea(textArea) { + textArea.style.height = 'auto'; + textArea.style.height = (textArea.scrollHeight + 2) + 'px'; + } + + function checkSubmit(e, data) { + if (e.key == 'Enter' && !e.shiftKey && !data.busy) { + e.preventDefault() + sendMessage(data, { role: 'user', content: data.content }) + } + } + // Profile function loadProfile(data) { const profile = Profile.get() @@ -127,12 +136,13 @@ Alpine.store('modalConnection', false) Alpine.store('modalCharacter', false) Alpine.store('modalTune', false) + Alpine.store('modalNotes', false) }) - +
-
+