xonecas.io
53129
Pa

PAT / commit 6c50ead

feat: ask to create thread in nux state

xonecas2025-12-16 6c50ead5e0d838f90e6dd8fd7a7dde8827d29a83 parent f53eb41

2 files changed

app/globals.css+6−0
@@ -2,6 +2,12 @@
22 @tailwind components;
33 @tailwind utilities;
44
5+@layer base {
6+ html {
7+ font-size: 16px;
8+ }
9+}
10+
511 .markdown-content {
612 @apply text-slate-800 dark:text-slate-200;
713 }
app/page.tsx+7−2
@@ -138,7 +138,11 @@ export default function Home() {
138138 const data = await res.json();
139139 threadId = data.thread.id;
140140 setCurrentThreadId(threadId);
141- setThreads((prev) => [data.thread, ...prev.slice(0, 9)]);
141+ setMessages([]);
142+ // Reload threads to ensure UI is in sync
143+ const threadsRes = await fetch("/api/threads");
144+ const threadsData = await threadsRes.json();
145+ setThreads(threadsData.threads || []);
142146 } catch (error) {
143147 console.error("Failed to create thread", error);
144148 return;
@@ -153,7 +157,8 @@ export default function Home() {
153157 createdAt: new Date(),
154158 };
155159 setMessages((prev) => [...prev, userMsg]);
156- const inputValue = input;
160+ const inputValue = input.trim();
161+ if (!inputValue) return;
157162 setInput("");
158163
159164 const res = await fetch("/api/chat", {