From 3e622f2a8544837dafe1a8cf4bd876cbcd20ca57 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 20 Jan 2026 00:45:10 +0000
Subject: [PATCH] chore: polish ai chat interactions
Co-authored-by: amruthpillai <1134738+amruthpillai@users.noreply.github.com>
---
.../builder/$resumeId/-components/ai-chat.tsx | 22 +++++--------------
.../builder/$resumeId/-store/ai-chat.ts | 5 ++++-
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/src/routes/builder/$resumeId/-components/ai-chat.tsx b/src/routes/builder/$resumeId/-components/ai-chat.tsx
index f6b4dc46a..6b36a1623 100644
--- a/src/routes/builder/$resumeId/-components/ai-chat.tsx
+++ b/src/routes/builder/$resumeId/-components/ai-chat.tsx
@@ -29,6 +29,8 @@ type AIChatResponse = {
};
};
+const FAB_TIMEOUT_MS = 60_000;
+
export function AIChatPanel() {
const aiEnabled = useAIStore((state) => state.enabled);
const aiConfig = useAIStore((state) => ({
@@ -41,7 +43,7 @@ export function AIChatPanel() {
const { resumeId } = useParams({ from: "/builder/$resumeId" });
const updateResumeData = useResumeStore((state) => state.updateResumeData);
- const { isOpen, fabVisible, lastInteraction, messages, toggle, open, close, hideFab, addMessage, touch } =
+ const { isOpen, fabVisible, lastInteraction, messages, toggle, close, hideFab, addMessage, touch } =
useAIChatStore();
const [input, setInput] = useState("");
@@ -76,7 +78,7 @@ export function AIChatPanel() {
useEffect(() => {
if (!fabVisible || isOpen) return;
const last = lastInteraction ?? Date.now();
- const remaining = Math.max(0, 60_000 - (Date.now() - last));
+ const remaining = Math.max(0, FAB_TIMEOUT_MS - (Date.now() - last));
const timer = setTimeout(() => {
if (!useAIChatStore.getState().isOpen) hideFab();
}, remaining);
@@ -173,7 +175,7 @@ export function AIChatPanel() {
>
) : null}
-
- {!fabVisible && (
-
- )}
>
);
}
diff --git a/src/routes/builder/$resumeId/-store/ai-chat.ts b/src/routes/builder/$resumeId/-store/ai-chat.ts
index 6587d4123..75afa9054 100644
--- a/src/routes/builder/$resumeId/-store/ai-chat.ts
+++ b/src/routes/builder/$resumeId/-store/ai-chat.ts
@@ -25,7 +25,10 @@ type AIChatActions = {
type AIChatStore = AIChatState & AIChatActions;
-const createId = () => (crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2));
+const createId = () =>
+ typeof crypto !== "undefined" && crypto.randomUUID
+ ? crypto.randomUUID()
+ : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
const initialMessages: AIChatMessage[] = [
{