@firstlovecenter/ai-chat 0.8.1 → 0.9.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/CHANGELOG.md +43 -0
- package/dist/drizzle/index.cjs +24 -16
- package/dist/drizzle/index.cjs.map +1 -1
- package/dist/drizzle/index.d.cts +17 -17
- package/dist/drizzle/index.d.ts +17 -17
- package/dist/drizzle/index.js +24 -16
- package/dist/drizzle/index.js.map +1 -1
- package/dist/prisma/index.cjs +20 -4
- package/dist/prisma/index.cjs.map +1 -1
- package/dist/prisma/index.d.cts +19 -10
- package/dist/prisma/index.d.ts +19 -10
- package/dist/prisma/index.js +20 -4
- package/dist/prisma/index.js.map +1 -1
- package/dist/server/index.cjs +5 -5
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +5 -5
- package/dist/server/index.js.map +1 -1
- package/dist/{types-BnwUkqKb.d.cts → types-BOgBJ7CD.d.cts} +14 -8
- package/dist/{types-BnwUkqKb.d.ts → types-BOgBJ7CD.d.ts} +14 -8
- package/dist/ui/index.cjs +14 -12
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +21 -5
- package/dist/ui/index.d.ts +21 -5
- package/dist/ui/index.js +14 -12
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/prisma/chat-models.prisma +7 -3
package/dist/ui/index.d.cts
CHANGED
|
@@ -13,12 +13,19 @@ type AiChatProps$1 = {
|
|
|
13
13
|
* (`/chat/[id]`) so reload/bookmark/multi-tab restore the exact
|
|
14
14
|
* conversation. `null` (or omitted) renders the empty new-chat state.
|
|
15
15
|
*/
|
|
16
|
-
initialSessionId?:
|
|
16
|
+
initialSessionId?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* URL prefix the chat is mounted at. Sidebar `<Link>`s and router
|
|
19
|
+
* pushes use this prefix so multiple chat surfaces (e.g. `/chat` and
|
|
20
|
+
* `/admin/ai`) can coexist without yanking users between shells.
|
|
21
|
+
* Defaults to `/chat`.
|
|
22
|
+
*/
|
|
23
|
+
basePath?: string;
|
|
17
24
|
};
|
|
18
|
-
declare function AiChat({ userFirstName, scopeLabel, initialProvider, initialSessionId }: AiChatProps$1): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function AiChat({ userFirstName, scopeLabel, initialProvider, initialSessionId, basePath }: AiChatProps$1): react_jsx_runtime.JSX.Element;
|
|
19
26
|
|
|
20
27
|
type AiChatSessionSummary = {
|
|
21
|
-
id:
|
|
28
|
+
id: string;
|
|
22
29
|
title: string;
|
|
23
30
|
updatedAt: string | null;
|
|
24
31
|
};
|
|
@@ -34,10 +41,19 @@ type AiChatProps = {
|
|
|
34
41
|
* conversation the user was viewing. Pass `null` (or omit) for the
|
|
35
42
|
* empty "new chat" state.
|
|
36
43
|
*/
|
|
37
|
-
initialSessionId?:
|
|
44
|
+
initialSessionId?: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* URL prefix the chat surface is mounted at. Sidebar links resolve to
|
|
47
|
+
* `${basePath}/${sessionId}`, "+ New chat" goes to `${basePath}?new`,
|
|
48
|
+
* and the open-session push uses the same prefix. Defaults to `/chat`.
|
|
49
|
+
* Set to e.g. `/admin/ai` when embedding the chat inside another shell
|
|
50
|
+
* — the host then needs a matching `[id]` dynamic segment under that
|
|
51
|
+
* path so reload/bookmark URLs resolve.
|
|
52
|
+
*/
|
|
53
|
+
basePath?: string;
|
|
38
54
|
};
|
|
39
55
|
|
|
40
|
-
declare function VercelChat({ userFirstName, scopeLabel, initialProvider, initialSessionId }: AiChatProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function VercelChat({ userFirstName, scopeLabel, initialProvider, initialSessionId, basePath }: AiChatProps): react_jsx_runtime.JSX.Element;
|
|
41
57
|
|
|
42
58
|
type ChartSpec = {
|
|
43
59
|
type: 'line' | 'bar' | 'stacked_bar' | 'pie';
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -13,12 +13,19 @@ type AiChatProps$1 = {
|
|
|
13
13
|
* (`/chat/[id]`) so reload/bookmark/multi-tab restore the exact
|
|
14
14
|
* conversation. `null` (or omitted) renders the empty new-chat state.
|
|
15
15
|
*/
|
|
16
|
-
initialSessionId?:
|
|
16
|
+
initialSessionId?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* URL prefix the chat is mounted at. Sidebar `<Link>`s and router
|
|
19
|
+
* pushes use this prefix so multiple chat surfaces (e.g. `/chat` and
|
|
20
|
+
* `/admin/ai`) can coexist without yanking users between shells.
|
|
21
|
+
* Defaults to `/chat`.
|
|
22
|
+
*/
|
|
23
|
+
basePath?: string;
|
|
17
24
|
};
|
|
18
|
-
declare function AiChat({ userFirstName, scopeLabel, initialProvider, initialSessionId }: AiChatProps$1): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function AiChat({ userFirstName, scopeLabel, initialProvider, initialSessionId, basePath }: AiChatProps$1): react_jsx_runtime.JSX.Element;
|
|
19
26
|
|
|
20
27
|
type AiChatSessionSummary = {
|
|
21
|
-
id:
|
|
28
|
+
id: string;
|
|
22
29
|
title: string;
|
|
23
30
|
updatedAt: string | null;
|
|
24
31
|
};
|
|
@@ -34,10 +41,19 @@ type AiChatProps = {
|
|
|
34
41
|
* conversation the user was viewing. Pass `null` (or omit) for the
|
|
35
42
|
* empty "new chat" state.
|
|
36
43
|
*/
|
|
37
|
-
initialSessionId?:
|
|
44
|
+
initialSessionId?: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* URL prefix the chat surface is mounted at. Sidebar links resolve to
|
|
47
|
+
* `${basePath}/${sessionId}`, "+ New chat" goes to `${basePath}?new`,
|
|
48
|
+
* and the open-session push uses the same prefix. Defaults to `/chat`.
|
|
49
|
+
* Set to e.g. `/admin/ai` when embedding the chat inside another shell
|
|
50
|
+
* — the host then needs a matching `[id]` dynamic segment under that
|
|
51
|
+
* path so reload/bookmark URLs resolve.
|
|
52
|
+
*/
|
|
53
|
+
basePath?: string;
|
|
38
54
|
};
|
|
39
55
|
|
|
40
|
-
declare function VercelChat({ userFirstName, scopeLabel, initialProvider, initialSessionId }: AiChatProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function VercelChat({ userFirstName, scopeLabel, initialProvider, initialSessionId, basePath }: AiChatProps): react_jsx_runtime.JSX.Element;
|
|
41
57
|
|
|
42
58
|
type ChartSpec = {
|
|
43
59
|
type: 'line' | 'bar' | 'stacked_bar' | 'pie';
|
package/dist/ui/index.js
CHANGED
|
@@ -654,7 +654,8 @@ function AiChat({
|
|
|
654
654
|
userFirstName,
|
|
655
655
|
scopeLabel,
|
|
656
656
|
initialProvider,
|
|
657
|
-
initialSessionId = null
|
|
657
|
+
initialSessionId = null,
|
|
658
|
+
basePath = "/chat"
|
|
658
659
|
}) {
|
|
659
660
|
const router = useRouter();
|
|
660
661
|
const [sessions, setSessions] = useState([]);
|
|
@@ -744,16 +745,16 @@ function AiChat({
|
|
|
744
745
|
}, []);
|
|
745
746
|
const syncUrl = useCallback(
|
|
746
747
|
(id) => {
|
|
747
|
-
router.push(id == null ?
|
|
748
|
+
router.push(id == null ? basePath : `${basePath}/${id}`);
|
|
748
749
|
},
|
|
749
|
-
[router]
|
|
750
|
+
[router, basePath]
|
|
750
751
|
);
|
|
751
752
|
const newChat = useCallback(() => {
|
|
752
753
|
setActiveSessionId(null);
|
|
753
754
|
setAnswers([]);
|
|
754
755
|
setQuestion("");
|
|
755
|
-
router.push(
|
|
756
|
-
}, [router]);
|
|
756
|
+
router.push(`${basePath}?new`);
|
|
757
|
+
}, [router, basePath]);
|
|
757
758
|
const changeProvider = useCallback(
|
|
758
759
|
async (next) => {
|
|
759
760
|
if (next === provider || providerSaving) return;
|
|
@@ -1006,7 +1007,7 @@ function AiChat({
|
|
|
1006
1007
|
/* @__PURE__ */ jsx(
|
|
1007
1008
|
Link,
|
|
1008
1009
|
{
|
|
1009
|
-
href:
|
|
1010
|
+
href: `${basePath}/${s.id}`,
|
|
1010
1011
|
onClick: () => setSidebarOpen(false),
|
|
1011
1012
|
className: cn(
|
|
1012
1013
|
"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",
|
|
@@ -1489,7 +1490,8 @@ function VercelChat({
|
|
|
1489
1490
|
userFirstName,
|
|
1490
1491
|
scopeLabel,
|
|
1491
1492
|
initialProvider,
|
|
1492
|
-
initialSessionId = null
|
|
1493
|
+
initialSessionId = null,
|
|
1494
|
+
basePath = "/chat"
|
|
1493
1495
|
}) {
|
|
1494
1496
|
const router = useRouter();
|
|
1495
1497
|
const [sessions, setSessions] = useState([]);
|
|
@@ -1720,9 +1722,9 @@ function VercelChat({
|
|
|
1720
1722
|
}, [answers.length]);
|
|
1721
1723
|
const syncUrl = useCallback(
|
|
1722
1724
|
(id) => {
|
|
1723
|
-
router.push(id == null ?
|
|
1725
|
+
router.push(id == null ? basePath : `${basePath}/${id}`);
|
|
1724
1726
|
},
|
|
1725
|
-
[router]
|
|
1727
|
+
[router, basePath]
|
|
1726
1728
|
);
|
|
1727
1729
|
const newChat = useCallback(() => {
|
|
1728
1730
|
setActiveSessionId(null);
|
|
@@ -1732,8 +1734,8 @@ function VercelChat({
|
|
|
1732
1734
|
setHydratedErrors({});
|
|
1733
1735
|
setStartedAt({});
|
|
1734
1736
|
setInput("");
|
|
1735
|
-
router.push(
|
|
1736
|
-
}, [setMessages, setInput, router]);
|
|
1737
|
+
router.push(`${basePath}?new`);
|
|
1738
|
+
}, [setMessages, setInput, router, basePath]);
|
|
1737
1739
|
const changeProvider = useCallback(
|
|
1738
1740
|
async (next) => {
|
|
1739
1741
|
if (next === provider || providerSaving) return;
|
|
@@ -1963,7 +1965,7 @@ function VercelChat({
|
|
|
1963
1965
|
/* @__PURE__ */ jsx(
|
|
1964
1966
|
Link,
|
|
1965
1967
|
{
|
|
1966
|
-
href:
|
|
1968
|
+
href: `${basePath}/${s.id}`,
|
|
1967
1969
|
onClick: () => setSidebarOpen(false),
|
|
1968
1970
|
className: cn(
|
|
1969
1971
|
"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm",
|