@assistant-ui/react 0.8.0 → 0.8.2
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/cloud/auiV0.d.ts +6 -0
- package/dist/cloud/auiV0.d.ts.map +1 -1
- package/dist/cloud/auiV0.js +2 -0
- package/dist/cloud/auiV0.js.map +1 -1
- package/dist/cloud/auiV0.mjs +2 -0
- package/dist/cloud/auiV0.mjs.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts +3 -2
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +5 -1
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageContent.mjs +5 -1
- package/dist/primitives/message/MessageContent.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js +2 -1
- package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs +2 -1
- package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js +2 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +2 -1
- package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts +8 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.js +1 -0
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.js.map +1 -1
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs +1 -0
- package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.js +6 -0
- package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +6 -0
- package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.js +6 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +1 -1
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +6 -0
- package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.js +17 -0
- package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/runResultStream.mjs +17 -0
- package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.d.ts +8 -0
- package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.js +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
- package/dist/runtimes/edge/streams/toolResultStream.mjs +1 -0
- package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts +2 -2
- package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.js +2 -0
- package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
- package/dist/runtimes/external-store/ThreadMessageLike.mjs +2 -0
- package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.d.ts +2 -2
- package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
- package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.d.ts.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.js +1 -7
- package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs +1 -7
- package/dist/runtimes/remote-thread-list/adapter/cloud.mjs.map +1 -1
- package/dist/types/AssistantTypes.d.ts +9 -1
- package/dist/types/AssistantTypes.d.ts.map +1 -1
- package/dist/types/AssistantTypes.js.map +1 -1
- package/dist/types/ContentPartComponentTypes.d.ts +3 -1
- package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
- package/dist/types/ContentPartComponentTypes.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cloud/auiV0.ts +10 -0
- package/src/primitives/message/MessageContent.tsx +10 -2
- package/src/runtimes/edge/converters/toCoreMessages.ts +2 -1
- package/src/runtimes/edge/converters/toLanguageModelMessages.ts +3 -2
- package/src/runtimes/edge/streams/AssistantStreamChunkType.ts +7 -0
- package/src/runtimes/edge/streams/assistantDecoderStream.ts +7 -0
- package/src/runtimes/edge/streams/assistantEncoderStream.ts +7 -0
- package/src/runtimes/edge/streams/runResultStream.ts +25 -3
- package/src/runtimes/edge/streams/toolResultStream.ts +10 -0
- package/src/runtimes/external-store/ThreadMessageLike.tsx +10 -2
- package/src/runtimes/local/ChatModelAdapter.tsx +7 -1
- package/src/runtimes/remote-thread-list/adapter/cloud.tsx +4 -13
- package/src/types/AssistantTypes.ts +11 -2
- package/src/types/ContentPartComponentTypes.tsx +4 -0
- package/src/types/index.ts +3 -0
@@ -13,7 +13,11 @@ import {
|
|
13
13
|
FileContentPart,
|
14
14
|
Unstable_AudioContentPart,
|
15
15
|
} from "../../types";
|
16
|
-
import {
|
16
|
+
import {
|
17
|
+
ReasoningContentPart,
|
18
|
+
SourceContentPart,
|
19
|
+
ThreadStep,
|
20
|
+
} from "../../types/AssistantTypes";
|
17
21
|
import {
|
18
22
|
ReadonlyJSONObject,
|
19
23
|
ReadonlyJSONValue,
|
@@ -27,6 +31,7 @@ export type ThreadMessageLike = {
|
|
27
31
|
| readonly (
|
28
32
|
| TextContentPart
|
29
33
|
| ReasoningContentPart
|
34
|
+
| SourceContentPart
|
30
35
|
| ImageContentPart
|
31
36
|
| FileContentPart
|
32
37
|
| Unstable_AudioContentPart
|
@@ -95,6 +100,9 @@ export const fromThreadMessageLike = (
|
|
95
100
|
if (part.text.trim().length === 0) return null;
|
96
101
|
return part;
|
97
102
|
|
103
|
+
case "source":
|
104
|
+
return part;
|
105
|
+
|
98
106
|
case "tool-call": {
|
99
107
|
if (part.args) {
|
100
108
|
return {
|
@@ -144,7 +152,7 @@ export const fromThreadMessageLike = (
|
|
144
152
|
return part;
|
145
153
|
|
146
154
|
default: {
|
147
|
-
const unhandledType: "tool-call" | "reasoning" = type;
|
155
|
+
const unhandledType: "tool-call" | "reasoning" | "source" = type;
|
148
156
|
throw new Error(
|
149
157
|
`Unsupported user content part type: ${unhandledType}`,
|
150
158
|
);
|
@@ -2,6 +2,7 @@ import type {
|
|
2
2
|
MessageStatus,
|
3
3
|
ReasoningContentPart,
|
4
4
|
RunConfig,
|
5
|
+
SourceContentPart,
|
5
6
|
TextContentPart,
|
6
7
|
ThreadAssistantContentPart,
|
7
8
|
ThreadMessage,
|
@@ -28,7 +29,12 @@ export type ChatModelRunResult = {
|
|
28
29
|
};
|
29
30
|
|
30
31
|
export type CoreChatModelRunResult = Omit<ChatModelRunResult, "content"> & {
|
31
|
-
readonly content: readonly (
|
32
|
+
readonly content: readonly (
|
33
|
+
| TextContentPart
|
34
|
+
| ReasoningContentPart
|
35
|
+
| ToolCallContentPart
|
36
|
+
| SourceContentPart
|
37
|
+
)[];
|
32
38
|
};
|
33
39
|
|
34
40
|
export type ChatModelRunOptions = {
|
@@ -16,6 +16,7 @@ import { InMemoryThreadListAdapter } from "./in-memory";
|
|
16
16
|
type ThreadData = {
|
17
17
|
externalId: string;
|
18
18
|
};
|
19
|
+
|
19
20
|
type CloudThreadListAdapterOptions = {
|
20
21
|
cloud?: AssistantCloud | undefined;
|
21
22
|
|
@@ -23,19 +24,9 @@ type CloudThreadListAdapterOptions = {
|
|
23
24
|
delete?(threadId: string): Promise<void>;
|
24
25
|
};
|
25
26
|
|
26
|
-
const
|
27
|
-
|
28
|
-
|
29
|
-
process.env &&
|
30
|
-
typeof process.env[name] === "string"
|
31
|
-
) {
|
32
|
-
return process.env[name];
|
33
|
-
}
|
34
|
-
|
35
|
-
return undefined;
|
36
|
-
};
|
37
|
-
|
38
|
-
const baseUrl = getEnvVariable("NEXT_PUBLIC_ASSISTANT_BASE_URL");
|
27
|
+
const baseUrl =
|
28
|
+
typeof process !== "undefined" &&
|
29
|
+
process?.env?.["NEXT_PUBLIC_ASSISTANT_BASE_URL"];
|
39
30
|
const autoCloud = baseUrl
|
40
31
|
? new AssistantCloud({ baseUrl, anonymous: true })
|
41
32
|
: undefined;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
import { CompleteAttachment } from "./AttachmentTypes";
|
3
2
|
import {
|
4
3
|
ReadonlyJSONObject,
|
@@ -17,6 +16,14 @@ export type ReasoningContentPart = {
|
|
17
16
|
readonly text: string;
|
18
17
|
};
|
19
18
|
|
19
|
+
export type SourceContentPart = {
|
20
|
+
readonly type: "source";
|
21
|
+
readonly sourceType: "url";
|
22
|
+
readonly id: string;
|
23
|
+
readonly url: string;
|
24
|
+
readonly title?: string;
|
25
|
+
};
|
26
|
+
|
20
27
|
export type ImageContentPart = {
|
21
28
|
readonly type: "image";
|
22
29
|
readonly image: string;
|
@@ -103,7 +110,8 @@ export type ThreadUserContentPart =
|
|
103
110
|
export type ThreadAssistantContentPart =
|
104
111
|
| TextContentPart
|
105
112
|
| ReasoningContentPart
|
106
|
-
| ToolCallContentPart
|
113
|
+
| ToolCallContentPart
|
114
|
+
| SourceContentPart;
|
107
115
|
|
108
116
|
type MessageCommonProps = {
|
109
117
|
readonly id: string;
|
@@ -111,6 +119,7 @@ type MessageCommonProps = {
|
|
111
119
|
};
|
112
120
|
|
113
121
|
export type ThreadStep = {
|
122
|
+
readonly messageId?: string;
|
114
123
|
readonly usage?:
|
115
124
|
| {
|
116
125
|
readonly promptTokens: number;
|
@@ -4,6 +4,7 @@ import type {
|
|
4
4
|
FileContentPart,
|
5
5
|
ImageContentPart,
|
6
6
|
ReasoningContentPart,
|
7
|
+
SourceContentPart,
|
7
8
|
TextContentPart,
|
8
9
|
ToolCallContentPart,
|
9
10
|
Unstable_AudioContentPart,
|
@@ -22,6 +23,9 @@ export type ReasoningContentPartProps = ContentPartState & ReasoningContentPart;
|
|
22
23
|
export type ReasoningContentPartComponent =
|
23
24
|
ComponentType<ReasoningContentPartProps>;
|
24
25
|
|
26
|
+
export type SourceContentPartProps = ContentPartState & SourceContentPart;
|
27
|
+
export type SourceContentPartComponent = ComponentType<SourceContentPartProps>;
|
28
|
+
|
25
29
|
export type ImageContentPartProps = ContentPartState & ImageContentPart;
|
26
30
|
export type ImageContentPartComponent = ComponentType<ImageContentPartProps>;
|
27
31
|
|
package/src/types/index.ts
CHANGED
@@ -9,6 +9,7 @@ export type {
|
|
9
9
|
AppendMessage,
|
10
10
|
TextContentPart,
|
11
11
|
ReasoningContentPart,
|
12
|
+
SourceContentPart,
|
12
13
|
ImageContentPart,
|
13
14
|
FileContentPart,
|
14
15
|
Unstable_AudioContentPart,
|
@@ -40,6 +41,8 @@ export type {
|
|
40
41
|
TextContentPartComponent,
|
41
42
|
ReasoningContentPartProps,
|
42
43
|
ReasoningContentPartComponent,
|
44
|
+
SourceContentPartProps,
|
45
|
+
SourceContentPartComponent,
|
43
46
|
ImageContentPartProps,
|
44
47
|
ImageContentPartComponent,
|
45
48
|
FileContentPartProps,
|