@zero-library/chat-agent 2.0.0 → 2.0.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/index.cjs.js +173 -90
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -2
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +174 -91
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.css
CHANGED
|
@@ -157,12 +157,11 @@
|
|
|
157
157
|
}
|
|
158
158
|
.styles_module_fileEdit {
|
|
159
159
|
margin: 12px 0;
|
|
160
|
-
width: 250px;
|
|
161
160
|
border-radius: 6px;
|
|
162
161
|
border: 1px solid #f2f2f2;
|
|
163
162
|
}
|
|
164
163
|
.styles_module_fileEdit .styles_module_fileEditHeader {
|
|
165
|
-
padding: 2px;
|
|
164
|
+
padding: 2px 8px;
|
|
166
165
|
background-color: #f2f2f2;
|
|
167
166
|
}
|
|
168
167
|
.styles_module_fileEdit .styles_module_fileEditContent {
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/common/styles.module.less","../src/ui/common/markdownAlert/styles.module.less","../src/components/styles.less","../src/ui/layouts/styles.module.less"],"sourcesContent":[".loadingMessage {\n background-image: linear-gradient(90deg, #ff6b23 0%, #af3cb8 31%, #53b6ff 89%);\n background-size: 100% 2px;\n background-repeat: no-repeat;\n background-position: bottom;\n padding-bottom: 2px;\n}\n.nsConversations {\n padding: 0 24px;\n}\n.nsConversations :global .ant-conversations-group-title {\n padding: 0;\n}\n.nsConversations :global .ant-conversations-group-title .ant-typography {\n color: #878aab;\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item {\n padding-left: 16px;\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item .ant-conversations-label {\n color: rgba(0, 0, 0, 0.88);\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item.ant-conversations-item-active .ant-conversations-label {\n color: var(--ant-color-primary);\n}\n.nsBody {\n background-color: #f6f7fb;\n}\n.nsBody .nsBodyWidth {\n padding: 12px 0;\n margin: 0 auto;\n max-width: 896px;\n min-width: 320px;\n width: calc(100% - 24px) !important;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content-filled {\n background-color: #fff;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble.ant-bubble-end .ant-bubble-content-filled {\n background-color: var(--ant-color-primary-bg);\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content .ant-typography {\n font-size: 16px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse {\n margin-bottom: 16px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-header {\n color: #8f91a8;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-content {\n color: #8f91a8;\n margin-top: -10px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-content .ant-collapse-content-box {\n padding: 0 10px 0 24px;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n.nsAgentHeader {\n padding: 8px 16px;\n background-color: #fff;\n}\n.nsAgentHeader .nsChatTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsAgentHeader .nsChatHeaderPopover {\n max-height: 500px;\n width: 300px;\n display: flex;\n flex-direction: column;\n}\n.nsAgentHeader .nsChatHeaderPopover :global .ant-popover-inner-content {\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.chatWelcomeWrap :global .ant-prompts .ant-prompts-list {\n overflow: auto;\n}\n.chatWelcomeWrap .chatWelcome :global .ant-welcome-icon > img {\n border-radius: 10px;\n max-width: initial;\n}\n.chatWelcomeWrap .chatWelcomePrompts {\n width: 300px;\n}\n.senderListTitle {\n width: 300px;\n}\n.senderList :global .ant-list-items {\n max-height: 350px;\n overflow-y: auto;\n margin-right: -12px;\n padding-right: 12px;\n}\n.senderList.historyList :global .ant-list-items {\n max-height: initial;\n}\n.senderList .senderListItem {\n background-color: #f6f6f6;\n color: #6b6b6b !important;\n border-radius: 5px;\n width: 300px;\n padding: 6px 12px !important;\n margin-top: 12px;\n font-size: 14px;\n cursor: pointer;\n}\n.senderList .senderListFooter {\n font-size: 12px;\n}\n.nsChatUserName {\n font-size: 16px;\n font-weight: bold;\n}\n.nsSenderReferenceHeaderTitle:global > .ant-sender-header-title {\n overflow: hidden;\n}\n.nsSenderReferenceHeaderContent {\n padding: 0 !important;\n}\n",".appCard {\n width: 180px;\n border-radius: 10px;\n border: 1px solid #d7d7d7;\n background-color: #fafafa;\n font-size: 16px;\n cursor: pointer;\n margin: 8px;\n padding: 12px 8px;\n}\n.appCard > div {\n max-width: 100%;\n}\n.appCard > img {\n height: 30px;\n}\n.fileView {\n width: 200px;\n padding: 4px 8px;\n cursor: pointer;\n background-color: #f5f3f3;\n border-radius: 6px;\n}\n.fileEdit {\n margin: 12px 0;\n width: 250px;\n border-radius: 6px;\n border: 1px solid #f2f2f2;\n}\n.fileEdit .fileEditHeader {\n padding: 2px;\n background-color: #f2f2f2;\n}\n.fileEdit .fileEditContent {\n padding: 8px;\n background-color: #fafafa;\n}\n.quoteList {\n min-width: 300px;\n}\n.quoteList:global.ant-collapse .ant-collapse-item .ant-collapse-header {\n padding: 12px 0;\n color: #8f91a8;\n}\n.quoteList:global.ant-collapse .ant-collapse-item .ant-collapse-content {\n color: #8f91a8;\n background-color: #f2f2f2;\n}\n.mdEdit {\n margin: 10px 0;\n background-color: rgba(242, 242, 242, 0.2);\n border: 1px solid #f2f2f2;\n padding: 10px;\n border-radius: 4px;\n}\n",".nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-text {\n display: none;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-circle {\n animation: spin 2s linear infinite;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content {\n gap: 4px;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content .ant-attachment-list-card-desc {\n width: 15px;\n height: 15px;\n border: 2px solid transparent;\n border-color: #1890ff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n box-sizing: border-box;\n position: relative;\n clip-path: inset(0 0 30% 0);\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content .ant-attachment-list-card-desc .ant-attachment-list-card-ellipsis-prefix {\n display: none;\n}\n",".nsPreviewHeader {\n padding: 16px 24px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n}\n.nsPreviewHeader .nsPreviewHeaderTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsChatTitle {\n padding: 24px;\n font-size: 24px;\n text-align: center;\n}\n"],"mappings":";AAAA,CAACA;AACC;AAAA,IAAkB;AAAA,MAAgB,KAAhB;AAAA,MAAuB,QAAQ,EAA/B;AAAA,MAAmC,QAAQ,GAA3C;AAAA,MAAgD,QAAQ;AAC1E,mBAAiB,KAAK;AACtB,qBAAmB;AACnB,uBAAqB;AACrB,kBAAgB;AAClB;AACA,CAACC;AACC,WAAS,EAAE;AACb;AACA,CAHCA,8BAGwB,CAAC;AACxB,WAAS;AACX;AACA,CANCA,8BAMwB,CAHC,8BAG8B,CAAC;AACvD,SAAO;AACT;AACA,CATCA,8BASwB,CAAC,uBAAuB,CAAC;AAChD,gBAAc;AAChB;AACA,CAZCA,8BAYwB,CAHC,uBAGuB,CAHC,uBAGuB,CAAC;AACxE,SAAO,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACvB;AACA,CAfCA,8BAewB,CANC,uBAMuB,CANC,sBAMsB,CAAC,8BAA8B,CAH7B;AAIxE,SAAO,IAAI;AACb;AACA,CAACC;AACC,oBAAkB;AACpB;AACA,CAHCA,qBAGO,CAACC;AAC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AAG,EAAE,GAAG,EAAE;AACtC,UAAQ,IAAI,MAAM;AAClB,WAAS;AACT,iBAAe;AACjB;;;ACtDA,CAAC,cAAc,CAAC,oBAAoB,CAAC,0CAA0C,CAAC,aAAa,CAAC;AAC5F,WAAS;AACX;AACA,CAHC,cAGc,CAHC,oBAGoB,CAHC,0CAG0C,CAHC,aAGa,CAAC;AAC5F,aAAW,KAAK,GAAG,OAAO;AAC5B;AACA,CANC,cAMc,CANC,oBAMoB,CANC,0CAM0C,CAAC;AAC9E,OAAK;AACP;AACA,CATC,cASc,CATC,oBASoB,CATC,0CAS0C,CAHC,iCAGiC,CAAC;AAChH,SAAO;AACP,UAAQ;AACR,UAAQ,IAAI,MAAM;AAClB,gBAAc;AACd,iBAAe;AACf,aAAW,KAAK,GAAG,OAAO;AAC1B,cAAY;AACZ,YAAU;AACV,aAAW,MAAM,EAAE,EAAE,IAAI;AAC3B;AACA,CApBC,cAoBc,CApBC,oBAoBoB,CApBC,0CAoB0C,CAdC,iCAciC,CAXC,8BAW8B,CAAC;AAC/I,WAAS;AACX;;;ACtBA,CAACC;AACC,WAAS,KAAK;AACd,cAAY,EAAE,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACtC;AACA,CAJCA,8BAIgB,CAACC;AAChB,aAAW;AACX,eAAa;AACf;AACA,CAACC;AACC,WAAS;AACT,aAAW;AACX,cAAY;AACd;","names":["loadingMessage","nsConversations","nsBody","nsBodyWidth","nsBubbleList","spin","nsAgentHeader","nsChatTitle","nsChatHeaderPopover","chatWelcomeWrap","chatWelcome","chatWelcomePrompts","senderListTitle","senderList","historyList","senderListItem","senderListFooter","nsChatUserName","nsSenderReferenceHeaderTitle","nsSenderReferenceHeaderContent","appCard","fileView","fileEdit","fileEditHeader","fileEditContent","quoteList","mdEdit","nsPreviewHeader","nsPreviewHeaderTitle","nsChatTitle"]}
|
|
1
|
+
{"version":3,"sources":["../src/ui/common/styles.module.less","../src/ui/common/markdownAlert/styles.module.less","../src/components/styles.less","../src/ui/layouts/styles.module.less"],"sourcesContent":[".loadingMessage {\n background-image: linear-gradient(90deg, #ff6b23 0%, #af3cb8 31%, #53b6ff 89%);\n background-size: 100% 2px;\n background-repeat: no-repeat;\n background-position: bottom;\n padding-bottom: 2px;\n}\n.nsConversations {\n padding: 0 24px;\n}\n.nsConversations :global .ant-conversations-group-title {\n padding: 0;\n}\n.nsConversations :global .ant-conversations-group-title .ant-typography {\n color: #878aab;\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item {\n padding-left: 16px;\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item .ant-conversations-label {\n color: rgba(0, 0, 0, 0.88);\n}\n.nsConversations :global .ant-conversations-list .ant-conversations-item.ant-conversations-item-active .ant-conversations-label {\n color: var(--ant-color-primary);\n}\n.nsBody {\n background-color: #f6f7fb;\n}\n.nsBody .nsBodyWidth {\n padding: 12px 0;\n margin: 0 auto;\n max-width: 896px;\n min-width: 320px;\n width: calc(100% - 24px) !important;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content-filled {\n background-color: #fff;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble.ant-bubble-end .ant-bubble-content-filled {\n background-color: var(--ant-color-primary-bg);\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content .ant-typography {\n font-size: 16px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse {\n margin-bottom: 16px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-header {\n color: #8f91a8;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-content {\n color: #8f91a8;\n margin-top: -10px;\n}\n.nsBubbleList:global.ant-bubble-list .ant-bubble .ant-bubble-content > .ant-collapse .ant-collapse-content .ant-collapse-content-box {\n padding: 0 10px 0 24px;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n.nsAgentHeader {\n padding: 8px 16px;\n background-color: #fff;\n}\n.nsAgentHeader .nsChatTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsAgentHeader .nsChatHeaderPopover {\n max-height: 500px;\n width: 300px;\n display: flex;\n flex-direction: column;\n}\n.nsAgentHeader .nsChatHeaderPopover :global .ant-popover-inner-content {\n min-height: 0;\n display: flex;\n flex-direction: column;\n}\n.chatWelcomeWrap :global .ant-prompts .ant-prompts-list {\n overflow: auto;\n}\n.chatWelcomeWrap .chatWelcome :global .ant-welcome-icon > img {\n border-radius: 10px;\n max-width: initial;\n}\n.chatWelcomeWrap .chatWelcomePrompts {\n width: 300px;\n}\n.senderListTitle {\n width: 300px;\n}\n.senderList :global .ant-list-items {\n max-height: 350px;\n overflow-y: auto;\n margin-right: -12px;\n padding-right: 12px;\n}\n.senderList.historyList :global .ant-list-items {\n max-height: initial;\n}\n.senderList .senderListItem {\n background-color: #f6f6f6;\n color: #6b6b6b !important;\n border-radius: 5px;\n width: 300px;\n padding: 6px 12px !important;\n margin-top: 12px;\n font-size: 14px;\n cursor: pointer;\n}\n.senderList .senderListFooter {\n font-size: 12px;\n}\n.nsChatUserName {\n font-size: 16px;\n font-weight: bold;\n}\n.nsSenderReferenceHeaderTitle:global > .ant-sender-header-title {\n overflow: hidden;\n}\n.nsSenderReferenceHeaderContent {\n padding: 0 !important;\n}\n",".appCard {\n width: 180px;\n border-radius: 10px;\n border: 1px solid #d7d7d7;\n background-color: #fafafa;\n font-size: 16px;\n cursor: pointer;\n margin: 8px;\n padding: 12px 8px;\n}\n.appCard > div {\n max-width: 100%;\n}\n.appCard > img {\n height: 30px;\n}\n.fileView {\n width: 200px;\n padding: 4px 8px;\n cursor: pointer;\n background-color: #f5f3f3;\n border-radius: 6px;\n}\n.fileEdit {\n margin: 12px 0;\n border-radius: 6px;\n border: 1px solid #f2f2f2;\n}\n.fileEdit .fileEditHeader {\n padding: 2px 8px;\n background-color: #f2f2f2;\n}\n.fileEdit .fileEditContent {\n padding: 8px;\n background-color: #fafafa;\n}\n.quoteList {\n min-width: 300px;\n}\n.quoteList:global.ant-collapse .ant-collapse-item .ant-collapse-header {\n padding: 12px 0;\n color: #8f91a8;\n}\n.quoteList:global.ant-collapse .ant-collapse-item .ant-collapse-content {\n color: #8f91a8;\n background-color: #f2f2f2;\n}\n.mdEdit {\n margin: 10px 0;\n background-color: rgba(242, 242, 242, 0.2);\n border: 1px solid #f2f2f2;\n padding: 10px;\n border-radius: 4px;\n}\n",".nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-text {\n display: none;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-circle {\n animation: spin 2s linear infinite;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content {\n gap: 4px;\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content .ant-attachment-list-card-desc {\n width: 15px;\n height: 15px;\n border: 2px solid transparent;\n border-color: #1890ff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n box-sizing: border-box;\n position: relative;\n clip-path: inset(0 0 30% 0);\n}\n.nsAttachments .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content .ant-attachment-list-card-desc .ant-attachment-list-card-ellipsis-prefix {\n display: none;\n}\n",".nsPreviewHeader {\n padding: 16px 24px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);\n}\n.nsPreviewHeader .nsPreviewHeaderTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsChatTitle {\n padding: 24px;\n font-size: 24px;\n text-align: center;\n}\n"],"mappings":";AAAA,CAACA;AACC;AAAA,IAAkB;AAAA,MAAgB,KAAhB;AAAA,MAAuB,QAAQ,EAA/B;AAAA,MAAmC,QAAQ,GAA3C;AAAA,MAAgD,QAAQ;AAC1E,mBAAiB,KAAK;AACtB,qBAAmB;AAC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AE,CAAC,EAAE;AACtC;AACA,CAJCA,8BAIgB,CAACC;AAChB,aAAW;AACX,eAAa;AACf;AACA,CAACC;AACC,WAAS;AACT,aAAW;AACX,cAAY;AACd;","names":["loadingMessage","nsConversations","nsBody","nsBodyWidth","nsBubbleList","spin","nsAgentHeader","nsChatTitle","nsChatHeaderPopover","chatWelcomeWrap","chatWelcome","chatWelcomePrompts","senderListTitle","senderList","historyList","senderListItem","senderListFooter","nsChatUserName","nsSenderReferenceHeaderTitle","nsSenderReferenceHeaderContent","appCard","fileView","fileEdit","fileEditHeader","fileEditContent","quoteList","mdEdit","nsPreviewHeader","nsPreviewHeaderTitle","nsChatTitle"]}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useRefState, useDebounce, isNumber, useSyncInput, shouldRender, RenderWrapper, downloadFile, FilePreview, MarkdownEditor, isObject, isNullOrUnDef, isBoolean, UserAvatar, request as request$1, getCurrentUser, deepMerge,
|
|
2
|
-
import { message, Badge, Button, Flex, Spin, Splitter, Tag, Avatar, Space, Popover, List, Typography, Collapse } from 'antd';
|
|
1
|
+
import { useRefState, useDebounce, isNumber, useSyncInput, shouldRender, RenderWrapper, downloadFile, FilePreview, MarkdownEditor, createValtioContext, isObject, isNullOrUnDef, isBoolean, UserAvatar, request as request$1, getCurrentUser, deepMerge, RenderMarkdown, OK, getToken, TOKEN_KEY, copyText, FileIcon, isExternal } from '@zero-library/common';
|
|
2
|
+
import { message, Badge, Button, Flex, Spin, Splitter, Tag, Avatar, Empty, Space, Popover, List, Typography, Collapse, Drawer } from 'antd';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
3
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
5
6
|
import { CloudUploadOutlined, PaperClipOutlined, CloseOutlined, PlusOutlined, DeleteOutlined, RedoOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, EnterOutlined, CloseCircleOutlined, PlayCircleOutlined, CaretRightOutlined } from '@ant-design/icons';
|
|
6
7
|
import { Attachments, Sender, Suggestion, XProvider, Conversations, Welcome, Prompts, Bubble } from '@ant-design/x';
|
|
7
8
|
import classNames2 from 'classnames';
|
|
8
9
|
import { useSnapshot, proxy } from 'valtio';
|
|
9
|
-
import dayjs from 'dayjs';
|
|
10
10
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
11
11
|
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
@@ -18,6 +18,64 @@ var __export = (target, all) => {
|
|
|
18
18
|
for (var name in all)
|
|
19
19
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
20
|
};
|
|
21
|
+
function transform(source, fieldMap) {
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const [targetKey, mapping] of Object.entries(fieldMap)) {
|
|
24
|
+
const key = targetKey;
|
|
25
|
+
if (typeof mapping === "function") {
|
|
26
|
+
result[key] = mapping(source);
|
|
27
|
+
} else if (typeof mapping === "string" && source && mapping in source) {
|
|
28
|
+
result[key] = source[mapping];
|
|
29
|
+
} else {
|
|
30
|
+
result[key] = mapping;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
function transforms(sources, fieldMap) {
|
|
36
|
+
return sources?.map((source) => transform(source, fieldMap)) || [];
|
|
37
|
+
}
|
|
38
|
+
function buildURLWithParams(url, params) {
|
|
39
|
+
const query = new URLSearchParams(
|
|
40
|
+
Object.entries(params || {}).flatMap(([key, val]) => Array.isArray(val) ? val.map((v) => [key, String(v)]) : [[key, String(val)]])
|
|
41
|
+
).toString();
|
|
42
|
+
return query ? `${url}${url.includes("?") ? "&" : "?"}${query}` : url;
|
|
43
|
+
}
|
|
44
|
+
var copy, classifyTime, getBase64;
|
|
45
|
+
var init_utils = __esm({
|
|
46
|
+
"src/core/utils.ts"() {
|
|
47
|
+
copy = (value) => {
|
|
48
|
+
copyText(value).then(() => {
|
|
49
|
+
message.success("\u590D\u5236\u6210\u529F");
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
classifyTime = (timestamp) => {
|
|
53
|
+
const now = dayjs();
|
|
54
|
+
const target = dayjs(timestamp);
|
|
55
|
+
if (target.isSame(now, "day")) {
|
|
56
|
+
return "\u4ECA\u5929";
|
|
57
|
+
}
|
|
58
|
+
const diffInDays = now.diff(target, "day");
|
|
59
|
+
if (diffInDays < 7) {
|
|
60
|
+
return "\u6700\u8FD1 7 \u5929";
|
|
61
|
+
} else if (diffInDays < 30) {
|
|
62
|
+
return "\u6700\u8FD1 30 \u5929";
|
|
63
|
+
} else if (diffInDays < 180) {
|
|
64
|
+
return "\u6700\u8FD1\u534A\u5E74";
|
|
65
|
+
} else {
|
|
66
|
+
return "\u66F4\u65E9";
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
getBase64 = (file) => {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
const reader = new FileReader();
|
|
72
|
+
reader.onload = () => resolve(reader.result);
|
|
73
|
+
reader.onerror = reject;
|
|
74
|
+
reader.readAsDataURL(file);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
21
79
|
var ChatProvider, useChatStore;
|
|
22
80
|
var init_Context = __esm({
|
|
23
81
|
"src/stores/Context.ts"() {
|
|
@@ -86,6 +144,37 @@ var init_FileView = __esm({
|
|
|
86
144
|
};
|
|
87
145
|
}
|
|
88
146
|
});
|
|
147
|
+
var docQuery;
|
|
148
|
+
var init_file = __esm({
|
|
149
|
+
"src/services/file.ts"() {
|
|
150
|
+
docQuery = (paramsStr) => {
|
|
151
|
+
return request$1.get(`/uc/doc?${paramsStr}`);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var DocDrawer_default;
|
|
156
|
+
var init_DocDrawer = __esm({
|
|
157
|
+
"src/ui/common/markdownAlert/components/DocDrawer.tsx"() {
|
|
158
|
+
init_file();
|
|
159
|
+
DocDrawer_default = ({ title, open, onClose, fileUrl }) => {
|
|
160
|
+
const [content, setContent] = useState("");
|
|
161
|
+
const [loading, setLoading] = useState(false);
|
|
162
|
+
const getContent = async () => {
|
|
163
|
+
try {
|
|
164
|
+
setLoading(true);
|
|
165
|
+
const res = await docQuery(fileUrl);
|
|
166
|
+
setContent(res.data?.content);
|
|
167
|
+
} finally {
|
|
168
|
+
setLoading(false);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
getContent();
|
|
173
|
+
}, [fileUrl]);
|
|
174
|
+
return /* @__PURE__ */ jsx(Drawer, { title, push: false, width: "100%", open, onClose, children: /* @__PURE__ */ jsx(Spin, { spinning: loading, children: content ? /* @__PURE__ */ jsx(RenderMarkdown, { content }) : /* @__PURE__ */ jsx(Empty, { className: "m-t-32" }) }) });
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
});
|
|
89
178
|
|
|
90
179
|
// src/ui/common/markdownAlert/IndexQuote.tsx
|
|
91
180
|
var IndexQuote_exports = {};
|
|
@@ -95,12 +184,30 @@ __export(IndexQuote_exports, {
|
|
|
95
184
|
var IndexQuote_default;
|
|
96
185
|
var init_IndexQuote = __esm({
|
|
97
186
|
"src/ui/common/markdownAlert/IndexQuote.tsx"() {
|
|
187
|
+
init_DocDrawer();
|
|
98
188
|
IndexQuote_default = ({ data, loading }) => {
|
|
189
|
+
const [open, setOpen] = useState(false);
|
|
99
190
|
const onClick = () => {
|
|
100
|
-
|
|
191
|
+
if (!data.fileUrl) return;
|
|
192
|
+
if (isExternal(data.fileUrl)) {
|
|
193
|
+
window.open(data.fileUrl, "_blank");
|
|
194
|
+
} else {
|
|
195
|
+
setOpen(true);
|
|
196
|
+
}
|
|
101
197
|
};
|
|
102
198
|
const Content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsx("a", { onClick, children: data.fileName }) }) });
|
|
103
|
-
|
|
199
|
+
const rootRef = useRef(null);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
const el = rootRef.current;
|
|
202
|
+
if (!el) return;
|
|
203
|
+
const previous = el.previousElementSibling;
|
|
204
|
+
if (!previous) return;
|
|
205
|
+
previous.appendChild(el);
|
|
206
|
+
}, []);
|
|
207
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: "inline-block m-l-8", children: [
|
|
208
|
+
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content: Content, children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data.index }) }) }),
|
|
209
|
+
open && /* @__PURE__ */ jsx(DocDrawer_default, { fileUrl: data.fileUrl, title: data.fileName, open, onClose: () => setOpen(false) })
|
|
210
|
+
] });
|
|
104
211
|
};
|
|
105
212
|
}
|
|
106
213
|
});
|
|
@@ -141,20 +248,27 @@ __export(FileEdit_exports, {
|
|
|
141
248
|
var FileEdit_default;
|
|
142
249
|
var init_FileEdit = __esm({
|
|
143
250
|
"src/ui/common/markdownAlert/FileEdit.tsx"() {
|
|
251
|
+
init_utils();
|
|
144
252
|
init_Context();
|
|
145
253
|
init_styles_module();
|
|
146
254
|
FileEdit_default = ({ data, loading }) => {
|
|
147
255
|
const chatStore = useChatStore();
|
|
148
|
-
const
|
|
256
|
+
const onPreview = () => {
|
|
149
257
|
chatStore.setPreview(data, true);
|
|
150
258
|
};
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
259
|
+
return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: styles_module_default2.fileEdit, children: [
|
|
260
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", justify: "space-between", className: styles_module_default2.fileEditHeader, children: [
|
|
261
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", className: "flex-1", children: [
|
|
262
|
+
/* @__PURE__ */ jsx(FileIcon, { suffix: "md", fontSize: 18 }),
|
|
263
|
+
/* @__PURE__ */ jsx("div", { className: "text-ellipsis", title: data.fileName, children: data.fileName })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
266
|
+
/* @__PURE__ */ jsx(Button, { color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsx(PlayCircleOutlined, {}), onClick: onPreview, children: "\u9884\u89C8\u7F16\u8F91" }),
|
|
267
|
+
/* @__PURE__ */ jsx(Button, { color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsx(CopyOutlined, {}), onClick: () => copy(data.content), children: "\u590D\u5236" })
|
|
268
|
+
] }) })
|
|
269
|
+
] }),
|
|
270
|
+
/* @__PURE__ */ jsx(Flex, { gap: 8, align: "center", className: styles_module_default2.fileEditContent, children: /* @__PURE__ */ jsx(RenderMarkdown, { content: data.content }) })
|
|
271
|
+
] });
|
|
158
272
|
};
|
|
159
273
|
}
|
|
160
274
|
});
|
|
@@ -167,27 +281,39 @@ __export(QuoteList_exports, {
|
|
|
167
281
|
var QuoteList_default;
|
|
168
282
|
var init_QuoteList = __esm({
|
|
169
283
|
"src/ui/common/markdownAlert/QuoteList.tsx"() {
|
|
284
|
+
init_DocDrawer();
|
|
170
285
|
init_styles_module();
|
|
171
286
|
QuoteList_default = ({ data, loading }) => {
|
|
287
|
+
const [open, setOpen] = useState(false);
|
|
288
|
+
const [selectItem, setSelectItem] = useState({});
|
|
172
289
|
const onClick = (item) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
bordered: false,
|
|
180
|
-
ghost: true,
|
|
181
|
-
expandIcon: ({ isActive }) => /* @__PURE__ */ jsx(CaretRightOutlined, { rotate: isActive ? 90 : 0 }),
|
|
182
|
-
items: [
|
|
183
|
-
{
|
|
184
|
-
key: "1",
|
|
185
|
-
label: "\u53C2\u8003\u8D44\u6599",
|
|
186
|
-
children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsx("p", { onClick: () => onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
|
|
187
|
-
}
|
|
188
|
-
]
|
|
290
|
+
if (!item.fileUrl) return;
|
|
291
|
+
if (isExternal(item.fileUrl)) {
|
|
292
|
+
window.open(item.fileUrl, "_blank");
|
|
293
|
+
} else {
|
|
294
|
+
setSelectItem(item);
|
|
295
|
+
setOpen(true);
|
|
189
296
|
}
|
|
190
|
-
|
|
297
|
+
};
|
|
298
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
299
|
+
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(
|
|
300
|
+
Collapse,
|
|
301
|
+
{
|
|
302
|
+
className: styles_module_default2.quoteList,
|
|
303
|
+
bordered: false,
|
|
304
|
+
ghost: true,
|
|
305
|
+
expandIcon: ({ isActive }) => /* @__PURE__ */ jsx(CaretRightOutlined, { rotate: isActive ? 90 : 0 }),
|
|
306
|
+
items: [
|
|
307
|
+
{
|
|
308
|
+
key: "1",
|
|
309
|
+
label: "\u53C2\u8003\u8D44\u6599",
|
|
310
|
+
children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsx("p", { onClick: () => onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
) }),
|
|
315
|
+
open && /* @__PURE__ */ jsx(DocDrawer_default, { fileUrl: selectItem.fileUrl, title: selectItem.title, open, onClose: () => setOpen(false) })
|
|
316
|
+
] });
|
|
191
317
|
};
|
|
192
318
|
}
|
|
193
319
|
});
|
|
@@ -198,59 +324,12 @@ var ChatRoleMap = {
|
|
|
198
324
|
1: "user",
|
|
199
325
|
2: "assistant"
|
|
200
326
|
};
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const now = dayjs();
|
|
208
|
-
const target = dayjs(timestamp);
|
|
209
|
-
if (target.isSame(now, "day")) {
|
|
210
|
-
return "\u4ECA\u5929";
|
|
211
|
-
}
|
|
212
|
-
const diffInDays = now.diff(target, "day");
|
|
213
|
-
if (diffInDays < 7) {
|
|
214
|
-
return "\u6700\u8FD1 7 \u5929";
|
|
215
|
-
} else if (diffInDays < 30) {
|
|
216
|
-
return "\u6700\u8FD1 30 \u5929";
|
|
217
|
-
} else if (diffInDays < 180) {
|
|
218
|
-
return "\u6700\u8FD1\u534A\u5E74";
|
|
219
|
-
} else {
|
|
220
|
-
return "\u66F4\u65E9";
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
function transform(source, fieldMap) {
|
|
224
|
-
const result = {};
|
|
225
|
-
for (const [targetKey, mapping] of Object.entries(fieldMap)) {
|
|
226
|
-
const key = targetKey;
|
|
227
|
-
if (typeof mapping === "function") {
|
|
228
|
-
result[key] = mapping(source);
|
|
229
|
-
} else if (typeof mapping === "string" && source && mapping in source) {
|
|
230
|
-
result[key] = source[mapping];
|
|
231
|
-
} else {
|
|
232
|
-
result[key] = mapping;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return result;
|
|
236
|
-
}
|
|
237
|
-
function transforms(sources, fieldMap) {
|
|
238
|
-
return sources?.map((source) => transform(source, fieldMap)) || [];
|
|
239
|
-
}
|
|
240
|
-
function buildURLWithParams(url, params) {
|
|
241
|
-
const query = new URLSearchParams(
|
|
242
|
-
Object.entries(params || {}).flatMap(([key, val]) => Array.isArray(val) ? val.map((v) => [key, String(v)]) : [[key, String(val)]])
|
|
243
|
-
).toString();
|
|
244
|
-
return query ? `${url}${url.includes("?") ? "&" : "?"}${query}` : url;
|
|
245
|
-
}
|
|
246
|
-
var getBase64 = (file) => {
|
|
247
|
-
return new Promise((resolve, reject) => {
|
|
248
|
-
const reader = new FileReader();
|
|
249
|
-
reader.onload = () => resolve(reader.result);
|
|
250
|
-
reader.onerror = reject;
|
|
251
|
-
reader.readAsDataURL(file);
|
|
252
|
-
});
|
|
253
|
-
};
|
|
327
|
+
|
|
328
|
+
// src/stores/index.ts
|
|
329
|
+
init_utils();
|
|
330
|
+
|
|
331
|
+
// src/core/fetchRequest.ts
|
|
332
|
+
init_utils();
|
|
254
333
|
function processChunk(chunk, onChunk) {
|
|
255
334
|
if (onChunk) {
|
|
256
335
|
onChunk(typeof chunk === "string" ? chunk : JSON.stringify(chunk));
|
|
@@ -357,7 +436,7 @@ var put = (url, data = {}, options = {}) => request(url, data, { ...options, met
|
|
|
357
436
|
var del = (url, data = {}, options = {}) => request(url, data, { ...options, method: "DELETE" });
|
|
358
437
|
var fetchRequest_default = { delete: del, get, post, put };
|
|
359
438
|
|
|
360
|
-
// src/services/index.
|
|
439
|
+
// src/services/index.ts
|
|
361
440
|
var agentInfoQuery = (agentId) => {
|
|
362
441
|
return request$1.get("/agent/detail", { agentId });
|
|
363
442
|
};
|
|
@@ -547,7 +626,7 @@ function createChatStore() {
|
|
|
547
626
|
});
|
|
548
627
|
const setAgentParams = (params = {}) => {
|
|
549
628
|
agent.params = {
|
|
550
|
-
thinkMode: 2,
|
|
629
|
+
thinkMode: "2",
|
|
551
630
|
...params
|
|
552
631
|
};
|
|
553
632
|
};
|
|
@@ -835,7 +914,7 @@ var ConversationList_default = () => {
|
|
|
835
914
|
chatStore.getConversations(agentState.active.id);
|
|
836
915
|
}
|
|
837
916
|
}, [agentState.active.id]);
|
|
838
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "height-full scroll-fade-in", id: "scrollableDiv", children: /* @__PURE__ */ jsx(
|
|
917
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "height-full scroll-fade-in", id: "scrollableDiv", children: conversationsState.list.items.length ? /* @__PURE__ */ jsx(
|
|
839
918
|
InfiniteScroll,
|
|
840
919
|
{
|
|
841
920
|
dataLength: conversationsState.list.items.length,
|
|
@@ -872,13 +951,13 @@ var ConversationList_default = () => {
|
|
|
872
951
|
}
|
|
873
952
|
)
|
|
874
953
|
}
|
|
875
|
-
) }) });
|
|
954
|
+
) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
|
|
876
955
|
};
|
|
877
956
|
var AgentHeader_default = () => {
|
|
878
957
|
const chatStore = useChatStore();
|
|
879
958
|
const agentState = useSnapshot(chatStore.agent);
|
|
880
959
|
const configState = useSnapshot(chatStore.config);
|
|
881
|
-
|
|
960
|
+
useSnapshot(chatStore.conversations);
|
|
882
961
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: styles_module_default.nsAgentHeader, children: [
|
|
883
962
|
/* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", children: [
|
|
884
963
|
/* @__PURE__ */ jsx(
|
|
@@ -905,7 +984,7 @@ var AgentHeader_default = () => {
|
|
|
905
984
|
RenderWrapper,
|
|
906
985
|
{
|
|
907
986
|
control: configState.layout.headerConversationListBtn,
|
|
908
|
-
DefaultComponent:
|
|
987
|
+
DefaultComponent: /* @__PURE__ */ jsx(
|
|
909
988
|
Popover,
|
|
910
989
|
{
|
|
911
990
|
getPopupContainer: (e) => e,
|
|
@@ -965,6 +1044,7 @@ var MessageRender_default = ({ message: message4, placement }) => {
|
|
|
965
1044
|
};
|
|
966
1045
|
|
|
967
1046
|
// src/ui/common/BubbleListItems.tsx
|
|
1047
|
+
init_utils();
|
|
968
1048
|
init_Context();
|
|
969
1049
|
function extractThinkContent(content) {
|
|
970
1050
|
let main = content;
|
|
@@ -1186,6 +1266,9 @@ var BubbleListItems_default = ({ avatar = true }) => {
|
|
|
1186
1266
|
conversationState.active.key
|
|
1187
1267
|
);
|
|
1188
1268
|
};
|
|
1269
|
+
|
|
1270
|
+
// src/components/Attachments.tsx
|
|
1271
|
+
init_utils();
|
|
1189
1272
|
var Attachments_default = forwardRef(({ maxCount, accept, fileSize, fileSizeTip, fileList = [], onChange, extraParams }, ref) => {
|
|
1190
1273
|
const fileListRef = useRef([]);
|
|
1191
1274
|
const [attachedFiles, setAttachedFiles, getAttachedFiles] = useRefState([]);
|
|
@@ -1471,9 +1554,9 @@ var ChatSender_default2 = () => {
|
|
|
1471
1554
|
Button,
|
|
1472
1555
|
{
|
|
1473
1556
|
size: "small",
|
|
1474
|
-
color: agentState.params.thinkMode === 1 ? "primary" : "default",
|
|
1557
|
+
color: agentState.params.thinkMode === "1" ? "primary" : "default",
|
|
1475
1558
|
variant: "filled",
|
|
1476
|
-
onClick: () => chatStore.setAgentParams({ thinkMode: agentState.params.thinkMode === 1 ? 2 : 1 }),
|
|
1559
|
+
onClick: () => chatStore.setAgentParams({ thinkMode: agentState.params.thinkMode === "1" ? "2" : "1" }),
|
|
1477
1560
|
children: "\u6DF1\u5EA6\u601D\u8003"
|
|
1478
1561
|
}
|
|
1479
1562
|
),
|