ai 2.1.13 → 2.1.14
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/package.json +1 -1
- package/react/dist/index.js +4 -2
- package/react/dist/index.mjs +6 -4
- package/svelte/dist/index.js +4 -2
- package/svelte/dist/index.mjs +4 -2
- package/vue/dist/index.js +4 -2
- package/vue/dist/index.mjs +4 -2
package/package.json
CHANGED
package/react/dist/index.js
CHANGED
@@ -185,7 +185,8 @@ function useChat({
|
|
185
185
|
headers,
|
186
186
|
body
|
187
187
|
} = {}) {
|
188
|
-
const
|
188
|
+
const hookId = (0, import_react.useId)();
|
189
|
+
const chatId = id || hookId;
|
189
190
|
const { data, mutate } = (0, import_swr.default)([api, chatId], null, {
|
190
191
|
fallbackData: initialMessages
|
191
192
|
});
|
@@ -359,7 +360,8 @@ function useCompletion({
|
|
359
360
|
onFinish,
|
360
361
|
onError
|
361
362
|
} = {}) {
|
362
|
-
const
|
363
|
+
const hookId = (0, import_react2.useId)();
|
364
|
+
const completionId = id || hookId;
|
363
365
|
const { data, mutate } = (0, import_swr2.default)([api, completionId], null, {
|
364
366
|
fallbackData: initialCompletion
|
365
367
|
});
|
package/react/dist/index.mjs
CHANGED
@@ -37,7 +37,7 @@ var __async = (__this, __arguments, generator) => {
|
|
37
37
|
};
|
38
38
|
|
39
39
|
// react/use-chat.ts
|
40
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
40
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
41
41
|
import useSWRMutation from "swr/mutation";
|
42
42
|
import useSWR from "swr";
|
43
43
|
|
@@ -151,7 +151,8 @@ function useChat({
|
|
151
151
|
headers,
|
152
152
|
body
|
153
153
|
} = {}) {
|
154
|
-
const
|
154
|
+
const hookId = useId();
|
155
|
+
const chatId = id || hookId;
|
155
156
|
const { data, mutate } = useSWR([api, chatId], null, {
|
156
157
|
fallbackData: initialMessages
|
157
158
|
});
|
@@ -310,7 +311,7 @@ function useChat({
|
|
310
311
|
}
|
311
312
|
|
312
313
|
// react/use-completion.ts
|
313
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
314
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useId as useId2, useRef as useRef2, useState as useState2 } from "react";
|
314
315
|
import useSWRMutation2 from "swr/mutation";
|
315
316
|
import useSWR2 from "swr";
|
316
317
|
function useCompletion({
|
@@ -325,7 +326,8 @@ function useCompletion({
|
|
325
326
|
onFinish,
|
326
327
|
onError
|
327
328
|
} = {}) {
|
328
|
-
const
|
329
|
+
const hookId = useId2();
|
330
|
+
const completionId = id || hookId;
|
329
331
|
const { data, mutate } = useSWR2([api, completionId], null, {
|
330
332
|
fallbackData: initialCompletion
|
331
333
|
});
|
package/svelte/dist/index.js
CHANGED
@@ -516,6 +516,7 @@ function createChunkDecoder() {
|
|
516
516
|
}
|
517
517
|
|
518
518
|
// svelte/use-chat.ts
|
519
|
+
var uniqueId = 0;
|
519
520
|
var store = {};
|
520
521
|
function useChat({
|
521
522
|
api = "/api/chat",
|
@@ -530,7 +531,7 @@ function useChat({
|
|
530
531
|
headers,
|
531
532
|
body
|
532
533
|
} = {}) {
|
533
|
-
const chatId = id || `chat-${
|
534
|
+
const chatId = id || `chat-${uniqueId++}`;
|
534
535
|
const key = `${api}|${chatId}`;
|
535
536
|
const { data, mutate: originalMutate } = $(key, {
|
536
537
|
fetcher: () => store[key] || initialMessages,
|
@@ -685,6 +686,7 @@ function useChat({
|
|
685
686
|
|
686
687
|
// svelte/use-completion.ts
|
687
688
|
var import_store2 = require("svelte/store");
|
689
|
+
var uniqueId2 = 0;
|
688
690
|
var store2 = {};
|
689
691
|
function useCompletion({
|
690
692
|
api = "/api/completion",
|
@@ -698,7 +700,7 @@ function useCompletion({
|
|
698
700
|
onFinish,
|
699
701
|
onError
|
700
702
|
} = {}) {
|
701
|
-
const completionId = id || `completion-${
|
703
|
+
const completionId = id || `completion-${uniqueId2++}`;
|
702
704
|
const key = `${api}|${completionId}`;
|
703
705
|
const { data, mutate: originalMutate } = $(key, {
|
704
706
|
fetcher: () => store2[key] || initialCompletion,
|
package/svelte/dist/index.mjs
CHANGED
@@ -492,6 +492,7 @@ function createChunkDecoder() {
|
|
492
492
|
}
|
493
493
|
|
494
494
|
// svelte/use-chat.ts
|
495
|
+
var uniqueId = 0;
|
495
496
|
var store = {};
|
496
497
|
function useChat({
|
497
498
|
api = "/api/chat",
|
@@ -506,7 +507,7 @@ function useChat({
|
|
506
507
|
headers,
|
507
508
|
body
|
508
509
|
} = {}) {
|
509
|
-
const chatId = id || `chat-${
|
510
|
+
const chatId = id || `chat-${uniqueId++}`;
|
510
511
|
const key = `${api}|${chatId}`;
|
511
512
|
const { data, mutate: originalMutate } = $(key, {
|
512
513
|
fetcher: () => store[key] || initialMessages,
|
@@ -661,6 +662,7 @@ function useChat({
|
|
661
662
|
|
662
663
|
// svelte/use-completion.ts
|
663
664
|
import { get as get2, writable as writable2 } from "svelte/store";
|
665
|
+
var uniqueId2 = 0;
|
664
666
|
var store2 = {};
|
665
667
|
function useCompletion({
|
666
668
|
api = "/api/completion",
|
@@ -674,7 +676,7 @@ function useCompletion({
|
|
674
676
|
onFinish,
|
675
677
|
onError
|
676
678
|
} = {}) {
|
677
|
-
const completionId = id || `completion-${
|
679
|
+
const completionId = id || `completion-${uniqueId2++}`;
|
678
680
|
const key = `${api}|${completionId}`;
|
679
681
|
const { data, mutate: originalMutate } = $(key, {
|
680
682
|
fetcher: () => store2[key] || initialCompletion,
|
package/vue/dist/index.js
CHANGED
@@ -89,6 +89,7 @@ function createChunkDecoder() {
|
|
89
89
|
}
|
90
90
|
|
91
91
|
// vue/use-chat.ts
|
92
|
+
var uniqueId = 0;
|
92
93
|
var useSWRV = import_swrv.default.default || import_swrv.default;
|
93
94
|
var store = {};
|
94
95
|
function useChat({
|
@@ -104,7 +105,7 @@ function useChat({
|
|
104
105
|
headers,
|
105
106
|
body
|
106
107
|
} = {}) {
|
107
|
-
const chatId = id || `chat-${
|
108
|
+
const chatId = id || `chat-${uniqueId++}`;
|
108
109
|
const key = `${api}|${chatId}`;
|
109
110
|
const { data, mutate: originalMutate } = useSWRV(
|
110
111
|
key,
|
@@ -259,6 +260,7 @@ function useChat({
|
|
259
260
|
// vue/use-completion.ts
|
260
261
|
var import_swrv2 = __toESM(require("swrv"));
|
261
262
|
var import_vue2 = require("vue");
|
263
|
+
var uniqueId2 = 0;
|
262
264
|
var useSWRV2 = import_swrv2.default.default || import_swrv2.default;
|
263
265
|
var store2 = {};
|
264
266
|
function useCompletion({
|
@@ -273,7 +275,7 @@ function useCompletion({
|
|
273
275
|
onFinish,
|
274
276
|
onError
|
275
277
|
} = {}) {
|
276
|
-
const completionId = id || `completion-${
|
278
|
+
const completionId = id || `completion-${uniqueId2++}`;
|
277
279
|
const key = `${api}|${completionId}`;
|
278
280
|
const { data, mutate: originalMutate } = useSWRV2(
|
279
281
|
key,
|
package/vue/dist/index.mjs
CHANGED
@@ -55,6 +55,7 @@ function createChunkDecoder() {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
// vue/use-chat.ts
|
58
|
+
var uniqueId = 0;
|
58
59
|
var useSWRV = swrv.default || swrv;
|
59
60
|
var store = {};
|
60
61
|
function useChat({
|
@@ -70,7 +71,7 @@ function useChat({
|
|
70
71
|
headers,
|
71
72
|
body
|
72
73
|
} = {}) {
|
73
|
-
const chatId = id || `chat-${
|
74
|
+
const chatId = id || `chat-${uniqueId++}`;
|
74
75
|
const key = `${api}|${chatId}`;
|
75
76
|
const { data, mutate: originalMutate } = useSWRV(
|
76
77
|
key,
|
@@ -225,6 +226,7 @@ function useChat({
|
|
225
226
|
// vue/use-completion.ts
|
226
227
|
import swrv2 from "swrv";
|
227
228
|
import { ref as ref2 } from "vue";
|
229
|
+
var uniqueId2 = 0;
|
228
230
|
var useSWRV2 = swrv2.default || swrv2;
|
229
231
|
var store2 = {};
|
230
232
|
function useCompletion({
|
@@ -239,7 +241,7 @@ function useCompletion({
|
|
239
241
|
onFinish,
|
240
242
|
onError
|
241
243
|
} = {}) {
|
242
|
-
const completionId = id || `completion-${
|
244
|
+
const completionId = id || `completion-${uniqueId2++}`;
|
243
245
|
const key = `${api}|${completionId}`;
|
244
246
|
const { data, mutate: originalMutate } = useSWRV2(
|
245
247
|
key,
|