@firstlovecenter/ai-chat 0.8.0 → 0.8.1

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/ui/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import * as React from 'react';
3
3
  import { useMemo, useState, useRef, useLayoutEffect, useEffect, useCallback } from 'react';
4
4
  import { useRouter } from 'next/navigation';
5
+ import Link from 'next/link';
5
6
  import { PanelLeftClose, Plus, Pencil, Trash2, Menu, Sparkles, Loader2, ChevronDown, Check, ArrowUp, Copy, RotateCcw, ChevronUp } from 'lucide-react';
6
7
  import { DropdownMenu as DropdownMenu$1 } from 'radix-ui';
7
8
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -751,8 +752,8 @@ function AiChat({
751
752
  setActiveSessionId(null);
752
753
  setAnswers([]);
753
754
  setQuestion("");
754
- syncUrl(null);
755
- }, [syncUrl]);
755
+ router.push("/chat?new");
756
+ }, [router]);
756
757
  const changeProvider = useCallback(
757
758
  async (next) => {
758
759
  if (next === provider || providerSaving) return;
@@ -775,7 +776,7 @@ function AiChat({
775
776
  },
776
777
  [provider, providerSaving]
777
778
  );
778
- const openSession = useCallback(
779
+ useCallback(
779
780
  async (id) => {
780
781
  setLoadingSession(true);
781
782
  setActiveSessionId(id);
@@ -1003,13 +1004,10 @@ function AiChat({
1003
1004
  }
1004
1005
  return /* @__PURE__ */ jsxs("li", { className: "group relative", children: [
1005
1006
  /* @__PURE__ */ jsx(
1006
- "button",
1007
+ Link,
1007
1008
  {
1008
- type: "button",
1009
- onClick: () => {
1010
- void openSession(s.id);
1011
- setSidebarOpen(false);
1012
- },
1009
+ href: `/chat/${s.id}`,
1010
+ onClick: () => setSidebarOpen(false),
1013
1011
  className: cn(
1014
1012
  "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",
1015
1013
  active ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-foreground/80 hover:bg-sidebar-accent/60 hover:text-sidebar-foreground"
@@ -1734,8 +1732,8 @@ function VercelChat({
1734
1732
  setHydratedErrors({});
1735
1733
  setStartedAt({});
1736
1734
  setInput("");
1737
- syncUrl(null);
1738
- }, [setMessages, setInput, syncUrl]);
1735
+ router.push("/chat?new");
1736
+ }, [setMessages, setInput, router]);
1739
1737
  const changeProvider = useCallback(
1740
1738
  async (next) => {
1741
1739
  if (next === provider || providerSaving) return;
@@ -1758,7 +1756,7 @@ function VercelChat({
1758
1756
  },
1759
1757
  [provider, providerSaving]
1760
1758
  );
1761
- const openSession = useCallback(
1759
+ useCallback(
1762
1760
  async (id) => {
1763
1761
  setLoadingSession(true);
1764
1762
  setActiveSessionId(id);
@@ -1963,13 +1961,10 @@ function VercelChat({
1963
1961
  }
1964
1962
  return /* @__PURE__ */ jsxs("li", { className: "group relative", children: [
1965
1963
  /* @__PURE__ */ jsx(
1966
- "button",
1964
+ Link,
1967
1965
  {
1968
- type: "button",
1969
- onClick: () => {
1970
- void openSession(s.id);
1971
- setSidebarOpen(false);
1972
- },
1966
+ href: `/chat/${s.id}`,
1967
+ onClick: () => setSidebarOpen(false),
1973
1968
  className: cn(
1974
1969
  "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",
1975
1970
  active ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-foreground/80 hover:bg-sidebar-accent/60 hover:text-sidebar-foreground"