@apia/ai 3.0.12 → 3.0.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/dist/index.d.ts +75 -28
- package/dist/index.js +570 -321
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,97 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { ReactNode, FC, ReactElement } from 'react';
|
|
3
|
+
import * as _apia_util from '@apia/util';
|
|
3
4
|
import { EventEmitter } from '@apia/util';
|
|
4
5
|
|
|
6
|
+
declare const AutoscrollContainer: ({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => react.JSX.Element;
|
|
9
|
+
|
|
10
|
+
declare enum AIMessageRole {
|
|
11
|
+
USER = "USER",
|
|
12
|
+
SYSTEM = "SYSTEM"
|
|
13
|
+
}
|
|
14
|
+
interface Reactive {
|
|
15
|
+
Component: FC<any>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class AIContent implements Reactive {
|
|
19
|
+
protected content: ReactNode;
|
|
20
|
+
constructor(content: ReactNode);
|
|
21
|
+
Component: () => react.JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class AIMessageAttachments implements Reactive {
|
|
25
|
+
private close?;
|
|
26
|
+
role: AIMessageRole;
|
|
27
|
+
content: AIContent;
|
|
28
|
+
id: string;
|
|
29
|
+
constructor(role: AIMessageRole, content: AIContent, close?: (() => void) | undefined);
|
|
30
|
+
Component: (props: {
|
|
31
|
+
closeButton?: boolean;
|
|
32
|
+
}) => react.JSX.Element;
|
|
33
|
+
}
|
|
34
|
+
|
|
5
35
|
declare class ChatMessage {
|
|
6
|
-
|
|
36
|
+
message: ReactNode;
|
|
7
37
|
messageType: TMessageType;
|
|
38
|
+
attachments: AIMessageAttachments[];
|
|
8
39
|
id: number;
|
|
9
40
|
parseMessage(message: string): string;
|
|
10
|
-
constructor(message
|
|
11
|
-
|
|
41
|
+
constructor(message?: ReactNode, messageType?: TMessageType, attachments?: AIMessageAttachments[]);
|
|
42
|
+
copy: () => ChatMessage;
|
|
43
|
+
Component: () => react.JSX.Element;
|
|
12
44
|
}
|
|
13
45
|
|
|
14
|
-
type TMessageType = 'user' | 'system' | 'warning' | 'error' | 'information' | 'response' | 'multipleChoice';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
46
|
+
type TMessageType = 'user' | 'system' | 'warning' | 'error' | 'information' | 'response' | 'multipleChoice' | 'customMessage';
|
|
47
|
+
type ChatControllerState = {
|
|
48
|
+
current: ChatMessage;
|
|
49
|
+
messages: ChatMessage[];
|
|
50
|
+
};
|
|
51
|
+
declare class ChatController {
|
|
19
52
|
#private;
|
|
20
53
|
id: string;
|
|
54
|
+
state: ChatControllerState;
|
|
21
55
|
constructor(id: string, welcomeMessage?: string);
|
|
22
56
|
components: {
|
|
23
|
-
MessageHistory: () => react.JSX.Element
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
57
|
+
MessageHistory: (() => react.JSX.Element) & {
|
|
58
|
+
displayName: string;
|
|
59
|
+
};
|
|
60
|
+
Textarea: (({ hideDeleteButton, isLoading: outIsLoading, onSubmit, preventAppendUserMessages, }: {
|
|
61
|
+
hideDeleteButton?: boolean | undefined;
|
|
62
|
+
isLoading?: boolean | undefined;
|
|
63
|
+
onSubmit: (chatMessage: ChatMessage) => Promise<void>;
|
|
64
|
+
preventAppendUserMessages?: boolean | undefined;
|
|
65
|
+
}) => react.JSX.Element) & {
|
|
31
66
|
displayName: string;
|
|
32
67
|
};
|
|
33
68
|
};
|
|
69
|
+
currentHistoryIndex: number;
|
|
70
|
+
audioRecorder: {
|
|
71
|
+
start: () => Promise<void>;
|
|
72
|
+
stop: () => Promise<void>;
|
|
73
|
+
record: number;
|
|
74
|
+
state: _apia_util.AudioRecorderState;
|
|
75
|
+
};
|
|
34
76
|
history: {
|
|
35
|
-
add: (
|
|
36
|
-
next: () =>
|
|
37
|
-
previous: () =>
|
|
38
|
-
|
|
77
|
+
add: (message: ChatMessage) => void;
|
|
78
|
+
next: () => void;
|
|
79
|
+
previous: () => void;
|
|
80
|
+
updateState: (message?: ChatMessage) => void;
|
|
81
|
+
size: () => number;
|
|
39
82
|
};
|
|
40
83
|
messages: {
|
|
41
84
|
add: (message: ChatMessage, idx?: number) => void;
|
|
42
85
|
clear: () => void;
|
|
43
86
|
};
|
|
87
|
+
attachments: {
|
|
88
|
+
add: (...aiMessage: AIMessageAttachments[]) => void;
|
|
89
|
+
dropAll: () => undefined;
|
|
90
|
+
drop: (el: AIMessageAttachments) => void;
|
|
91
|
+
getComponents: () => react.JSX.Element[];
|
|
92
|
+
get: () => AIMessageAttachments[];
|
|
93
|
+
size: () => number;
|
|
94
|
+
};
|
|
44
95
|
}
|
|
45
96
|
|
|
46
97
|
type TMultipleChoiceMessageOption<OptionProps> = {
|
|
@@ -49,13 +100,9 @@ type TMultipleChoiceMessageOption<OptionProps> = {
|
|
|
49
100
|
additionalProps?: OptionProps;
|
|
50
101
|
};
|
|
51
102
|
declare class MultipleChoiceMessage<OptionProps> extends ChatMessage {
|
|
52
|
-
|
|
53
|
-
private options;
|
|
54
|
-
private Renderer?;
|
|
55
|
-
constructor(question: string, options: TMultipleChoiceMessageOption<OptionProps>[], Renderer?: ((props: {
|
|
103
|
+
constructor(question: string, options: TMultipleChoiceMessageOption<OptionProps>[], Renderer?: (props: {
|
|
56
104
|
item: TMultipleChoiceMessageOption<OptionProps>;
|
|
57
|
-
}) => ReactElement)
|
|
58
|
-
get message(): react.JSX.Element;
|
|
105
|
+
}) => ReactElement);
|
|
59
106
|
}
|
|
60
107
|
|
|
61
108
|
declare class ResponseStream extends EventEmitter<{
|
|
@@ -74,5 +121,5 @@ declare class ResponseStream extends EventEmitter<{
|
|
|
74
121
|
run(): void;
|
|
75
122
|
}
|
|
76
123
|
|
|
77
|
-
export { ChatController, ChatMessage, MultipleChoiceMessage, ResponseStream, type TMessageType, type TMultipleChoiceMessageOption };
|
|
124
|
+
export { AIMessageAttachments as AIMessage, AutoscrollContainer, ChatController, ChatMessage, MultipleChoiceMessage, ResponseStream, type TMessageType, type TMultipleChoiceMessageOption };
|
|
78
125
|
//# sourceMappingURL=index.d.ts.map
|