From e1b215ca73c01084329dd927971ba4d84f976342 Mon Sep 17 00:00:00 2001 From: YourUsername Date: Mon, 10 Jun 2024 12:57:17 +0300 Subject: [PATCH] added message pinning --- index.html | 83 +++++++++++++++++++++++++++++++++++++++++++++--------- script.js | 46 +++++++++++++++++++++++------- style.css | 6 ++++ 3 files changed, 111 insertions(+), 24 deletions(-) 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) }) - +
-
+