@apia/ai 4.0.102 → 5.0.1
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/chat/AutoscrollContainer.d.ts +12 -0
- package/dist/chat/AutoscrollContainer.d.ts.map +1 -0
- package/dist/chat/AutoscrollContainer.js +150 -0
- package/dist/chat/AutoscrollContainer.js.map +1 -0
- package/dist/chat/ChatController/CameraController.d.ts +18 -0
- package/dist/chat/ChatController/CameraController.d.ts.map +1 -0
- package/dist/chat/ChatController/CameraController.js +99 -0
- package/dist/chat/ChatController/CameraController.js.map +1 -0
- package/dist/chat/ChatController/ChatController.d.ts +58 -0
- package/dist/chat/ChatController/ChatController.d.ts.map +1 -0
- package/dist/chat/ChatController/ChatController.js +320 -0
- package/dist/chat/ChatController/ChatController.js.map +1 -0
- package/dist/chat/ChatController/StreamMessage.d.ts +39 -0
- package/dist/chat/ChatController/StreamMessage.d.ts.map +1 -0
- package/dist/chat/ChatController/StreamMessage.js +84 -0
- package/dist/chat/ChatController/StreamMessage.js.map +1 -0
- package/dist/chat/ChatController/components/Attachments.d.ts +14 -0
- package/dist/chat/ChatController/components/Attachments.d.ts.map +1 -0
- package/dist/chat/ChatController/components/Attachments.js +35 -0
- package/dist/chat/ChatController/components/Attachments.js.map +1 -0
- package/dist/chat/ChatController/components/ChatMessage.d.ts +28 -0
- package/dist/chat/ChatController/components/ChatMessage.d.ts.map +1 -0
- package/dist/chat/ChatController/components/ChatMessage.js +74 -0
- package/dist/chat/ChatController/components/ChatMessage.js.map +1 -0
- package/dist/chat/ChatController/components/Ellipsis.d.ts +6 -0
- package/dist/chat/ChatController/components/Ellipsis.d.ts.map +1 -0
- package/dist/chat/ChatController/components/Ellipsis.js +23 -0
- package/dist/chat/ChatController/components/Ellipsis.js.map +1 -0
- package/dist/chat/ChatController/components/FileAttachment.js +76 -0
- package/dist/chat/ChatController/components/FileAttachment.js.map +1 -0
- package/dist/chat/ChatController/components/Header.d.ts +11 -0
- package/dist/chat/ChatController/components/Header.d.ts.map +1 -0
- package/dist/chat/ChatController/components/Header.js +12 -0
- package/dist/chat/ChatController/components/Header.js.map +1 -0
- package/dist/chat/ChatController/components/History.d.ts +12 -0
- package/dist/chat/ChatController/components/History.d.ts.map +1 -0
- package/dist/chat/ChatController/components/History.js +47 -0
- package/dist/chat/ChatController/components/History.js.map +1 -0
- package/dist/chat/ChatController/components/Message.d.ts +17 -0
- package/dist/chat/ChatController/components/Message.d.ts.map +1 -0
- package/dist/chat/ChatController/components/Message.js +38 -0
- package/dist/chat/ChatController/components/Message.js.map +1 -0
- package/dist/chat/ChatController/components/MessageBlock.d.ts +9 -0
- package/dist/chat/ChatController/components/MessageBlock.d.ts.map +1 -0
- package/dist/chat/ChatController/components/MessageBlock.js +16 -0
- package/dist/chat/ChatController/components/MessageBlock.js.map +1 -0
- package/dist/chat/ChatController/components/MessageBlocks.d.ts +26 -0
- package/dist/chat/ChatController/components/MessageBlocks.d.ts.map +1 -0
- package/dist/chat/ChatController/components/MessageBlocks.js +87 -0
- package/dist/chat/ChatController/components/MessageBlocks.js.map +1 -0
- package/dist/chat/ChatController/components/MessageBody.d.ts +12 -0
- package/dist/chat/ChatController/components/MessageBody.d.ts.map +1 -0
- package/dist/chat/ChatController/components/MessageBody.js +78 -0
- package/dist/chat/ChatController/components/MessageBody.js.map +1 -0
- package/dist/chat/ChatController/components/QuestionAnswerMessage.d.ts +12 -0
- package/dist/chat/ChatController/components/QuestionAnswerMessage.d.ts.map +1 -0
- package/dist/chat/ChatController/components/QuestionAnswerMessage.js +21 -0
- package/dist/chat/ChatController/components/QuestionAnswerMessage.js.map +1 -0
- package/dist/chat/ChatController/components/QuestionBlocks.d.ts +11 -0
- package/dist/chat/ChatController/components/QuestionBlocks.d.ts.map +1 -0
- package/dist/chat/ChatController/components/QuestionBlocks.js +24 -0
- package/dist/chat/ChatController/components/QuestionBlocks.js.map +1 -0
- package/dist/chat/ChatController/components/TextArea.d.ts +39 -0
- package/dist/chat/ChatController/components/TextArea.d.ts.map +1 -0
- package/dist/chat/ChatController/components/TextArea.js +377 -0
- package/dist/chat/ChatController/components/TextArea.js.map +1 -0
- package/dist/chat/ChatController/components/ThinkingBlocks.d.ts +17 -0
- package/dist/chat/ChatController/components/ThinkingBlocks.d.ts.map +1 -0
- package/dist/chat/ChatController/components/ThinkingBlocks.js +259 -0
- package/dist/chat/ChatController/components/ThinkingBlocks.js.map +1 -0
- package/dist/chat/ChatController/components/rate.d.ts +4 -0
- package/dist/chat/ChatController/components/rate.d.ts.map +1 -0
- package/dist/chat/ChatController/components/rate.js +68 -0
- package/dist/chat/ChatController/components/rate.js.map +1 -0
- package/dist/chat/ChatController/types.d.ts +39 -0
- package/dist/chat/ChatController/types.d.ts.map +1 -0
- package/dist/chat/ChatController/util.js +22 -0
- package/dist/chat/ChatController/util.js.map +1 -0
- package/dist/chat/FloatingChatController.d.ts +35 -0
- package/dist/chat/FloatingChatController.d.ts.map +1 -0
- package/dist/chat/FloatingChatController.js +81 -0
- package/dist/chat/FloatingChatController.js.map +1 -0
- package/dist/components/chat/messages/MultipleChoiceMessage.d.ts +17 -0
- package/dist/components/chat/messages/MultipleChoiceMessage.d.ts.map +1 -0
- package/dist/components/chat/messages/MultipleChoiceMessage.js +31 -0
- package/dist/components/chat/messages/MultipleChoiceMessage.js.map +1 -0
- package/dist/components/documents/ImageBinaryField/getImage.d.ts +14 -0
- package/dist/components/documents/ImageBinaryField/getImage.d.ts.map +1 -0
- package/dist/components/documents/ImageBinaryField/getImage.js +47 -0
- package/dist/components/documents/ImageBinaryField/getImage.js.map +1 -0
- package/dist/components/documents/ImageBinaryField/getImageSrcString.js +6 -0
- package/dist/components/documents/ImageBinaryField/getImageSrcString.js.map +1 -0
- package/dist/components/documents/UploadModal/ImageIcon.js +18 -0
- package/dist/components/documents/UploadModal/ImageIcon.js.map +1 -0
- package/dist/components/documents/UploadModal/getImagesWithDescription.d.ts +10 -0
- package/dist/components/documents/UploadModal/getImagesWithDescription.d.ts.map +1 -0
- package/dist/components/documents/UploadModal/getImagesWithDescription.js +148 -0
- package/dist/components/documents/UploadModal/getImagesWithDescription.js.map +1 -0
- package/dist/index.d.ts +30 -495
- package/dist/index.js +29 -1884
- package/dist/index.js.map +1 -1
- package/dist/routines/DashboardRoutinesGeneration.d.ts +22 -0
- package/dist/routines/DashboardRoutinesGeneration.d.ts.map +1 -0
- package/dist/routines/DashboardRoutinesGeneration.js +54 -0
- package/dist/routines/DashboardRoutinesGeneration.js.map +1 -0
- package/dist/routines/RoutinesGeneration.d.ts +54 -0
- package/dist/routines/RoutinesGeneration.d.ts.map +1 -0
- package/dist/routines/RoutinesGeneration.js +174 -0
- package/dist/routines/RoutinesGeneration.js.map +1 -0
- package/dist/semanticSearch/SearchController/index.d.ts +23 -0
- package/dist/semanticSearch/SearchController/index.d.ts.map +1 -0
- package/dist/semanticSearch/SearchController/index.js +56 -0
- package/dist/semanticSearch/SearchController/index.js.map +1 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/Component.js +15 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/Component.js.map +1 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/index.d.ts +15 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/index.d.ts.map +1 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/index.js +25 -0
- package/dist/semanticSearch/SearchController/objects/SemanticSearchReference/index.js.map +1 -0
- package/dist/semanticSearch/ViewController/types.d.ts +62 -0
- package/dist/semanticSearch/ViewController/types.d.ts.map +1 -0
- package/dist/semanticSearch/ViewController/types.js +8 -0
- package/dist/semanticSearch/ViewController/types.js.map +1 -0
- package/dist/stream/ResponseStream.d.ts +55 -0
- package/dist/stream/ResponseStream.d.ts.map +1 -0
- package/dist/stream/ResponseStream.js +214 -0
- package/dist/stream/ResponseStream.js.map +1 -0
- package/dist/stream/StreamServicePoller.d.ts +16 -0
- package/dist/stream/StreamServicePoller.d.ts.map +1 -0
- package/dist/stream/StreamServicePoller.js +52 -0
- package/dist/stream/StreamServicePoller.js.map +1 -0
- package/package.json +8 -8
- package/LICENSE.md +0 -6
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { makeObservable, computed, observable } from 'mobx';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
+
var __publicField = (obj, key, value) => {
|
|
6
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
return value;
|
|
8
|
+
};
|
|
9
|
+
let maxId = 0;
|
|
10
|
+
class ChatMessage {
|
|
11
|
+
constructor(message = "", messageType = "user", attachments = [], reference = null) {
|
|
12
|
+
__publicField(this, "id");
|
|
13
|
+
__publicField(this, "state");
|
|
14
|
+
__publicField(this, "clone", () => new ChatMessage(
|
|
15
|
+
this.message,
|
|
16
|
+
this.messageType,
|
|
17
|
+
this.attachments.map((x) => {
|
|
18
|
+
return { ...x };
|
|
19
|
+
}),
|
|
20
|
+
this.reference
|
|
21
|
+
));
|
|
22
|
+
this.state = { message, messageType, attachments, reference };
|
|
23
|
+
this.id = maxId++;
|
|
24
|
+
if (messageType === "response")
|
|
25
|
+
this.messageType = "system";
|
|
26
|
+
if (typeof message === "string")
|
|
27
|
+
this.message = message;
|
|
28
|
+
makeObservable(this, {
|
|
29
|
+
state: observable,
|
|
30
|
+
message: computed
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
get message() {
|
|
34
|
+
return this.state.message;
|
|
35
|
+
}
|
|
36
|
+
get messageType() {
|
|
37
|
+
return this.state.messageType;
|
|
38
|
+
}
|
|
39
|
+
get attachments() {
|
|
40
|
+
return this.state.attachments;
|
|
41
|
+
}
|
|
42
|
+
get reference() {
|
|
43
|
+
return this.state.reference;
|
|
44
|
+
}
|
|
45
|
+
set message(value) {
|
|
46
|
+
this.state.message = value;
|
|
47
|
+
}
|
|
48
|
+
set messageType(value) {
|
|
49
|
+
this.state.messageType = value;
|
|
50
|
+
}
|
|
51
|
+
set attachments(value) {
|
|
52
|
+
this.state.attachments = value;
|
|
53
|
+
}
|
|
54
|
+
set reference(value) {
|
|
55
|
+
this.state.reference = value;
|
|
56
|
+
}
|
|
57
|
+
removeAttachment(attachment) {
|
|
58
|
+
this.attachments = this.attachments.filter(
|
|
59
|
+
(current) => current !== attachment
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
addAttachmentDescription(attachment, description) {
|
|
63
|
+
const a = this.attachments.find((current) => current === attachment);
|
|
64
|
+
if (a) {
|
|
65
|
+
a.description = description;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
setMessageType(type) {
|
|
69
|
+
this.messageType = type;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ChatMessage };
|
|
74
|
+
//# sourceMappingURL=ChatMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessage.js","sources":["../../../../src/chat/ChatController/components/ChatMessage.tsx"],"sourcesContent":["import { ReactNode } from 'react';\r\nimport { computed, makeObservable, observable } from 'mobx';\r\nimport { IAttachment, TMessageType } from '../types';\r\n\r\nlet maxId = 0;\r\n\r\nexport class ChatMessage {\r\n id: number;\r\n state: {\r\n message: ReactNode;\r\n messageType: TMessageType;\r\n attachments: IAttachment[];\r\n reference: ReactNode;\r\n };\r\n\r\n get message() {\r\n return this.state.message;\r\n }\r\n get messageType() {\r\n return this.state.messageType;\r\n }\r\n get attachments() {\r\n return this.state.attachments;\r\n }\r\n get reference() {\r\n return this.state.reference;\r\n }\r\n set message(value) {\r\n this.state.message = value;\r\n }\r\n set messageType(value) {\r\n this.state.messageType = value;\r\n }\r\n set attachments(value) {\r\n this.state.attachments = value;\r\n }\r\n set reference(value) {\r\n this.state.reference = value;\r\n }\r\n\r\n constructor(\r\n message: ReactNode = '',\r\n messageType: TMessageType = 'user',\r\n attachments: IAttachment[] = [],\r\n reference: ReactNode = null,\r\n ) {\r\n this.state = { message, messageType, attachments, reference };\r\n\r\n this.id = maxId++;\r\n if (messageType === 'response') this.messageType = 'system';\r\n if (typeof message === 'string') this.message = message;\r\n\r\n makeObservable(this, {\r\n state: observable,\r\n message: computed,\r\n });\r\n }\r\n\r\n clone = () =>\r\n new ChatMessage(\r\n this.message,\r\n this.messageType,\r\n this.attachments.map((x) => {\r\n return { ...x };\r\n }),\r\n this.reference,\r\n );\r\n\r\n removeAttachment(attachment: IAttachment) {\r\n this.attachments = this.attachments.filter(\r\n (current) => current !== attachment,\r\n );\r\n }\r\n addAttachmentDescription(attachment: IAttachment, description: string) {\r\n const a = this.attachments.find((current) => current === attachment);\r\n if (a) {\r\n a.description = description;\r\n }\r\n }\r\n setMessageType(type: TMessageType) {\r\n this.messageType = type;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;AAIA,IAAI,KAAA,GAAQ,CAAA;AAEL,MAAM,WAAA,CAAY;AAAA,EAkCvB,WAAA,CACE,UAAqB,EAAA,EACrB,WAAA,GAA4B,QAC5B,WAAA,GAA6B,EAAC,EAC9B,SAAA,GAAuB,IAAA,EACvB;AAtCF,IAAA,aAAA,CAAA,IAAA,EAAA,IAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AAkDA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,EAAQ,MACN,IAAI,WAAA;AAAA,MACF,IAAA,CAAK,OAAA;AAAA,MACL,IAAA,CAAK,WAAA;AAAA,MACL,IAAA,CAAK,WAAA,CAAY,GAAA,CAAI,CAAC,CAAA,KAAM;AAC1B,QAAA,OAAO,EAAE,GAAG,CAAA,EAAE;AAAA,OACf,CAAA;AAAA,MACD,IAAA,CAAK;AAAA,KACP,CAAA;AApBA,IAAA,IAAA,CAAK,KAAA,GAAQ,EAAE,OAAA,EAAS,WAAA,EAAa,aAA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CAAK,WAAA,CAAY,KAAK,CAAC,OAAA,KAAY,YAAY,UAAU,CAAA;AACnE,IAAA,IAAI,CAAA,EAAG;AACL,MAAA,CAAA,CAAE,WAAA,GAAc,WAAA;AAAA;AAClB;AACF,EACA,eAAe,IAAA,EAAoB;AACjC,IAAA,IAAA,CAAK,WAAA,GAAc,IAAA;AAAA;AAEvB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ellipsis.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const Ellipsis = () => {
|
|
5
|
+
const [e, setE] = useState(0);
|
|
6
|
+
let dots = ".";
|
|
7
|
+
for (let i = 0; i < e; i++) {
|
|
8
|
+
dots += ".";
|
|
9
|
+
}
|
|
10
|
+
const interval = useRef(0);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
interval.current = setInterval(() => {
|
|
13
|
+
setE((e2) => e2 === 2 ? 0 : e2 + 1);
|
|
14
|
+
}, 500);
|
|
15
|
+
return () => {
|
|
16
|
+
clearInterval(interval.current);
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx("div", { className: "ellipsis", children: dots });
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { Ellipsis };
|
|
23
|
+
//# sourceMappingURL=Ellipsis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ellipsis.js","sources":["../../../../src/chat/ChatController/components/Ellipsis.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nexport const Ellipsis = () => {\n const [e, setE] = useState(0);\n\n let dots = '.';\n for (let i = 0; i < e; i++) {\n dots += '.';\n }\n\n const interval = useRef(0);\n useEffect(() => {\n interval.current = setInterval(() => {\n setE((e) => (e === 2 ? 0 : e + 1));\n }, 500) as any;\n\n return () => {\n clearInterval(interval.current);\n };\n });\n\n return <div className=\"ellipsis\">{dots}</div>;\n};\n"],"names":["e"],"mappings":";;;AAEO,MAAM,WAAW,MAAM;AAC5B,EAAA,MAAM,CAAC,CAAA,EAAG,IAAI,CAAA,GAAI,SAAS,CAAC,CAAA;AAE5B,EAAA,IAAI,IAAA,GAAO,GAAA;AACX,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,IAAA,IAAQ,GAAA;AAAA;AAGV,EAAA,MAAM,QAAA,GAAW,OAAO,CAAC,CAAA;AACzB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,QAAA,CAAS,OAAA,GAAU,YAAY,MAAM;AACnC,MAAA,IAAA,CAAK,CAACA,EAAAA,KAAOA,EAAAA,KAAM,CAAA,GAAI,CAAA,GAAIA,KAAI,CAAE,CAAA;AAAA,OAChC,GAAG,CAAA;AAEN,IAAA,OAAO,MAAM;AACX,MAAA,aAAA,CAAc,SAAS,OAAO,CAAA;AAAA,KAChC;AAAA,GACD,CAAA;AAED,EAAA,uBAAO,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,UAAA,EAAY,QAAA,EAAA,IAAA,EAAK,CAAA;AACzC;;;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { Box, Label } from '@apia/theme';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
import { getLabel } from '@apia/util';
|
|
5
|
+
import { Collector } from '@apia/validations';
|
|
6
|
+
import { ApiaUtil, FileCard } from '@apia/components';
|
|
7
|
+
|
|
8
|
+
const FileAttachment = observer(
|
|
9
|
+
({
|
|
10
|
+
attachment,
|
|
11
|
+
onAddDescription,
|
|
12
|
+
onRemove
|
|
13
|
+
}) => {
|
|
14
|
+
const { ref } = ApiaUtil.instance.tooltips.useHover({
|
|
15
|
+
preferredOrientationX: "left",
|
|
16
|
+
preferredOrientationY: "top",
|
|
17
|
+
minSize: {
|
|
18
|
+
width: 200,
|
|
19
|
+
height: 400
|
|
20
|
+
},
|
|
21
|
+
attachToMousePosition: true,
|
|
22
|
+
closeOnMouseLeaveAttachedElement: true,
|
|
23
|
+
children: /* @__PURE__ */ jsxs(
|
|
24
|
+
Box,
|
|
25
|
+
{
|
|
26
|
+
sx: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
flexDirection: "column"
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("h1", { children: attachment.name }),
|
|
33
|
+
/* @__PURE__ */ jsx("img", { src: attachment.base64 }),
|
|
34
|
+
attachment.description && /* @__PURE__ */ jsx(Label, { children: attachment.description })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
FileCard,
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
name: attachment.name,
|
|
44
|
+
handleClose: onRemove,
|
|
45
|
+
additionalButtons: onAddDescription ? [
|
|
46
|
+
{
|
|
47
|
+
icon: "Pencil",
|
|
48
|
+
onClick: () => {
|
|
49
|
+
const collector = new Collector();
|
|
50
|
+
collector.add(
|
|
51
|
+
new collector.fields.textarea(
|
|
52
|
+
"desc",
|
|
53
|
+
getLabel("lblDes").text,
|
|
54
|
+
{ initialValue: attachment.description }
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
collector.show({
|
|
58
|
+
onConfirm: (ev) => {
|
|
59
|
+
if (ev) {
|
|
60
|
+
onAddDescription(attachment, ev.desc);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
title: getLabel("btnAddComment").text
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
variant: "icon-only"
|
|
68
|
+
}
|
|
69
|
+
] : []
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export { FileAttachment };
|
|
76
|
+
//# sourceMappingURL=FileAttachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileAttachment.js","sources":["../../../../src/chat/ChatController/components/FileAttachment.tsx"],"sourcesContent":["import { Box, Label } from '@apia/theme';\nimport { IAttachment } from '../types';\nimport { observer } from 'mobx-react-lite';\nimport { getLabel } from '@apia/util';\nimport { Collector } from '@apia/validations';\nimport { ApiaUtil, FileCard } from '@apia/components';\n\nexport const FileAttachment = observer(\n ({\n attachment,\n onAddDescription,\n onRemove,\n }: {\n attachment: IAttachment;\n onAddDescription?: (a: IAttachment, d: string) => unknown;\n onRemove?: () => unknown;\n }) => {\n const { ref } = ApiaUtil.instance.tooltips.useHover({\n preferredOrientationX: 'left',\n preferredOrientationY: 'top',\n minSize: {\n width: 200,\n height: 400,\n },\n attachToMousePosition: true,\n closeOnMouseLeaveAttachedElement: true,\n children: (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n }}\n >\n <h1>{attachment.name}</h1>\n <img src={attachment.base64}></img>\n {attachment.description && <Label>{attachment.description}</Label>}\n </Box>\n ),\n });\n\n return (\n <FileCard\n ref={ref}\n // className=\"file_box__icon\"\n name={attachment.name}\n handleClose={onRemove}\n additionalButtons={\n onAddDescription\n ? [\n {\n icon: 'Pencil',\n onClick: () => {\n const collector = new Collector();\n collector.add(\n new collector.fields.textarea(\n 'desc',\n getLabel('lblDes').text,\n { initialValue: attachment.description },\n ),\n );\n collector.show({\n onConfirm: (ev): boolean => {\n if (ev) {\n onAddDescription(attachment, ev.desc! as string);\n }\n return true;\n },\n title: getLabel('btnAddComment').text,\n });\n },\n variant: 'icon-only',\n },\n ]\n : []\n }\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,c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A,kBACnB,MAAA;AAAA,kBACA,QAAA,CAAS,QAAQ,CAAA,CAAE,IAAA;AAAA,kBACnB,EAAE,YAAA,EAAc,UAAA,CAAW,WAAA;AAAY;AACzC,eACF;AACA,cAAA,SAAA,CAAU,IAAA,CAAK;AAAA,gBACb,SAAA,EAAW,CAAC,EAAA,KAAgB;AAC1B,kBAAA,IAAI,EAAA,EAAI;AACN,oBAAA,gBAAA,CAAiB,UAAA,EAAY,GAAG,IAAe,CAAA;AAAA;AAEjD,kBAAA,OAAO,IAAA;AAAA,iBACT;AAAA,gBACA,KAAA,EAAO,QAAA,CAAS,eAAe,CAAA,CAAE;AAAA,eAClC,CAAA;AAAA,aACH;AAAA,YACA,OAAA,EAAS;AAAA;AACX,YAEF;AAAC;AAAA,KAET;AAAA;AAGN;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Header: (({ childComponent }: {
|
|
5
|
+
childComponent: ReactNode;
|
|
6
|
+
}) => react.JSX.Element) & {
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { Header };
|
|
11
|
+
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { Box } from '@apia/theme';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
|
|
5
|
+
const Header = observer(
|
|
6
|
+
({ childComponent }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Box, { className: "search_header_container", children: childComponent });
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export { Header };
|
|
12
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../src/chat/ChatController/components/Header.tsx"],"sourcesContent":["import { Box } from '@apia/theme';\nimport { observer } from 'mobx-react-lite';\nimport { ReactNode } from 'react';\n\nexport const Header = observer(\n ({ childComponent }: { childComponent: ReactNode }) => {\n return <Box className=\"search_header_container\">{childComponent}</Box>;\n },\n);\n"],"names":[],"mappings":";;;;AAIO,MAAM,MAAA,GAAS,QAAA;AAAA,EACpB,CAAC,EAAE,cAAA,EAAe,KAAqC;AACrD,IAAA,uBAAO,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAU,yBAAA,EAA2B,QAAA,EAAA,cAAA,EAAe,CAAA;AAAA;AAEpE;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ChatMessage } from './ChatMessage.js';
|
|
3
|
+
|
|
4
|
+
declare const History: (({ messages, className, }: {
|
|
5
|
+
messages: ChatMessage[];
|
|
6
|
+
className?: string;
|
|
7
|
+
}) => react.JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { History };
|
|
12
|
+
//# sourceMappingURL=History.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"History.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { Box, getVariant } from '@apia/theme';
|
|
4
|
+
import { Message } from './Message.js';
|
|
5
|
+
import { AutoscrollContainer } from '../../AutoscrollContainer.js';
|
|
6
|
+
|
|
7
|
+
const History = observer(
|
|
8
|
+
({
|
|
9
|
+
messages,
|
|
10
|
+
className
|
|
11
|
+
}) => {
|
|
12
|
+
let currentType = "";
|
|
13
|
+
return /* @__PURE__ */ jsx(AutoscrollContainer, { className, children: /* @__PURE__ */ jsx(
|
|
14
|
+
Box,
|
|
15
|
+
{
|
|
16
|
+
...getVariant("layout.common.chat.history"),
|
|
17
|
+
className: "chat_history",
|
|
18
|
+
children: messages.map((current, i) => {
|
|
19
|
+
let first = false;
|
|
20
|
+
let last = false;
|
|
21
|
+
if (currentType !== current.messageType) {
|
|
22
|
+
currentType = current.messageType;
|
|
23
|
+
first = true;
|
|
24
|
+
}
|
|
25
|
+
if (i === messages.length - 1 || messages[i + 1].messageType !== current.messageType) {
|
|
26
|
+
last = true;
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
Message,
|
|
30
|
+
{
|
|
31
|
+
className: first ? "first" : last ? "last" : void 0,
|
|
32
|
+
type: current.messageType,
|
|
33
|
+
id: String(current.id),
|
|
34
|
+
attachments: current.attachments,
|
|
35
|
+
reference: current.reference,
|
|
36
|
+
message: current.message
|
|
37
|
+
},
|
|
38
|
+
String(current.id)
|
|
39
|
+
);
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
) });
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export { History };
|
|
47
|
+
//# sourceMappingURL=History.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"History.js","sources":["../../../../src/chat/ChatController/components/History.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite';\r\nimport { Box, getVariant } from '@apia/theme';\r\nimport { ChatMessage } from './ChatMessage';\r\nimport { Message } from './Message';\r\nimport { AutoscrollContainer } from '../../AutoscrollContainer';\r\n\r\nexport const History = observer(\r\n ({\r\n messages,\r\n className,\r\n }: {\r\n messages: ChatMessage[];\r\n className?: string;\r\n }) => {\r\n let currentType: string = '';\r\n\r\n return (\r\n <AutoscrollContainer className={className}>\r\n <Box\r\n {...getVariant('layout.common.chat.history')}\r\n className=\"chat_history\"\r\n >\r\n {messages.map((current, i) => {\r\n let first = false;\r\n let last = false;\r\n\r\n if (currentType !== current.messageType) {\r\n currentType = current.messageType;\r\n first = true;\r\n }\r\n\r\n if (\r\n i === messages.length - 1 ||\r\n messages[i + 1].messageType !== current.messageType\r\n ) {\r\n last = true;\r\n }\r\n\r\n return (\r\n <Message\r\n key={String(current.id)}\r\n className={first ? 'first' : last ? 'last' : undefined}\r\n type={current.messageType}\r\n id={String(current.id)}\r\n attachments={current.attachments}\r\n reference={current.reference}\r\n message={current.message}\r\n />\r\n );\r\n })}\r\n </Box>\r\n </AutoscrollContainer>\r\n );\r\n },\r\n);\r\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,OAAA,GAAU,QAAA;AAAA,EACrB,CAAC;AAAA,IACC,QAAA;AAAA,IACA;AAAA,GACF,KAGM;AACJ,IAAA,IAAI,WAAA,GAAsB,EAAA;AAE1B,IAAA,uBACE,GAAA,CAAC,uBAAoB,SAAA,EACnB,QAAA,kBAAA,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACE,GAAG,WAAW,4BAA4B,CAAA;AAAA,QAC3C,SAAA,EAAU,cAAA;AAAA,QAET,QAAA,EAAA,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,EAAS,CAAA,KAAM;AAC5B,UAAA,IAAI,KAAA,GAAQ,KAAA;AACZ,UAAA,IAAI,IAAA,GAAO,KAAA;AAEX,UAAA,IAAI,WAAA,KAAgB,QAAQ,WAAA,EAAa;AACvC,YAAA,WAAA,GAAc,OAAA,CAAQ,WAAA;AACtB,YAAA,KAAA,GAAQ,IAAA;AAAA;AAGV,UAAA,IACE,CAAA,KAAM,QAAA,CAAS,MAAA,GAAS,CAAA,IACxB,QAAA,CAAS,IAAI,CAAC,CAAA,CAAE,WAAA,KAAgB,OAAA,CAAQ,WAAA,EACxC;AACA,YAAA,IAAA,GAAO,IAAA;AAAA;AAGT,UAAA,uBACE,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cAEC,SAAA,EAAW,KAAA,GAAQ,OAAA,GAAU,IAAA,GAAO,MAAA,GAAS,MAAA;AAAA,cAC7C,MAAM,OAAA,CAAQ,WAAA;AAAA,cACd,EAAA,EAAI,MAAA,CAAO,OAAA,CAAQ,EAAE,CAAA;AAAA,cACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,cACrB,WAAW,OAAA,CAAQ,SAAA;AAAA,cACnB,SAAS,OAAA,CAAQ;AAAA,aAAA;AAAA,YANZ,MAAA,CAAO,QAAQ,EAAE;AAAA,WAOxB;AAAA,SAEH;AAAA;AAAA,KACH,EACF,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { TMessageType, IAttachment } from '../types.js';
|
|
4
|
+
|
|
5
|
+
declare const Message: (({ className, type, id, message, attachments, reference, }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
type: TMessageType;
|
|
8
|
+
id: string;
|
|
9
|
+
message: ReactNode;
|
|
10
|
+
attachments: IAttachment[];
|
|
11
|
+
reference: ReactNode;
|
|
12
|
+
}) => react.JSX.Element) & {
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { Message };
|
|
17
|
+
//# sourceMappingURL=Message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { Box } from '@apia/theme';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
import { Attachments } from './Attachments.js';
|
|
5
|
+
import { MessageBlocks } from './MessageBlocks.js';
|
|
6
|
+
|
|
7
|
+
const Message = observer(
|
|
8
|
+
({
|
|
9
|
+
className,
|
|
10
|
+
type,
|
|
11
|
+
id,
|
|
12
|
+
message,
|
|
13
|
+
attachments,
|
|
14
|
+
reference
|
|
15
|
+
}) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs(Box, { as: "pre", className: `history_message ${className || ""} ${type}`, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
Box,
|
|
19
|
+
{
|
|
20
|
+
className: "history_message__content",
|
|
21
|
+
...typeof message === "string" ? {
|
|
22
|
+
children: /* @__PURE__ */ jsx(
|
|
23
|
+
MessageBlocks,
|
|
24
|
+
{
|
|
25
|
+
streamParts: [{ blockType: "text", str: message }]
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
} : { children: message }
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
attachments.length > 0 && /* @__PURE__ */ jsx(Attachments, { attachments }),
|
|
32
|
+
reference && /* @__PURE__ */ jsx(Box, { className: "history_message__references", children: reference })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export { Message };
|
|
38
|
+
//# sourceMappingURL=Message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.js","sources":["../../../../src/chat/ChatController/components/Message.tsx"],"sourcesContent":["import { Box } from '@apia/theme';\r\nimport { observer } from 'mobx-react-lite';\r\nimport { ReactNode } from 'react';\r\nimport { Attachments } from './Attachments';\r\nimport { IAttachment, TMessageType } from '../types';\r\nimport { MessageBlocks } from './MessageBlocks';\r\n\r\nexport const Message = observer(\r\n ({\r\n className,\r\n type,\r\n id,\r\n message,\r\n attachments,\r\n reference,\r\n }: {\r\n className?: string;\r\n type: TMessageType;\r\n id: string;\r\n message: ReactNode;\r\n attachments: IAttachment[];\r\n reference: ReactNode;\r\n }) => {\r\n return (\r\n <Box as=\"pre\" className={`history_message ${className || ''} ${type}`}>\r\n <Box\r\n className=\"history_message__content\"\r\n {...(typeof message === 'string'\r\n ? {\r\n children: (\r\n <MessageBlocks\r\n streamParts={[{ blockType: 'text', str: message }]}\r\n ></MessageBlocks>\r\n ),\r\n }\r\n : { children: message as string })}\r\n />\r\n {attachments.length > 0 && (\r\n <Attachments attachments={attachments}></Attachments>\r\n )}\r\n {reference && (\r\n <Box className=\"history_message__references\">{reference}</Box>\r\n )}\r\n </Box>\r\n );\r\n },\r\n);\r\n"],"names":[],"mappings":";;;;;;AAOO,MAAM,OAAA,GAAU,QAAA;AAAA,EACrB,CAAC;AAAA,IACC,SAAA;AAAA,IACA,IAAA;AAAA,IACA,EAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF,KAOM;AACJ,IAAA,uBACE,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAG,KAAA,EAAM,SAAA,EAAW,mBAAmB,SAAA,IAAa,EAAE,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,EACjE,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAU,0BAAA;AAAA,UACT,GAAI,OAAO,OAAA,KAAY,QAAA,GACpB;AAAA,YACE,QAAA,kBACE,GAAA;AAAA,cAAC,aAAA;AAAA,cAAA;AAAA,gBACC,aAAa,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAA,EAAK,SAAS;AAAA;AAAA;AAClD,WAEL,GACA,EAAE,QAAA,EAAU,OAAA;AAAkB;AAAA,OACpC;AAAA,MACC,WAAA,CAAY,MAAA,GAAS,CAAA,oBACpB,GAAA,CAAC,eAAY,WAAA,EAA0B,CAAA;AAAA,MAExC,SAAA,oBACC,GAAA,CAAC,GAAA,EAAA,EAAI,SAAA,EAAU,+BAA+B,QAAA,EAAA,SAAA,EAAU;AAAA,KAAA,EAE5D,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { TComponentRender } from '../types.js';
|
|
3
|
+
|
|
4
|
+
declare const MessageBlock: react.MemoExoticComponent<({ componentData }: {
|
|
5
|
+
componentData: TComponentRender;
|
|
6
|
+
}) => react.JSX.Element>;
|
|
7
|
+
|
|
8
|
+
export { MessageBlock };
|
|
9
|
+
//# sourceMappingURL=MessageBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBlock.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { memo, Suspense } from 'react';
|
|
3
|
+
import { importComponent } from '@apia/components';
|
|
4
|
+
|
|
5
|
+
const MessageBlock = memo(
|
|
6
|
+
({ componentData }) => {
|
|
7
|
+
if (typeof componentData.args === "string") {
|
|
8
|
+
componentData.args = JSON.parse(componentData.args);
|
|
9
|
+
}
|
|
10
|
+
const Component = importComponent(componentData.path);
|
|
11
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...componentData.args }) });
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export { MessageBlock };
|
|
16
|
+
//# sourceMappingURL=MessageBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBlock.js","sources":["../../../../src/chat/ChatController/components/MessageBlock.tsx"],"sourcesContent":["import { Suspense, memo } from 'react';\nimport { TComponentRender } from '../types';\nimport { importComponent } from '@apia/components';\n\nexport const MessageBlock = memo(\n ({ componentData }: { componentData: TComponentRender }) => {\n if (typeof componentData.args === 'string') {\n componentData.args = JSON.parse(componentData.args);\n }\n\n const Component = importComponent(componentData.path);\n return (\n <Suspense fallback={null}>\n <Component {...componentData.args} />\n </Suspense>\n );\n },\n);\n"],"names":[],"mappings":";;;;AAIO,MAAM,YAAA,GAAe,IAAA;AAAA,EAC1B,CAAC,EAAE,aAAA,EAAc,KAA2C;AAC1D,IAAA,IAAI,OAAO,aAAA,CAAc,IAAA,KAAS,QAAA,EAAU;AAC1C,MAAA,aAAA,CAAc,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAI,CAAA;AAAA;AAGpD,IAAA,MAAM,SAAA,GAAY,eAAA,CAAgB,aAAA,CAAc,IAAI,CAAA;AACpD,IAAA,uBACE,GAAA,CAAC,YAAS,QAAA,EAAU,IAAA,EAClB,8BAAC,SAAA,EAAA,EAAW,GAAG,aAAA,CAAc,IAAA,EAAM,CAAA,EACrC,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { TDescriberBlock, TQuestionBlock } from '../StreamMessage.js';
|
|
3
|
+
|
|
4
|
+
type TBlockType = 'text' | 'describer' | 'question';
|
|
5
|
+
type TBaseStreamBlock<T extends TBlockType = TBlockType> = {
|
|
6
|
+
blockType: T;
|
|
7
|
+
};
|
|
8
|
+
type TTextStreamBlock = TBaseStreamBlock<'text'> & {
|
|
9
|
+
str: string;
|
|
10
|
+
};
|
|
11
|
+
type TDescriberStreamBlock = TBaseStreamBlock<'describer'> & {
|
|
12
|
+
describer: TDescriberBlock;
|
|
13
|
+
};
|
|
14
|
+
type TQuestionStreamBlock = TBaseStreamBlock<'question'> & {
|
|
15
|
+
question: TQuestionBlock;
|
|
16
|
+
};
|
|
17
|
+
type TStreamBlock = TTextStreamBlock | TDescriberStreamBlock | TQuestionStreamBlock;
|
|
18
|
+
declare const MessageBlocks: (({ streamParts, showThinkingSkeleton, }: {
|
|
19
|
+
streamParts: TStreamBlock[];
|
|
20
|
+
showThinkingSkeleton?: boolean;
|
|
21
|
+
}) => react.JSX.Element[]) & {
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { MessageBlocks, type TBaseStreamBlock, type TBlockType, type TDescriberStreamBlock, type TQuestionStreamBlock, type TStreamBlock, type TTextStreamBlock };
|
|
26
|
+
//# sourceMappingURL=MessageBlocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBlocks.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
+
import { decodeBase64ToUtf8 } from '@apia/util';
|
|
3
|
+
import { MessageBlock } from './MessageBlock.js';
|
|
4
|
+
import { MDRenderer } from '@apia/components';
|
|
5
|
+
import { Box } from '@apia/theme';
|
|
6
|
+
import { observer } from 'mobx-react-lite';
|
|
7
|
+
import { ThinkingBlocks } from './ThinkingBlocks.js';
|
|
8
|
+
import { QuestionBlocks } from './QuestionBlocks.js';
|
|
9
|
+
|
|
10
|
+
const MessageBlocks = observer(
|
|
11
|
+
({
|
|
12
|
+
streamParts,
|
|
13
|
+
showThinkingSkeleton = true
|
|
14
|
+
}) => {
|
|
15
|
+
const groupedParts = streamParts.reduce(
|
|
16
|
+
(groups, part) => {
|
|
17
|
+
const currentGroup = groups[groups.length - 1];
|
|
18
|
+
if (!currentGroup || currentGroup.blockType !== part.blockType) {
|
|
19
|
+
groups.push({
|
|
20
|
+
blockType: part.blockType,
|
|
21
|
+
blocks: [part]
|
|
22
|
+
});
|
|
23
|
+
return groups;
|
|
24
|
+
}
|
|
25
|
+
currentGroup.blocks.push(part);
|
|
26
|
+
return groups;
|
|
27
|
+
},
|
|
28
|
+
[]
|
|
29
|
+
);
|
|
30
|
+
const parts = groupedParts.map((group, groupIndex) => {
|
|
31
|
+
const isLastGroup = !groupedParts[groupIndex + 1];
|
|
32
|
+
if (group.blockType === "describer") {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
ThinkingBlocks,
|
|
35
|
+
{
|
|
36
|
+
blocks: group.blocks,
|
|
37
|
+
groupIndex,
|
|
38
|
+
isThinking: showThinkingSkeleton && isLastGroup
|
|
39
|
+
},
|
|
40
|
+
`tool_calls_${groupIndex}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (group.blockType === "question") {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
QuestionBlocks,
|
|
46
|
+
{
|
|
47
|
+
blocks: group.blocks
|
|
48
|
+
},
|
|
49
|
+
`question_content_${groupIndex}`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(Box, { className: "text__content", children: group.blocks.flatMap((block, blockIndex) => {
|
|
53
|
+
const textBlock = block;
|
|
54
|
+
return textBlock.str.split(/(!!\[[^]+])/g).map((chunk, chunkIndex) => {
|
|
55
|
+
if (chunk.match(/^!!\[[^]+]$/)) {
|
|
56
|
+
const definition = JSON.parse(
|
|
57
|
+
decodeBase64ToUtf8(
|
|
58
|
+
(chunk.match(/^!!\[([^]+)]$/) ?? [
|
|
59
|
+
void 0,
|
|
60
|
+
void 0
|
|
61
|
+
])[1] ?? ""
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
MessageBlock,
|
|
66
|
+
{
|
|
67
|
+
componentData: definition
|
|
68
|
+
},
|
|
69
|
+
`text_content_${groupIndex}_${blockIndex}_${chunkIndex}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
MDRenderer,
|
|
74
|
+
{
|
|
75
|
+
str: chunk
|
|
76
|
+
},
|
|
77
|
+
`text_content_${groupIndex}_${blockIndex}_${chunkIndex}`
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
}) }, `text_content_${groupIndex}`);
|
|
81
|
+
});
|
|
82
|
+
return parts;
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
export { MessageBlocks };
|
|
87
|
+
//# sourceMappingURL=MessageBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBlocks.js","sources":["../../../../src/chat/ChatController/components/MessageBlocks.tsx"],"sourcesContent":["import { decodeBase64ToUtf8 } from '@apia/util';\r\nimport { TComponentRender } from '../types';\r\nimport { MessageBlock } from './MessageBlock';\r\nimport { MDRenderer } from '@apia/components';\r\nimport { Box } from '@apia/theme';\r\nimport { TDescriberBlock, TQuestionBlock } from '../StreamMessage';\r\nimport { observer } from 'mobx-react-lite';\r\nimport { ThinkingBlocks } from './ThinkingBlocks';\r\nimport { QuestionBlocks } from './QuestionBlocks';\r\n\r\nexport type TBlockType = 'text' | 'describer' | 'question';\r\n\r\nexport type TBaseStreamBlock<T extends TBlockType = TBlockType> = {\r\n blockType: T;\r\n};\r\n\r\nexport type TTextStreamBlock = TBaseStreamBlock<'text'> & { str: string };\r\nexport type TDescriberStreamBlock = TBaseStreamBlock<'describer'> & {\r\n describer: TDescriberBlock;\r\n};\r\nexport type TQuestionStreamBlock = TBaseStreamBlock<'question'> & {\r\n question: TQuestionBlock;\r\n};\r\n\r\nexport type TStreamBlock =\r\n | TTextStreamBlock\r\n | TDescriberStreamBlock\r\n | TQuestionStreamBlock;\r\n\r\ntype TGroupedStreamBlock = {\r\n blockType: TBlockType;\r\n blocks: TStreamBlock[];\r\n};\r\n\r\nexport const MessageBlocks = observer(\r\n ({\r\n streamParts,\r\n showThinkingSkeleton = true,\r\n }: {\r\n streamParts: TStreamBlock[];\r\n showThinkingSkeleton?: boolean;\r\n }) => {\r\n const groupedParts = streamParts.reduce<TGroupedStreamBlock[]>(\r\n (groups, part) => {\r\n const currentGroup = groups[groups.length - 1];\r\n\r\n if (!currentGroup || currentGroup.blockType !== part.blockType) {\r\n groups.push({\r\n blockType: part.blockType,\r\n blocks: [part],\r\n });\r\n return groups;\r\n }\r\n\r\n currentGroup.blocks.push(part);\r\n return groups;\r\n },\r\n [],\r\n );\r\n\r\n const parts = groupedParts.map((group, groupIndex) => {\r\n const isLastGroup = !groupedParts[groupIndex + 1];\r\n\r\n if (group.blockType === 'describer') {\r\n return (\r\n <ThinkingBlocks\r\n key={`tool_calls_${groupIndex}`}\r\n blocks={group.blocks as TDescriberStreamBlock[]}\r\n groupIndex={groupIndex}\r\n isThinking={showThinkingSkeleton && isLastGroup}\r\n />\r\n );\r\n }\r\n\r\n if (group.blockType === 'question') {\r\n return (\r\n <QuestionBlocks\r\n key={`question_content_${groupIndex}`}\r\n blocks={group.blocks as TQuestionStreamBlock[]}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n <Box className=\"text__content\" key={`text_content_${groupIndex}`}>\r\n {group.blocks.flatMap((block, blockIndex) => {\r\n const textBlock = block as TTextStreamBlock;\r\n\r\n return textBlock.str\r\n .split(/(!!\\[[^]+])/g)\r\n .map((chunk, chunkIndex) => {\r\n if (chunk.match(/^!!\\[[^]+]$/)) {\r\n const definition = JSON.parse(\r\n decodeBase64ToUtf8(\r\n (chunk.match(/^!!\\[([^]+)]$/) ?? [\r\n undefined,\r\n undefined,\r\n ])[1] ?? '',\r\n ),\r\n ) as TComponentRender;\r\n\r\n return (\r\n <MessageBlock\r\n key={`text_content_${groupIndex}_${blockIndex}_${chunkIndex}`}\r\n componentData={definition}\r\n ></MessageBlock>\r\n );\r\n }\r\n\r\n return (\r\n <MDRenderer\r\n str={chunk}\r\n key={`text_content_${groupIndex}_${blockIndex}_${chunkIndex}`}\r\n ></MDRenderer>\r\n );\r\n });\r\n })}\r\n </Box>\r\n );\r\n });\r\n\r\n return parts;\r\n },\r\n);\r\n"],"names":[],"mappings":";;;;;;;;;AAkCO,MAAM,aAAA,GAAgB,QAAA;AAAA,EAC3B,CAAC;AAAA,IACC,WAAA;AAAA,IACA,oBAAA,GAAuB;AAAA,GACzB,KAGM;AACJ,IAAA,MAAM,eAAe,WAAA,CAAY,MAAA;AAAA,MAC/B,CAAC,QAAQ,IAAA,KAAS;AAChB,QAAA,MAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,MAAA,GAAS,CAAC,CAAA;AAE7C,QAAA,IAAI,CAAC,YAAA,IAAgB,YAAA,CAAa,SAAA,KAAc,KAAK,SAAA,EAAW;AAC9D,UAAA,MAAA,CAAO,IAAA,CAAK;AAAA,YACV,WAAW,IAAA,CAAK,S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,IAAK;AAAA,kBAC/B,MAAA;AAAA,kBACA;AAAA,iBACF,EAAG,CAAC,CAAA,IAAK;AAAA;AACX,aACF;AAEA,YAAA,uBACE,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBAEC,aAAA,EAAe;AAAA,eAAA;AAAA,cADV,CAAA,aAAA,EAAgB,UAAU,CAAA,CAAA,EAAI,UAAU,IAAI,UAAU,CAAA;AAAA,aAE5D;AAAA;AAIL,UAAA,uBACE,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,GAAA,EAAK;AAAA,aAAA;AAAA,YACA,CAAA,aAAA,EAAgB,UAAU,CAAA,CAAA,EAAI,UAAU,IAAI,UAAU,CAAA;AAAA,WAC5D;AAAA,SAEJ,CAAA;AAAA,OACJ,CAAA,EAAA,EAhCiC,CAAA,aAAA,EAAgB,UAAU,CAAA,CAiC9D,CAAA;AAAA,KAEH,CAAA;AAED,IAAA,OAAO,KAAA;AAAA;AAEX;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { StreamMessage } from '../StreamMessage.js';
|
|
3
|
+
|
|
4
|
+
declare const MessageBody: (({ onRate, store, }: {
|
|
5
|
+
onRate?: (target: HTMLElement, how: "up" | "down") => Promise<boolean>;
|
|
6
|
+
store: StreamMessage;
|
|
7
|
+
}) => react.JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { MessageBody };
|
|
12
|
+
//# sourceMappingURL=MessageBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBody.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|