From cdf998ddedda837f1a8684067ba49458ea5f5039 Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Thu, 11 Dec 2025 18:06:58 +0100 Subject: [PATCH] thinking indicator, role column --- poller/main.py | 3 ++- web/src/app/page.tsx | 33 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/poller/main.py b/poller/main.py index 835916a..2e93aec 100644 --- a/poller/main.py +++ b/poller/main.py @@ -76,6 +76,7 @@ def create_tables(): """ CREATE TABLE IF NOT EXISTS embeddings ( id SERIAL PRIMARY KEY, + role TEXT, bucket TEXT, key TEXT, content TEXT, @@ -144,7 +145,7 @@ def split_files(): Key=f'{key}/page-{i + 1}.pdf', Body=bs.getvalue() ) - cur.execute('INSERT INTO embeddings (bucket, key) VALUES (%s, %s);', (BUCKET_PAGES, f'{key}/page-{i + 1}.pdf')) + cur.execute('INSERT INTO embeddings (bucket, key, role) VALUES (%s, %s, %s);', (BUCKET_PAGES, f'{key}/page-{i + 1}.pdf', key.split('/')[0])) cur.execute('UPDATE metadata SET SPLIT = true WHERE id = %s', (row['id'],)); conn.commit() diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index 300de31..0d7d76c 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -8,10 +8,29 @@ import LoginButton from "@/components/LoginButton"; import LogoutButton from "@/components/LogoutButton"; import Profile from "@/components/Profile"; +// Separate component to safely use useCopilotChat hook +function ThinkingIndicator() { + try { + const { isLoading } = useCopilotChat(); + if (!isLoading) return null; + return ( +
+
+ + + +
+ Thinking... +
+ ); + } catch { + return null; + } +} + export default function CopilotKitPage() { const [themeColor, setThemeColor] = useState("#6366f1"); const { user, isLoading: authLoading } = useUser(); - const { isLoading: chatLoading } = useCopilotChat(); useCopilotAction({ name: "setThemeColor", @@ -104,17 +123,7 @@ export default function CopilotKitPage() { className="h-full w-full" /> - {/* Loading overlay */} - {chatLoading && ( -
-
- - - -
- Thinking... -
- )} + );