Agent Zero AI framework
ui: enhance chat input vertical expansion and auto-resize
Alessandro4b3666aa3589
diff --git a/webui/components/chat/input/chat-bar-input.html b/webui/components/chat/input/chat-bar-input.htmlindex 2e93553ea..a19fb612a 100644--- a/webui/components/chat/input/chat-bar-input.html+++ b/webui/components/chat/input/chat-bar-input.html@@ -84,8 +84,9 @@font-optical-sizing: auto;-webkit-font-optical-sizing: auto;font-size: 0.9rem;- max-height: 7rem;+ max-height: clamp(7rem, 40vh, 20rem);min-height: 3.05rem;+ field-sizing: content;width: 100%;padding: 0.48rem 40px var(--spacing-sm) var(--spacing-sm);margin-right: var(--spacing-xs);diff --git a/webui/components/chat/input/chat-bar.html b/webui/components/chat/input/chat-bar.htmlindex c8d158656..7cef97d05 100644--- a/webui/components/chat/input/chat-bar.html+++ b/webui/components/chat/input/chat-bar.html@@ -39,6 +39,8 @@align-items: start;place-items: normal;flex-shrink: 0;+ max-height: 60vh;+ overflow: visible;z-index: 1001;}diff --git a/webui/components/chat/input/input-store.js b/webui/components/chat/input/input-store.jsindex 7534d93b5..e0ceccc40 100644--- a/webui/components/chat/input/input-store.js+++ b/webui/components/chat/input/input-store.js@@ -64,6 +64,7 @@ const model = {adjustTextareaHeight() {const chatInput = document.getElementById("chat-input");if (chatInput) {+ if (!this.message) chatInput.value = "";chatInput.style.height = "auto";chatInput.style.height = chatInput.scrollHeight + "px";}diff --git a/webui/index.js b/webui/index.jsindex fe0e9d091..29dd0fbed 100644--- a/webui/index.js+++ b/webui/index.js@@ -62,6 +62,7 @@ export async function sendMessage() {// no await for the queue// if (success) {inputStore.reset();+ adjustTextareaHeight();// }return;}@@ -73,8 +74,9 @@ export async function sendMessage() {let response;const messageId = generateGUID();- // Clear input and attachments- inputStore.reset();+ // Clear input and attachments+ inputStore.reset();+ adjustTextareaHeight();// Include attachments in the user messageif (hasAttachments) {@@ -229,6 +231,7 @@ globalThis.loadKnowledge = async function () {function adjustTextareaHeight() {const chatInputEl = document.getElementById("chat-input");if (chatInputEl) {+ if (!inputStore.message) chatInputEl.value = "";chatInputEl.style.height = "auto";chatInputEl.style.height = chatInputEl.scrollHeight + "px";}