chore: polish ai chat interactions

Co-authored-by: amruthpillai <1134738+amruthpillai@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-20 00:45:10 +00:00
parent 095a5d6e9b
commit 3e622f2a85
2 changed files with 9 additions and 18 deletions
@@ -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() {
>
<Button
size="icon"
variant="default"
variant="default"
className="pointer-events-auto shadow-lg"
onClick={() => {
toggle();
@@ -184,20 +186,6 @@ export function AIChatPanel() {
</Button>
</motion.div>
) : null}
{!fabVisible && (
<Button
className="hidden"
variant="ghost"
size="icon"
onClick={() => {
open();
touch();
}}
>
<SparkleIcon />
</Button>
)}
</>
);
}
@@ -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[] = [
{