@assistant-ui/react 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -20
- package/dist/index.mjs +3 -18
- package/package.json +7 -3
package/dist/index.d.mts
CHANGED
@@ -256,24 +256,24 @@ declare namespace index {
|
|
256
256
|
export { ActionBarCopy as Copy, ActionBarEdit as Edit, ActionBarReload as Reload, ActionBarRoot as Root };
|
257
257
|
}
|
258
258
|
|
259
|
-
type VercelAIAssistantProviderProps
|
259
|
+
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
260
260
|
chat: UseChatHelpers;
|
261
261
|
} | {
|
262
262
|
assistant: UseAssistantHelpers;
|
263
263
|
}>;
|
264
|
-
declare const VercelAIAssistantProvider: FC<VercelAIAssistantProviderProps
|
264
|
+
declare const VercelAIAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
265
265
|
|
266
|
-
type
|
266
|
+
type VercelRSCMessage = {
|
267
267
|
id: string;
|
268
268
|
role: "user" | "assistant";
|
269
269
|
display: ReactNode;
|
270
270
|
createdAt?: Date;
|
271
271
|
};
|
272
|
-
type
|
273
|
-
messages:
|
272
|
+
type VercelRSCAssistantProviderProps = PropsWithChildren<{
|
273
|
+
messages: VercelRSCMessage[];
|
274
274
|
append: (message: CreateThreadMessage) => Promise<void>;
|
275
275
|
}>;
|
276
|
-
declare const VercelRSCAssistantProvider: FC<
|
276
|
+
declare const VercelRSCAssistantProvider: FC<VercelRSCAssistantProviderProps>;
|
277
277
|
|
278
278
|
type MessageState = {
|
279
279
|
message: ThreadMessage;
|
@@ -303,4 +303,4 @@ declare const useGoToNextBranch: () => (() => void) | null;
|
|
303
303
|
|
304
304
|
declare const useGoToPreviousBranch: () => (() => void) | null;
|
305
305
|
|
306
|
-
export { index as ActionBarPrimitive, index$1 as BranchPickerPrimitive, index$3 as ComposerPrimitive, index$2 as MessagePrimitive, index$4 as ThreadPrimitive, VercelAIAssistantProvider, VercelRSCAssistantProvider
|
306
|
+
export { index as ActionBarPrimitive, index$1 as BranchPickerPrimitive, index$3 as ComposerPrimitive, type CreateThreadMessage, type CreateThreadUserMessageContent, index$2 as MessagePrimitive, type VercelRSCMessage as RSCMessage, type ThreadMessageImagePart, type ThreadMessageTextPart, index$4 as ThreadPrimitive, VercelAIAssistantProvider, type VercelAIAssistantProviderProps, VercelRSCAssistantProvider, type VercelRSCAssistantProviderProps, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage };
|
package/dist/index.d.ts
CHANGED
@@ -256,24 +256,24 @@ declare namespace index {
|
|
256
256
|
export { ActionBarCopy as Copy, ActionBarEdit as Edit, ActionBarReload as Reload, ActionBarRoot as Root };
|
257
257
|
}
|
258
258
|
|
259
|
-
type VercelAIAssistantProviderProps
|
259
|
+
type VercelAIAssistantProviderProps = PropsWithChildren<{
|
260
260
|
chat: UseChatHelpers;
|
261
261
|
} | {
|
262
262
|
assistant: UseAssistantHelpers;
|
263
263
|
}>;
|
264
|
-
declare const VercelAIAssistantProvider: FC<VercelAIAssistantProviderProps
|
264
|
+
declare const VercelAIAssistantProvider: FC<VercelAIAssistantProviderProps>;
|
265
265
|
|
266
|
-
type
|
266
|
+
type VercelRSCMessage = {
|
267
267
|
id: string;
|
268
268
|
role: "user" | "assistant";
|
269
269
|
display: ReactNode;
|
270
270
|
createdAt?: Date;
|
271
271
|
};
|
272
|
-
type
|
273
|
-
messages:
|
272
|
+
type VercelRSCAssistantProviderProps = PropsWithChildren<{
|
273
|
+
messages: VercelRSCMessage[];
|
274
274
|
append: (message: CreateThreadMessage) => Promise<void>;
|
275
275
|
}>;
|
276
|
-
declare const VercelRSCAssistantProvider: FC<
|
276
|
+
declare const VercelRSCAssistantProvider: FC<VercelRSCAssistantProviderProps>;
|
277
277
|
|
278
278
|
type MessageState = {
|
279
279
|
message: ThreadMessage;
|
@@ -303,4 +303,4 @@ declare const useGoToNextBranch: () => (() => void) | null;
|
|
303
303
|
|
304
304
|
declare const useGoToPreviousBranch: () => (() => void) | null;
|
305
305
|
|
306
|
-
export { index as ActionBarPrimitive, index$1 as BranchPickerPrimitive, index$3 as ComposerPrimitive, index$2 as MessagePrimitive, index$4 as ThreadPrimitive, VercelAIAssistantProvider, VercelRSCAssistantProvider
|
306
|
+
export { index as ActionBarPrimitive, index$1 as BranchPickerPrimitive, index$3 as ComposerPrimitive, type CreateThreadMessage, type CreateThreadUserMessageContent, index$2 as MessagePrimitive, type VercelRSCMessage as RSCMessage, type ThreadMessageImagePart, type ThreadMessageTextPart, index$4 as ThreadPrimitive, VercelAIAssistantProvider, type VercelAIAssistantProviderProps, VercelRSCAssistantProvider, type VercelRSCAssistantProviderProps, useMessageContext as unstable_useMessageContext, useBeginMessageEdit, useCopyMessage, useGoToNextBranch, useGoToPreviousBranch, useReloadMessage };
|
package/dist/index.js
CHANGED
@@ -36,7 +36,7 @@ __export(src_exports, {
|
|
36
36
|
MessagePrimitive: () => message_exports,
|
37
37
|
ThreadPrimitive: () => thread_exports,
|
38
38
|
VercelAIAssistantProvider: () => VercelAIAssistantProvider,
|
39
|
-
|
39
|
+
VercelRSCAssistantProvider: () => VercelRSCAssistantProvider,
|
40
40
|
unstable_useMessageContext: () => useMessageContext,
|
41
41
|
useBeginMessageEdit: () => useBeginMessageEdit,
|
42
42
|
useCopyMessage: () => useCopyMessage,
|
@@ -970,20 +970,9 @@ var useDummyAIAssistantContext = () => {
|
|
970
970
|
// src/adapters/vercel/useVercelAIBranches.tsx
|
971
971
|
var import_react21 = require("react");
|
972
972
|
|
973
|
-
// ../../node_modules/nanoid/non-secure/index.js
|
974
|
-
var customAlphabet = (alphabet, defaultSize = 21) => {
|
975
|
-
return (size = defaultSize) => {
|
976
|
-
let id = "";
|
977
|
-
let i = size;
|
978
|
-
while (i--) {
|
979
|
-
id += alphabet[Math.random() * alphabet.length | 0];
|
980
|
-
}
|
981
|
-
return id;
|
982
|
-
};
|
983
|
-
};
|
984
|
-
|
985
973
|
// src/adapters/MessageRepository.tsx
|
986
|
-
var
|
974
|
+
var import_non_secure = require("nanoid/non-secure");
|
975
|
+
var generateId = (0, import_non_secure.customAlphabet)(
|
987
976
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
988
977
|
7
|
989
978
|
);
|
@@ -1304,11 +1293,7 @@ var vercelToCachedThreadMessages2 = (messages) => {
|
|
1304
1293
|
return newMessage;
|
1305
1294
|
});
|
1306
1295
|
};
|
1307
|
-
var VercelRSCAssistantProvider = ({
|
1308
|
-
children,
|
1309
|
-
messages: vercelMessages,
|
1310
|
-
append: vercelAppend
|
1311
|
-
}) => {
|
1296
|
+
var VercelRSCAssistantProvider = ({ children, messages: vercelMessages, append: vercelAppend }) => {
|
1312
1297
|
const context = useDummyAIAssistantContext();
|
1313
1298
|
const messages = (0, import_react23.useMemo)(() => {
|
1314
1299
|
return vercelToCachedThreadMessages2(vercelMessages);
|
@@ -1340,7 +1325,7 @@ var VercelRSCAssistantProvider = ({
|
|
1340
1325
|
MessagePrimitive,
|
1341
1326
|
ThreadPrimitive,
|
1342
1327
|
VercelAIAssistantProvider,
|
1343
|
-
|
1328
|
+
VercelRSCAssistantProvider,
|
1344
1329
|
unstable_useMessageContext,
|
1345
1330
|
useBeginMessageEdit,
|
1346
1331
|
useCopyMessage,
|
package/dist/index.mjs
CHANGED
@@ -955,19 +955,8 @@ var useDummyAIAssistantContext = () => {
|
|
955
955
|
// src/adapters/vercel/useVercelAIBranches.tsx
|
956
956
|
import { useCallback as useCallback2, useMemo as useMemo3, useRef as useRef6, useState as useState3 } from "react";
|
957
957
|
|
958
|
-
// ../../node_modules/nanoid/non-secure/index.js
|
959
|
-
var customAlphabet = (alphabet, defaultSize = 21) => {
|
960
|
-
return (size = defaultSize) => {
|
961
|
-
let id = "";
|
962
|
-
let i = size;
|
963
|
-
while (i--) {
|
964
|
-
id += alphabet[Math.random() * alphabet.length | 0];
|
965
|
-
}
|
966
|
-
return id;
|
967
|
-
};
|
968
|
-
};
|
969
|
-
|
970
958
|
// src/adapters/MessageRepository.tsx
|
959
|
+
import { customAlphabet } from "nanoid/non-secure";
|
971
960
|
var generateId = customAlphabet(
|
972
961
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
973
962
|
7
|
@@ -1292,11 +1281,7 @@ var vercelToCachedThreadMessages2 = (messages) => {
|
|
1292
1281
|
return newMessage;
|
1293
1282
|
});
|
1294
1283
|
};
|
1295
|
-
var VercelRSCAssistantProvider = ({
|
1296
|
-
children,
|
1297
|
-
messages: vercelMessages,
|
1298
|
-
append: vercelAppend
|
1299
|
-
}) => {
|
1284
|
+
var VercelRSCAssistantProvider = ({ children, messages: vercelMessages, append: vercelAppend }) => {
|
1300
1285
|
const context = useDummyAIAssistantContext();
|
1301
1286
|
const messages = useMemo5(() => {
|
1302
1287
|
return vercelToCachedThreadMessages2(vercelMessages);
|
@@ -1327,7 +1312,7 @@ export {
|
|
1327
1312
|
message_exports as MessagePrimitive,
|
1328
1313
|
thread_exports as ThreadPrimitive,
|
1329
1314
|
VercelAIAssistantProvider,
|
1330
|
-
VercelRSCAssistantProvider
|
1315
|
+
VercelRSCAssistantProvider,
|
1331
1316
|
useMessageContext as unstable_useMessageContext,
|
1332
1317
|
useBeginMessageEdit,
|
1333
1318
|
useCopyMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@assistant-ui/react",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.12",
|
4
4
|
"license": "MIT",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
@@ -18,7 +18,10 @@
|
|
18
18
|
"main": "./dist/index.js",
|
19
19
|
"module": "./dist/index.mjs",
|
20
20
|
"types": "./dist/index.d.ts",
|
21
|
-
"files": [
|
21
|
+
"files": [
|
22
|
+
"dist",
|
23
|
+
"README.md"
|
24
|
+
],
|
22
25
|
"sideEffects": false,
|
23
26
|
"scripts": {
|
24
27
|
"build": "tsup src/index.ts --format cjs,esm --dts"
|
@@ -28,7 +31,8 @@
|
|
28
31
|
"@radix-ui/react-compose-refs": "^1.0.1",
|
29
32
|
"@radix-ui/react-primitive": "^1.0.3",
|
30
33
|
"@radix-ui/react-slot": "^1.0.2",
|
31
|
-
"ai": "^3.1.
|
34
|
+
"ai": "^3.1.22",
|
35
|
+
"nanoid": "^5.0.7",
|
32
36
|
"react-textarea-autosize": "^8.5.3",
|
33
37
|
"zustand": "^4.5.2"
|
34
38
|
},
|