diff --git a/chat/templates/chat.html b/chat/templates/chat.html index 8833062..c2f622c 100644 --- a/chat/templates/chat.html +++ b/chat/templates/chat.html @@ -78,7 +78,11 @@ document.querySelector('.drawer-toggle')?.addEventListener('click', (e) => { function unlock() { isStreaming = false; if (sendBtn) sendBtn.disabled = false; - if (textarea) textarea.disabled = false; + if (textarea) { + textarea.readOnly = false; + textarea.value = ''; + textarea.focus(); + } const stop = shell.querySelector('.stop-streaming'); if (stop) stop.remove(); } @@ -128,7 +132,10 @@ document.querySelector('.drawer-toggle')?.addEventListener('click', (e) => { form.addEventListener('submit', () => { isStreaming = true; if (sendBtn) sendBtn.disabled = true; - if (textarea) textarea.disabled = true; + // readOnly (not disabled) — disabled fields are excluded from the + // form submission, which would send prose="" and trigger the + // server's empty-prose 400. + if (textarea) textarea.readOnly = true; if (!shell.querySelector('.stop-streaming')) { const stopBtn = document.createElement('button'); stopBtn.type = 'button';