@apia/ai 4.0.15 → 4.0.17
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 +14 -252
- package/dist/index.js +45 -1750
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/index.ts/index.d.ts +0 -343
- package/index.ts/index.d.ts.map +0 -1
- package/index.ts/index.js +0 -1898
- package/index.ts/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,204 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { EventEmitter, AudioRecorder } from '@apia/util';
|
|
5
|
-
import { CollectorField } from '@apia/validations';
|
|
6
|
-
import { FilterDTO } from '@apia/components';
|
|
2
|
+
import { FC, ReactElement } from 'react';
|
|
3
|
+
import { FilterDTO, ChatMessage } from '@apia/components';
|
|
7
4
|
import { TActionDispatcher } from '@apia/dashboard-controller';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
declare const AutoscrollContainer: ({ children }: {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
}) => react.JSX.Element;
|
|
13
|
-
|
|
14
|
-
declare const AIFileContentAllowedExtensions: {
|
|
15
|
-
readonly svg: "svg";
|
|
16
|
-
readonly png: "png";
|
|
17
|
-
readonly jpg: "jpg";
|
|
18
|
-
readonly jpeg: "jpeg";
|
|
19
|
-
readonly txt: "txt";
|
|
20
|
-
readonly doc: "doc";
|
|
21
|
-
readonly pdf: "pdf";
|
|
22
|
-
readonly docx: "docx";
|
|
23
|
-
readonly csv: "csv";
|
|
24
|
-
readonly xlsx: "xlsx";
|
|
25
|
-
readonly xls: "xls";
|
|
26
|
-
readonly mp3: "mp3";
|
|
27
|
-
readonly wav: "wav";
|
|
28
|
-
};
|
|
29
|
-
type AIFileContentAllowedExtension = keyof typeof AIFileContentAllowedExtensions;
|
|
30
|
-
type TAttachmentErrorCallback = 'fileExtension' | 'blobGeneration';
|
|
31
|
-
declare enum FileType {
|
|
32
|
-
DOCUMENT = "DOCUMENT",
|
|
33
|
-
IMAGE = "IMAGE",
|
|
34
|
-
AUDIO = "AUDIO",
|
|
35
|
-
SHEET = "SHEET"
|
|
36
|
-
}
|
|
37
|
-
declare enum AIMessageRole {
|
|
38
|
-
USER = "USER",
|
|
39
|
-
SYSTEM = "SYSTEM"
|
|
40
|
-
}
|
|
41
|
-
interface Reactive {
|
|
42
|
-
Component: FC<any>;
|
|
43
|
-
}
|
|
44
|
-
interface Cloneable {
|
|
45
|
-
clone: () => Cloneable;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface IAttachment {
|
|
49
|
-
name: string;
|
|
50
|
-
id: string;
|
|
51
|
-
value: string;
|
|
52
|
-
}
|
|
53
|
-
type TChatControllerState = {
|
|
54
|
-
isVisible: boolean;
|
|
55
|
-
isLoading: boolean;
|
|
56
|
-
canRecord: boolean;
|
|
57
|
-
canAttach: boolean;
|
|
58
|
-
canAddSystemMessage: boolean;
|
|
59
|
-
canAddUserMessage: boolean;
|
|
60
|
-
hideDeleteButton: boolean;
|
|
61
|
-
maxAttachmentsSize: number;
|
|
62
|
-
messages: ChatMessage[];
|
|
63
|
-
currentMessage: ChatMessage;
|
|
64
|
-
};
|
|
65
|
-
type MessageCallback = (props: {
|
|
66
|
-
message: ChatMessage;
|
|
67
|
-
}) => Promise<any>;
|
|
68
|
-
declare class ChatController2 {
|
|
69
|
-
private onMessageSubmit;
|
|
70
|
-
id: string;
|
|
71
|
-
currentIndex: number;
|
|
72
|
-
state: TChatControllerState;
|
|
73
|
-
private internalAudioRecorder;
|
|
74
|
-
private internalCameraRecorder;
|
|
75
|
-
private maxId;
|
|
76
|
-
audioRecorder: {
|
|
77
|
-
start: () => void;
|
|
78
|
-
stop: () => Promise<void>;
|
|
79
|
-
record: number;
|
|
80
|
-
state: _apia_util.AudioRecorderState;
|
|
81
|
-
};
|
|
82
|
-
constructor(props: Partial<TChatControllerState>, onMessageSubmit: MessageCallback, id: string);
|
|
83
|
-
removeMessage(idx: number): void;
|
|
84
|
-
addMessage(message: ChatMessage): void;
|
|
85
|
-
clearHistory(): void;
|
|
86
|
-
clearMessage(): void;
|
|
87
|
-
removeAttachment(attachment: IAttachment): void;
|
|
88
|
-
nextMessage(): void;
|
|
89
|
-
prevMessage(): void;
|
|
90
|
-
History: (() => react.JSX.Element) & {
|
|
91
|
-
displayName: string;
|
|
92
|
-
};
|
|
93
|
-
Attachments: (() => react.JSX.Element) & {
|
|
94
|
-
displayName: string;
|
|
95
|
-
};
|
|
96
|
-
TextArea: (() => react.JSX.Element) & {
|
|
97
|
-
displayName: string;
|
|
98
|
-
};
|
|
99
|
-
Renderer: () => react.JSX.Element;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
declare class ChatMessage implements Reactive, Cloneable {
|
|
103
|
-
message: ReactNode;
|
|
104
|
-
messageType: TMessageType;
|
|
105
|
-
attachments: IAttachment[];
|
|
106
|
-
reference: ReactNode;
|
|
107
|
-
id: number;
|
|
108
|
-
parseMessage(message: string): string;
|
|
109
|
-
constructor(message?: ReactNode, messageType?: TMessageType, attachments?: IAttachment[], reference?: ReactNode);
|
|
110
|
-
clone: () => ChatMessage;
|
|
111
|
-
removeAttachment(idx: number): void;
|
|
112
|
-
Component: (({ className }: {
|
|
113
|
-
className?: string | undefined;
|
|
114
|
-
}) => react.JSX.Element) & {
|
|
115
|
-
displayName: string;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
declare class AIContent extends CollectorField implements Reactive {
|
|
120
|
-
type: string;
|
|
121
|
-
content: ReactNode;
|
|
122
|
-
constructor(content?: ReactNode);
|
|
123
|
-
Component: () => react.JSX.Element;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
declare class AIMessageAttachments implements Reactive {
|
|
127
|
-
private close?;
|
|
128
|
-
role: AIMessageRole;
|
|
129
|
-
content: AIContent;
|
|
130
|
-
id: string;
|
|
131
|
-
customDescription: boolean;
|
|
132
|
-
constructor(role: AIMessageRole, content: AIContent, close?: (() => void) | undefined);
|
|
133
|
-
addDescription: () => Promise<void>;
|
|
134
|
-
getId(): string;
|
|
135
|
-
Component: (props: {
|
|
136
|
-
closeButton?: boolean;
|
|
137
|
-
canAddDescription?: boolean;
|
|
138
|
-
}) => react.JSX.Element;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
type TMessageType = 'user' | 'system' | 'warning' | 'error' | 'information' | 'response' | 'multipleChoice' | 'customMessage';
|
|
142
|
-
type ChatControllerState = {
|
|
143
|
-
current: ChatMessage;
|
|
144
|
-
messages: ChatMessage[];
|
|
145
|
-
};
|
|
146
|
-
declare class ChatController {
|
|
147
|
-
#private;
|
|
148
|
-
id: string;
|
|
149
|
-
state: ChatControllerState;
|
|
150
|
-
constructor(id: string, welcomeMessage?: string);
|
|
151
|
-
components: {
|
|
152
|
-
MessageHistory: (() => react.JSX.Element) & {
|
|
153
|
-
displayName: string;
|
|
154
|
-
};
|
|
155
|
-
Textarea: (({ hideDeleteButton, isLoading: outIsLoading, onSubmit, preventAppendUserMessages, }: {
|
|
156
|
-
hideDeleteButton?: boolean | undefined;
|
|
157
|
-
isLoading?: boolean | undefined;
|
|
158
|
-
onSubmit: (chatMessage: ChatMessage) => Promise<void>;
|
|
159
|
-
preventAppendUserMessages?: boolean | undefined;
|
|
160
|
-
}) => react.JSX.Element) & {
|
|
161
|
-
displayName: string;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
currentHistoryIndex: number;
|
|
165
|
-
audioRecorder: {
|
|
166
|
-
start: () => Promise<void>;
|
|
167
|
-
stop: () => Promise<void>;
|
|
168
|
-
record: number;
|
|
169
|
-
state: _apia_util.AudioRecorderState;
|
|
170
|
-
};
|
|
171
|
-
history: {
|
|
172
|
-
add: (message: ChatMessage) => void;
|
|
173
|
-
next: () => void;
|
|
174
|
-
previous: () => void;
|
|
175
|
-
updateState: (message?: ChatMessage) => void;
|
|
176
|
-
size: () => number;
|
|
177
|
-
};
|
|
178
|
-
messages: {
|
|
179
|
-
add: (message: ChatMessage, idx?: number) => void;
|
|
180
|
-
clear: () => void;
|
|
181
|
-
};
|
|
182
|
-
attachments: {
|
|
183
|
-
add: (...aiMessage: AIMessageAttachments[]) => void;
|
|
184
|
-
dropAll: () => undefined;
|
|
185
|
-
drop: (el: AIMessageAttachments) => void;
|
|
186
|
-
getComponents: () => react.JSX.Element[];
|
|
187
|
-
get: () => IAttachment[];
|
|
188
|
-
size: () => number;
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
type TMultipleChoiceMessageOption<OptionProps> = {
|
|
193
|
-
label: string;
|
|
194
|
-
url: string;
|
|
195
|
-
additionalProps?: OptionProps;
|
|
196
|
-
};
|
|
197
|
-
declare class MultipleChoiceMessage<OptionProps> extends ChatMessage {
|
|
198
|
-
constructor(question: string, options: TMultipleChoiceMessageOption<OptionProps>[], Renderer?: (props: {
|
|
199
|
-
item: TMultipleChoiceMessageOption<OptionProps>;
|
|
200
|
-
}) => ReactElement);
|
|
201
|
-
}
|
|
5
|
+
import { EventEmitter, AudioRecorder } from '@apia/util';
|
|
202
6
|
|
|
203
7
|
type TSearchResultState = {
|
|
204
8
|
title: string;
|
|
@@ -230,16 +34,6 @@ declare class SearchController {
|
|
|
230
34
|
protected setReferences(results: SemanticSearchReference[]): void;
|
|
231
35
|
}
|
|
232
36
|
|
|
233
|
-
declare class FloatingChatController extends ChatController2 {
|
|
234
|
-
constructor(props: Partial<TChatControllerState & {
|
|
235
|
-
isPhone: boolean;
|
|
236
|
-
}>, onMessageSubmit: MessageCallback, id: string);
|
|
237
|
-
open(): void;
|
|
238
|
-
Window: (() => react.JSX.Element) & {
|
|
239
|
-
displayName: string;
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
37
|
type TReference = {
|
|
244
38
|
title: string;
|
|
245
39
|
body: string;
|
|
@@ -278,6 +72,7 @@ interface ISemanticSearchViewController {
|
|
|
278
72
|
type TResponseData = {
|
|
279
73
|
result: string;
|
|
280
74
|
success: string;
|
|
75
|
+
streaming: boolean;
|
|
281
76
|
failed?: boolean;
|
|
282
77
|
};
|
|
283
78
|
interface ISearchResultsController<P extends ProcessingUnit> {
|
|
@@ -297,7 +92,7 @@ declare class ResponseStream extends EventEmitter<{
|
|
|
297
92
|
private buffer;
|
|
298
93
|
private isRunning;
|
|
299
94
|
private locked;
|
|
300
|
-
|
|
95
|
+
maxCompletionTime: number;
|
|
301
96
|
private minPartSize;
|
|
302
97
|
private partSize;
|
|
303
98
|
private timing;
|
|
@@ -395,49 +190,16 @@ declare function getImagesWithDescription({ multiple, }: {
|
|
|
395
190
|
multiple?: boolean;
|
|
396
191
|
}): Promise<TGenerateFromImage[]>;
|
|
397
192
|
|
|
398
|
-
type
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
error?: Partial<Record<TAttachmentErrorCallback, () => void>>;
|
|
403
|
-
needsControlExtension?: boolean;
|
|
404
|
-
onClose?: () => unknown;
|
|
193
|
+
type TMultipleChoiceMessageOption<OptionProps> = {
|
|
194
|
+
label: string;
|
|
195
|
+
url: string;
|
|
196
|
+
additionalProps?: OptionProps;
|
|
405
197
|
};
|
|
406
|
-
declare class
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
extension: AIFileContentAllowedExtension;
|
|
411
|
-
private __file;
|
|
412
|
-
private __error?;
|
|
413
|
-
private onClose?;
|
|
414
|
-
private overrideSize;
|
|
415
|
-
id: string;
|
|
416
|
-
constructor(props: TFileContentProps);
|
|
417
|
-
setOnClose(callback: () => unknown): this;
|
|
418
|
-
setOverrideSize(overrideSize: {
|
|
419
|
-
width: number;
|
|
420
|
-
height: number;
|
|
421
|
-
}): this;
|
|
422
|
-
get file(): File;
|
|
423
|
-
inferContent: () => string;
|
|
424
|
-
inferExtension: (extension: AIFileContentAllowedExtension) => FileType | undefined;
|
|
425
|
-
static isValidExtension: (extension: string) => extension is "svg" | "jpg" | "jpeg" | "png" | "pdf" | "txt" | "doc" | "docx" | "csv" | "xlsx" | "xls" | "mp3" | "wav";
|
|
426
|
-
static blobToBase64: (blob: Blob) => Promise<string>;
|
|
427
|
-
static fromFile: (props: Omit<TFileContentProps, 'fileName' | 'fileUrl' | 'f'> & {
|
|
428
|
-
f: File;
|
|
429
|
-
}) => Promise<AIFileContent>;
|
|
430
|
-
static getExtensionFromFileName(fileName: string): "svg" | "jpg" | "jpeg" | "png" | "pdf" | "txt" | "doc" | "docx" | "csv" | "xlsx" | "xls" | "mp3" | "wav";
|
|
431
|
-
private static __getExtensionErrorMessage;
|
|
432
|
-
private __throwError;
|
|
433
|
-
getId(): string;
|
|
434
|
-
Component: () => react.JSX.Element;
|
|
198
|
+
declare class MultipleChoiceMessage<OptionProps> extends ChatMessage {
|
|
199
|
+
constructor(question: string, options: TMultipleChoiceMessageOption<OptionProps>[], Renderer?: (props: {
|
|
200
|
+
item: TMultipleChoiceMessageOption<OptionProps>;
|
|
201
|
+
}) => ReactElement);
|
|
435
202
|
}
|
|
436
203
|
|
|
437
|
-
|
|
438
|
-
children: ReactNode;
|
|
439
|
-
style?: ThemeUIStyleObject | undefined;
|
|
440
|
-
} & react.RefAttributes<HTMLElement>>;
|
|
441
|
-
|
|
442
|
-
export { AIFileContent, AIMessageAttachments, AutoscrollContainer, ChatController, ChatController2, ChatMessage, type ChatProcessingUnit, DashboardsRoutinesGeneration, FloatingChatController, type ISearchResultsController, type ISemanticSearchViewController, type ListingProcessingUnit, MultipleChoiceMessage, type ProcessingUnit, ResponseStream, RoutinesGeneration, SearchController, SemanticSearchReference as SemanticSearchResult, type TGenerateFromImage$1 as TGenerateFromImage, type TMessageType, type TMultipleChoiceMessageOption, type TPollRoutineResult, type TReference, type TResponseData, type TRoutineCompletion, type TSearchMode, type ISemanticSearchViewController as ViewController, ViewRendererContext, WindowDragger, getImageFromDisk, getImagesFromDisk, getImagesWithDescription };
|
|
204
|
+
export { type ChatProcessingUnit, DashboardsRoutinesGeneration, type ISearchResultsController, type ISemanticSearchViewController, type ListingProcessingUnit, MultipleChoiceMessage, type ProcessingUnit, ResponseStream, RoutinesGeneration, SearchController, SemanticSearchReference as SemanticSearchResult, type TGenerateFromImage$1 as TGenerateFromImage, type TMultipleChoiceMessageOption, type TPollRoutineResult, type TReference, type TResponseData, type TRoutineCompletion, type TSearchMode, type ISemanticSearchViewController as ViewController, ViewRendererContext, getImageFromDisk, getImagesFromDisk, getImagesWithDescription };
|
|
443
205
|
//# sourceMappingURL=index.d.ts.map
|