feat(demo): cap chat input at 8000 chars (~2000 tokens)

This commit is contained in:
2026-05-07 02:33:36 -05:00
parent 3e377e2bb6
commit c24b9b179b
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -236,6 +236,14 @@ fn main() -> Void {
if (!input || btn.disabled) return;
var msg = input.value.trim();
if (!msg) return;
var MAX_CHARS = 8000;
if (msg.length > MAX_CHARS) {
if (input) {
input.style.outline = '2px solid #e53e3e';
setTimeout(function() { input.style.outline = ''; }, 2000);
}
return;
}
input.value = '';
btn.disabled = true;
addMsg('user', msg);
+1 -1
View File
@@ -1997,7 +1997,7 @@ fn page_close() -> String {
<div id="neuron-demo-messages"></div>
<div id="neuron-demo-turnstile" style="padding:0.75rem 1rem 0;transition:opacity 0.6s,max-height 0.6s;overflow:hidden;max-height:80px"></div>
<div id="neuron-demo-input-row" style="display:none">
<input type="text" id="neuron-demo-text" placeholder="Ask me anything..." autocomplete="off">
<input type="text" id="neuron-demo-text" placeholder="Ask me anything..." autocomplete="off" maxlength="8000">
<button id="neuron-demo-send" onclick="neuronDemoSend()">Send</button>
</div>
</div>