@wrongstack/webui 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2419,6 +2419,17 @@ function ChatInput() {
2419
2419
  useEffect5(() => {
2420
2420
  if (slashIndex >= slashSuggestions.length) setSlashIndex(0);
2421
2421
  }, [slashSuggestions.length, slashIndex]);
2422
+ const _clearTextarea = useCallback2(() => {
2423
+ const ta = textareaRef.current;
2424
+ if (ta) {
2425
+ ta.value = "";
2426
+ ta.style.height = "auto";
2427
+ ta.style.height = `${Math.min(ta.scrollHeight, 200)}px`;
2428
+ if (!isLoading) {
2429
+ ta.focus();
2430
+ }
2431
+ }
2432
+ }, [isLoading]);
2422
2433
  const handleSubmit = useCallback2(
2423
2434
  async (e) => {
2424
2435
  e.preventDefault();
@@ -2428,11 +2439,14 @@ function ChatInput() {
2428
2439
  pushPrompt(content);
2429
2440
  setInput("");
2430
2441
  setHistoryIdx(-1);
2442
+ _clearTextarea();
2431
2443
  return;
2432
2444
  }
2433
2445
  setInput("");
2434
2446
  setHistoryIdx(-1);
2447
+ _clearTextarea();
2435
2448
  pushPrompt(content);
2449
+ _clearTextarea();
2436
2450
  if (isLoading) {
2437
2451
  enqueue(content);
2438
2452
  return;
@@ -2459,7 +2473,8 @@ function ChatInput() {
2459
2473
  setLoading,
2460
2474
  addMessage,
2461
2475
  runSlashCommand,
2462
- pushPrompt
2476
+ pushPrompt,
2477
+ _clearTextarea
2463
2478
  ]
2464
2479
  );
2465
2480
  const handleAbort = useCallback2(() => {