@zero-library/chat-agent 2.2.7 → 2.2.9
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 +97 -56
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +43 -4
- package/dist/index.d.ts +43 -4
- package/dist/index.esm.js +99 -58
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.css
CHANGED
|
@@ -134,6 +134,14 @@
|
|
|
134
134
|
background-color: var(--ant-color-fill-tertiary) !important;
|
|
135
135
|
color: var(--ant-color-text-tertiary);
|
|
136
136
|
}
|
|
137
|
+
.styles_module_chatQuoteMsg .styles_module_quoteTooltip {
|
|
138
|
+
max-width: 100%;
|
|
139
|
+
border: 1px solid #000;
|
|
140
|
+
}
|
|
141
|
+
.styles_module_chatQuoteMsg .styles_module_quoteTooltip .styles_module_quoteTooltipContainer {
|
|
142
|
+
max-height: 200px;
|
|
143
|
+
overflow-y: auto;
|
|
144
|
+
}
|
|
137
145
|
|
|
138
146
|
/* src/ui/common/styles.module.less */
|
|
139
147
|
.styles_module_nsConversationListPanel {
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/common/markdownAlert/styles.module.less","../src/components/styles.module.less","../src/ui/common/styles.module.less","../src/ui/layouts/styles.module.less"],"sourcesContent":[".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.think:global.ant-collapse {\n margin-bottom: 16px;\n}\n.think:global.ant-collapse .ant-collapse-header {\n color: #8f91a8;\n}\n.think:global.ant-collapse .ant-collapse-content {\n color: #8f91a8;\n}\n.think:global.ant-collapse .ant-collapse-content .ant-collapse-content-box {\n padding: 0 10px 0 24px;\n}\n","@keyframes loading-line {\n from {\n background-position: 200% 0;\n }\n to {\n background-position: 0 0;\n }\n}\n.loadingMessage {\n position: relative;\n padding-bottom: 6px;\n}\n.loadingMessage::after {\n content: '';\n position: absolute;\n left: 0;\n bottom: 0;\n height: 2px;\n width: 100%;\n background: linear-gradient(90deg, #ff6b23, #af3cb8, #53b6ff);\n background-size: 200% 100%;\n animation: loading-line 1.2s linear infinite;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-text {\n display: none;\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-circle {\n animation: spin 2s linear infinite;\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content {\n gap: 4px;\n}\n.chatAttachments:global > .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.chatAttachments:global > .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.chatSender:global.ant-sender:focus-within {\n box-shadow: none;\n}\n.chatQuoteMsg {\n margin-top: 4px;\n}\n.chatQuoteMsg:global.ant-bubble > .ant-bubble-content {\n min-height: auto;\n background-color: var(--ant-color-fill-tertiary) !important;\n color: var(--ant-color-text-tertiary);\n}\n",".nsConversationListPanel {\n width: 360px;\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.nsBubbleList:global.ant-bubble-list .ant-bubble.ant-bubble-start .ant-bubble-content-filled {\n background-color: transparent;\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.nsChatHeader {\n padding: 8px 16px;\n border-bottom: 1px solid #eee;\n}\n.nsChatHeader .nsChatTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsChatHeader .nsChatHeaderPopover {\n max-height: 500px;\n width: 300px;\n display: flex;\n flex-direction: column;\n}\n.nsChatHeader .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.nsSenderListTitle {\n width: 300px;\n}\n.nsSenderList :global .ant-list-items {\n max-height: 350px;\n overflow-y: auto;\n margin-right: -12px;\n padding-right: 12px;\n}\n.nsSenderList.historyList :global .ant-list-items {\n max-height: initial;\n}\n.nsSenderList .nsSenderListItem {\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.nsSenderList .nsSenderListFooter {\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.nsAvatarListContainer {\n height: 300px;\n padding: 30px 48px 30px 24px;\n overflow-y: auto;\n margin-right: -24px;\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem:hover {\n opacity: 90%;\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem .nsAvatarListItemIcon.nsAvatarListItemIconActive {\n outline: 2px solid var(--ant-color-primary);\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem .nsAvatarListItemName {\n font-size: 12px;\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.nsChatSenderHeader {\n margin-bottom: 16px;\n padding: 24px;\n font-size: 24px;\n text-align: center;\n}\n.nsDisclaimerNotice {\n font-size: 12px;\n text-align: center;\n color: #bfbfbf;\n}\n.nsChatLayout {\n background-color: #fff;\n}\n.nsChatLayout .nsChatBody {\n padding: 8px 0;\n}\n.nsBodyWidth {\n margin: 0 auto;\n max-width: 896px;\n min-width: 320px;\n width: calc(100% - 24px);\n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AACC;AACC,aAAW;AACX,eAAa;AACf;AACA,CAACC,2CAAoC,EAAE,CAAC;AACtC,YAAU;AACZ;AACA,CAACC;AACC,WAAS;AACX;AACA,CAACC;AACC,UAAQ;AACR,WAAS,KAAK,KAAK,KAAK;AACxB,cAAY;AACZ,gBAAc;AAChB;AACA,CANCA,oCAMsB,CAACC,2BAAa,CAACC,8BAAgB;AACpD,WAAS;AACX;AACA,CATCF,oCASsB,CAHCC,2BAGa,CAHCC,+BAGiB,CAACC,kCAAoB,CAACC;AAC3E,WAAS,IAAI,MAAM,IAAI;AACzB;AACA,CAZCJ,oCAYsB,CANCC,2BAMa,CANCC,+BAMiB,CAACG;AACtD,aAAW;AACb;;;ACzGA,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,iBAAe;AACf,WAAS;AACT,aAAW;AACX,cAAY;AACd;AACA,CAACC;AACC,aAAW;AACX,cAAY;AACZ,SAAO;AACT;AACA,CAACC;AACC,oBAAkB;AACpB;AACA,CAHCA,2BAGa,CAACC;AACb,WAAS,IAAI;AACf;AACA,CAACC;AACC,UAAQ,EAAE;AACV,aAAW;AACX,aAAW;AACX,SAAO,KAAK,KAAK,EAAE;AACrB;","names":["appCard","fileView","fileEdit","fileEditHeader","fileEditContent","quoteList","mdEdit","think","loading-line","loadingMessage","spin","chatAttachments","chatSender","chatQuoteMsg","nsConversationListPanel","nsConversations","nsBubbleList","nsChatHeader","nsChatTitle","nsChatHeaderPopover","chatWelcomeWrap","chatWelcome","chatWelcomePrompts","nsSenderListTitle","nsSenderList","historyList","nsSenderListItem","nsSenderListFooter","nsChatUserName","nsSenderReferenceHeaderTitle","nsSenderReferenceHeaderContent","nsAvatarListContainer","nsAvatarList","nsAvatarListItem","nsAvatarListItemIcon","nsAvatarListItemIconActive","nsAvatarListItemName","nsPreviewHeader","nsPreviewHeaderTitle","nsChatSenderHeader","nsDisclaimerNotice","nsChatLayout","nsChatBody","nsBodyWidth"]}
|
|
1
|
+
{"version":3,"sources":["../src/ui/common/markdownAlert/styles.module.less","../src/components/styles.module.less","../src/ui/common/styles.module.less","../src/ui/layouts/styles.module.less"],"sourcesContent":[".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.think:global.ant-collapse {\n margin-bottom: 16px;\n}\n.think:global.ant-collapse .ant-collapse-header {\n color: #8f91a8;\n}\n.think:global.ant-collapse .ant-collapse-content {\n color: #8f91a8;\n}\n.think:global.ant-collapse .ant-collapse-content .ant-collapse-content-box {\n padding: 0 10px 0 24px;\n}\n","@keyframes loading-line {\n from {\n background-position: 200% 0;\n }\n to {\n background-position: 0 0;\n }\n}\n.loadingMessage {\n position: relative;\n padding-bottom: 6px;\n}\n.loadingMessage::after {\n content: '';\n position: absolute;\n left: 0;\n bottom: 0;\n height: 2px;\n width: 100%;\n background: linear-gradient(90deg, #ff6b23, #af3cb8, #53b6ff);\n background-size: 200% 100%;\n animation: loading-line 1.2s linear infinite;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-text {\n display: none;\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-progress .ant-progress-circle {\n animation: spin 2s linear infinite;\n}\n.chatAttachments:global > .ant-attachment-list .ant-attachment-list-card-status-uploading .ant-attachment-list-card-content {\n gap: 4px;\n}\n.chatAttachments:global > .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.chatAttachments:global > .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.chatSender:global.ant-sender:focus-within {\n box-shadow: none;\n}\n.chatQuoteMsg {\n margin-top: 4px;\n}\n.chatQuoteMsg:global.ant-bubble > .ant-bubble-content {\n min-height: auto;\n background-color: var(--ant-color-fill-tertiary) !important;\n color: var(--ant-color-text-tertiary);\n}\n.chatQuoteMsg .quoteTooltip {\n max-width: 100%;\n border: 1px solid #000;\n}\n.chatQuoteMsg .quoteTooltip .quoteTooltipContainer {\n max-height: 200px;\n overflow-y: auto;\n}\n",".nsConversationListPanel {\n width: 360px;\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.nsBubbleList:global.ant-bubble-list .ant-bubble.ant-bubble-start .ant-bubble-content-filled {\n background-color: transparent;\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.nsChatHeader {\n padding: 8px 16px;\n border-bottom: 1px solid #eee;\n}\n.nsChatHeader .nsChatTitle {\n font-size: 16px;\n font-weight: bold;\n}\n.nsChatHeader .nsChatHeaderPopover {\n max-height: 500px;\n width: 300px;\n display: flex;\n flex-direction: column;\n}\n.nsChatHeader .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.nsSenderListTitle {\n width: 300px;\n}\n.nsSenderList :global .ant-list-items {\n max-height: 350px;\n overflow-y: auto;\n margin-right: -12px;\n padding-right: 12px;\n}\n.nsSenderList.historyList :global .ant-list-items {\n max-height: initial;\n}\n.nsSenderList .nsSenderListItem {\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.nsSenderList .nsSenderListFooter {\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.nsAvatarListContainer {\n height: 300px;\n padding: 30px 48px 30px 24px;\n overflow-y: auto;\n margin-right: -24px;\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem:hover {\n opacity: 90%;\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem .nsAvatarListItemIcon.nsAvatarListItemIconActive {\n outline: 2px solid var(--ant-color-primary);\n}\n.nsAvatarListContainer .nsAvatarList .nsAvatarListItem .nsAvatarListItemName {\n font-size: 12px;\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.nsChatSenderHeader {\n margin-bottom: 16px;\n padding: 24px;\n font-size: 24px;\n text-align: center;\n}\n.nsDisclaimerNotice {\n font-size: 12px;\n text-align: center;\n color: #bfbfbf;\n}\n.nsChatLayout {\n background-color: #fff;\n}\n.nsChatLayout .nsChatBody {\n padding: 8px 0;\n}\n.nsBodyWidth {\n margin: 0 auto;\n max-width: 896px;\n min-width: 320px;\n width: calc(100% - 24px);\n}\n"],"mappings":";AAAA,CAACA;AACC,SAAO;AACP,iBAAe;AACf,UAAQ,IAAI,MAAM;AAClB,oBAAkB;AAClB,aAAW;AACX,UAAQ;AACR,UAAQ;AACR,WAAS,KAAK;AAChB;AACA,CAVCA,sBAUQ,EAAE;AACT,aAAW;AACb;AACA,CAbCA,sBAaQ,EAAE;AACT,UAAQ;AACV;AACA,CAACC;AACC,SAAO;AACP,WAAS,IAAI;AACb,UAAQ;AACR,oBAAkB;AAClB,iBAAe;AACjB;AACA,CAACC;AACC,UAAQ,KAAK;AACb,iBAAe;AACf,UAAQ,IAAI,MAAM;AACpB;AACA,CALCA,uBAKS,CAACC;AACT,WAAS,IAAI;AACb,oBAAkB;AACpB;AACA,CATCD,uBASS,CAACE;AACT,WAAS;AACT,oBAAkB;AACpB;AACA,CAACC;AACC,aAAW;AACb;AACA,CAHCA,uBAGgB,CAAC,aAAa,CAAC,kBAAkB,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zGA,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,iBAAe;AACf,WAAS;AACT,aAAW;AACX,cAAY;AACd;AACA,CAACC;AACC,aAAW;AACX,cAAY;AACZ,SAAO;AACT;AACA,CAACC;AACC,oBAAkB;AACpB;AACA,CAHCA,2BAGa,CAACC;AACb,WAAS,IAAI;AACf;AACA,CAACC;AACC,UAAQ,EAAE;AACV,aAAW;AACX,aAAW;AACX,SAAO,KAAK,KAAK,EAAE;AACrB;","names":["appCard","fileView","fileEdit","fileEditHeader","fileEditContent","quoteList","mdEdit","think","loading-line","loadingMessage","spin","chatAttachments","chatSender","chatQuoteMsg","quoteTooltip","quoteTooltipContainer","nsConversationListPanel","nsConversations","nsBubbleList","nsChatHeader","nsChatTitle","nsChatHeaderPopover","chatWelcomeWrap","chatWelcome","chatWelcomePrompts","nsSenderListTitle","nsSenderList","historyList","nsSenderListItem","nsSenderListFooter","nsChatUserName","nsSenderReferenceHeaderTitle","nsSenderReferenceHeaderContent","nsAvatarListContainer","nsAvatarList","nsAvatarListItem","nsAvatarListItemIcon","nsAvatarListItemIconActive","nsAvatarListItemName","nsPreviewHeader","nsPreviewHeaderTitle","nsChatSenderHeader","nsDisclaimerNotice","nsChatLayout","nsChatBody","nsBodyWidth"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -465,6 +465,30 @@ declare const createFileService: (request: ReturnType<typeof createRequest>) =>
|
|
|
465
465
|
* - 2: 新会话策略 - 创建全新的会话开始对话
|
|
466
466
|
*/
|
|
467
467
|
type ConversationStrategy = 1 | 2;
|
|
468
|
+
/**
|
|
469
|
+
* 文件URL类型接口
|
|
470
|
+
* 定义通过URL访问的文件信息
|
|
471
|
+
*/
|
|
472
|
+
interface FileUrlType {
|
|
473
|
+
/** 文件后缀名 */
|
|
474
|
+
suffix: string;
|
|
475
|
+
/** 文件访问URL */
|
|
476
|
+
fileUrl: string;
|
|
477
|
+
/** 文件名 */
|
|
478
|
+
fileName: string;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* 文件文本类型接口
|
|
482
|
+
* 定义包含文本内容的文件信息
|
|
483
|
+
*/
|
|
484
|
+
interface FileTextType {
|
|
485
|
+
/** 文件内容 */
|
|
486
|
+
content: string;
|
|
487
|
+
/** 文件后缀名 */
|
|
488
|
+
suffix: string;
|
|
489
|
+
/** 文件名 */
|
|
490
|
+
fileName: string;
|
|
491
|
+
}
|
|
468
492
|
/**
|
|
469
493
|
* 引用内容接口
|
|
470
494
|
* 扩展消息引用信息,支持更多引用格式
|
|
@@ -481,8 +505,6 @@ interface ReferencesContent extends MessageQuoteMsg {
|
|
|
481
505
|
name?: string;
|
|
482
506
|
/** Markdown格式的引用内容 */
|
|
483
507
|
markdown?: string;
|
|
484
|
-
/** 其他扩展属性 */
|
|
485
|
-
[key: string]: any;
|
|
486
508
|
}
|
|
487
509
|
/**
|
|
488
510
|
* 引用类型接口
|
|
@@ -889,6 +911,21 @@ interface ChatHooks {
|
|
|
889
911
|
* }
|
|
890
912
|
*/
|
|
891
913
|
onAppRightVerify?: (appKey: string) => boolean | Promise<boolean> | void;
|
|
914
|
+
/**
|
|
915
|
+
* 文件预览前的回调函数
|
|
916
|
+
* 在文件预览打开或关闭之前执行,可以用于控制布局、阻止预览等
|
|
917
|
+
* @param file - 要预览的文件对象, 如果不存在则表示关闭预览
|
|
918
|
+
* @param isBuiltIn - 是否为内嵌布局
|
|
919
|
+
* @returns 返回 boolean、Promise<boolean> 或 void,用于控制是否继续预览
|
|
920
|
+
*/
|
|
921
|
+
onBeforeFilePreview?: (file?: FileUrlType | FileTextType, isBuiltIn?: boolean) => boolean | Promise<boolean> | void;
|
|
922
|
+
/**
|
|
923
|
+
* 文件预览后的回调函数
|
|
924
|
+
* 在文件预览打开或关闭之后执行,可以用于控制布局等
|
|
925
|
+
* @param file - 预览的文件对象, 如果不存在则表示已经关闭预览
|
|
926
|
+
* @param isBuiltIn - 是否为内嵌布局
|
|
927
|
+
*/
|
|
928
|
+
onAfterFilePreview?: (file?: FileUrlType | FileTextType, isBuiltIn?: boolean) => void;
|
|
892
929
|
}
|
|
893
930
|
/**
|
|
894
931
|
* 聊天参数接口
|
|
@@ -1363,7 +1400,7 @@ interface ChatHandle {
|
|
|
1363
1400
|
*
|
|
1364
1401
|
* @example
|
|
1365
1402
|
* // 清除引用
|
|
1366
|
-
* chatRef.current?.setReferences(
|
|
1403
|
+
* chatRef.current?.setReferences()
|
|
1367
1404
|
*/
|
|
1368
1405
|
setReferences: (references?: ReferencesType) => void;
|
|
1369
1406
|
/**
|
|
@@ -1560,11 +1597,13 @@ interface MessageRenderProps {
|
|
|
1560
1597
|
message: ConversationMessage;
|
|
1561
1598
|
/** 消息气泡位置 */
|
|
1562
1599
|
placement: BubbleProps['placement'];
|
|
1600
|
+
/** 文件预览回调 非图片类型文件点击预览 */
|
|
1601
|
+
onFilePreview?: (file: InputFile) => void;
|
|
1563
1602
|
}
|
|
1564
1603
|
/**
|
|
1565
1604
|
* 消息渲染组件
|
|
1566
1605
|
* 用于渲染聊天消息内容,包括文本、文件附件和引用消息
|
|
1567
1606
|
*/
|
|
1568
|
-
declare const _default: ({ message, placement }: MessageRenderProps) => react_jsx_runtime.JSX.Element;
|
|
1607
|
+
declare const _default: ({ message, placement, onFilePreview }: MessageRenderProps) => react_jsx_runtime.JSX.Element;
|
|
1569
1608
|
|
|
1570
1609
|
export { type AgentInfo, _default$3 as Attachments, type AttachmentsProps, type ChatConfig, _default$1 as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ChatServices, type ConversationStrategy, type InputFile, _default as MessageRender, type MessageRenderProps, type ReferencesType, type RequestInstance, type SenderProps, type UserInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -465,6 +465,30 @@ declare const createFileService: (request: ReturnType<typeof createRequest>) =>
|
|
|
465
465
|
* - 2: 新会话策略 - 创建全新的会话开始对话
|
|
466
466
|
*/
|
|
467
467
|
type ConversationStrategy = 1 | 2;
|
|
468
|
+
/**
|
|
469
|
+
* 文件URL类型接口
|
|
470
|
+
* 定义通过URL访问的文件信息
|
|
471
|
+
*/
|
|
472
|
+
interface FileUrlType {
|
|
473
|
+
/** 文件后缀名 */
|
|
474
|
+
suffix: string;
|
|
475
|
+
/** 文件访问URL */
|
|
476
|
+
fileUrl: string;
|
|
477
|
+
/** 文件名 */
|
|
478
|
+
fileName: string;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* 文件文本类型接口
|
|
482
|
+
* 定义包含文本内容的文件信息
|
|
483
|
+
*/
|
|
484
|
+
interface FileTextType {
|
|
485
|
+
/** 文件内容 */
|
|
486
|
+
content: string;
|
|
487
|
+
/** 文件后缀名 */
|
|
488
|
+
suffix: string;
|
|
489
|
+
/** 文件名 */
|
|
490
|
+
fileName: string;
|
|
491
|
+
}
|
|
468
492
|
/**
|
|
469
493
|
* 引用内容接口
|
|
470
494
|
* 扩展消息引用信息,支持更多引用格式
|
|
@@ -481,8 +505,6 @@ interface ReferencesContent extends MessageQuoteMsg {
|
|
|
481
505
|
name?: string;
|
|
482
506
|
/** Markdown格式的引用内容 */
|
|
483
507
|
markdown?: string;
|
|
484
|
-
/** 其他扩展属性 */
|
|
485
|
-
[key: string]: any;
|
|
486
508
|
}
|
|
487
509
|
/**
|
|
488
510
|
* 引用类型接口
|
|
@@ -889,6 +911,21 @@ interface ChatHooks {
|
|
|
889
911
|
* }
|
|
890
912
|
*/
|
|
891
913
|
onAppRightVerify?: (appKey: string) => boolean | Promise<boolean> | void;
|
|
914
|
+
/**
|
|
915
|
+
* 文件预览前的回调函数
|
|
916
|
+
* 在文件预览打开或关闭之前执行,可以用于控制布局、阻止预览等
|
|
917
|
+
* @param file - 要预览的文件对象, 如果不存在则表示关闭预览
|
|
918
|
+
* @param isBuiltIn - 是否为内嵌布局
|
|
919
|
+
* @returns 返回 boolean、Promise<boolean> 或 void,用于控制是否继续预览
|
|
920
|
+
*/
|
|
921
|
+
onBeforeFilePreview?: (file?: FileUrlType | FileTextType, isBuiltIn?: boolean) => boolean | Promise<boolean> | void;
|
|
922
|
+
/**
|
|
923
|
+
* 文件预览后的回调函数
|
|
924
|
+
* 在文件预览打开或关闭之后执行,可以用于控制布局等
|
|
925
|
+
* @param file - 预览的文件对象, 如果不存在则表示已经关闭预览
|
|
926
|
+
* @param isBuiltIn - 是否为内嵌布局
|
|
927
|
+
*/
|
|
928
|
+
onAfterFilePreview?: (file?: FileUrlType | FileTextType, isBuiltIn?: boolean) => void;
|
|
892
929
|
}
|
|
893
930
|
/**
|
|
894
931
|
* 聊天参数接口
|
|
@@ -1363,7 +1400,7 @@ interface ChatHandle {
|
|
|
1363
1400
|
*
|
|
1364
1401
|
* @example
|
|
1365
1402
|
* // 清除引用
|
|
1366
|
-
* chatRef.current?.setReferences(
|
|
1403
|
+
* chatRef.current?.setReferences()
|
|
1367
1404
|
*/
|
|
1368
1405
|
setReferences: (references?: ReferencesType) => void;
|
|
1369
1406
|
/**
|
|
@@ -1560,11 +1597,13 @@ interface MessageRenderProps {
|
|
|
1560
1597
|
message: ConversationMessage;
|
|
1561
1598
|
/** 消息气泡位置 */
|
|
1562
1599
|
placement: BubbleProps['placement'];
|
|
1600
|
+
/** 文件预览回调 非图片类型文件点击预览 */
|
|
1601
|
+
onFilePreview?: (file: InputFile) => void;
|
|
1563
1602
|
}
|
|
1564
1603
|
/**
|
|
1565
1604
|
* 消息渲染组件
|
|
1566
1605
|
* 用于渲染聊天消息内容,包括文本、文件附件和引用消息
|
|
1567
1606
|
*/
|
|
1568
|
-
declare const _default: ({ message, placement }: MessageRenderProps) => react_jsx_runtime.JSX.Element;
|
|
1607
|
+
declare const _default: ({ message, placement, onFilePreview }: MessageRenderProps) => react_jsx_runtime.JSX.Element;
|
|
1569
1608
|
|
|
1570
1609
|
export { type AgentInfo, _default$3 as Attachments, type AttachmentsProps, type ChatConfig, _default$1 as ChatCopilot, type ChatHandle, type ChatHooks, type ChatLayout, type ChatParams, type ChatProps, _default$2 as ChatSender, type ChatServices, type ConversationStrategy, type InputFile, _default as MessageRender, type MessageRenderProps, type ReferencesType, type RequestInstance, type SenderProps, type UserInfo };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal } from '@zero-library/common';
|
|
2
|
-
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty, Modal, Row, Col, Collapse, Drawer } from 'antd';
|
|
1
|
+
import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, markdownToText, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, isEmptyObj, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal } from '@zero-library/common';
|
|
2
|
+
import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty, Tooltip, Modal, Row, Col, Collapse, Drawer } from 'antd';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
5
5
|
import { useSnapshot, proxy } from 'valtio';
|
|
@@ -273,7 +273,7 @@ var classifyTime = (timestamp) => {
|
|
|
273
273
|
return "\u66F4\u65E9";
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
-
var
|
|
276
|
+
var replaceMarkdownTags = (str) => {
|
|
277
277
|
return str.replace(/<think>/g, ":::alert type=think data={content:'").replace(/<\/think>/g, "'} :::");
|
|
278
278
|
};
|
|
279
279
|
var getChatSocketUrl = (baseURL, params) => {
|
|
@@ -460,8 +460,13 @@ function createChatStore() {
|
|
|
460
460
|
config.services.websocketUrls = [url, ""];
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
|
-
const setPreview = (file = {}, isEdit = false) => {
|
|
464
|
-
|
|
463
|
+
const setPreview = async (file = {}, isEdit = false) => {
|
|
464
|
+
const preview = shouldRender(config.layout.preview);
|
|
465
|
+
const canProceed = await config.hooks?.onBeforeFilePreview?.(file, preview);
|
|
466
|
+
if (canProceed === false) {
|
|
467
|
+
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
468
|
+
}
|
|
469
|
+
if (preview) {
|
|
465
470
|
config.preview = {
|
|
466
471
|
file,
|
|
467
472
|
isEdit
|
|
@@ -469,10 +474,11 @@ function createChatStore() {
|
|
|
469
474
|
} else {
|
|
470
475
|
if (file?.fileUrl) {
|
|
471
476
|
window.open(file.fileUrl, "_blank");
|
|
472
|
-
} else {
|
|
477
|
+
} else if (file?.content) {
|
|
473
478
|
console.log("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u9884\u89C8");
|
|
474
479
|
}
|
|
475
480
|
}
|
|
481
|
+
config.hooks?.onAfterFilePreview?.(file, preview);
|
|
476
482
|
};
|
|
477
483
|
const setLayout = (layout, receiverType = 3) => {
|
|
478
484
|
const defaultLayout = receiverType === 3 ? defaultAgentLayout : defaultExpertLayout;
|
|
@@ -791,7 +797,7 @@ function createChatStore() {
|
|
|
791
797
|
throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
|
|
792
798
|
}
|
|
793
799
|
await initConversation(conversationId);
|
|
794
|
-
setPreview();
|
|
800
|
+
await setPreview();
|
|
795
801
|
config.hooks?.onAfterSwitchConversation?.(conversationId);
|
|
796
802
|
try {
|
|
797
803
|
if (conversation.active.member.agent) {
|
|
@@ -1073,28 +1079,50 @@ var styles_module_default2 = {
|
|
|
1073
1079
|
loadingMessage: "styles_module_loadingMessage",
|
|
1074
1080
|
chatAttachments: "styles_module_chatAttachments",
|
|
1075
1081
|
chatSender: "styles_module_chatSender",
|
|
1076
|
-
chatQuoteMsg: "styles_module_chatQuoteMsg"
|
|
1082
|
+
chatQuoteMsg: "styles_module_chatQuoteMsg",
|
|
1083
|
+
quoteTooltip: "styles_module_quoteTooltip",
|
|
1084
|
+
quoteTooltipContainer: "styles_module_quoteTooltipContainer"
|
|
1077
1085
|
};
|
|
1078
|
-
var MessageRender_default = ({ message: message2, placement }) => {
|
|
1079
|
-
const
|
|
1086
|
+
var MessageRender_default = ({ message: message2, placement, onFilePreview }) => {
|
|
1087
|
+
const msgContent = useMemo(
|
|
1080
1088
|
() => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
|
|
1081
1089
|
[message2.msgContent, message2.tempContent]
|
|
1082
1090
|
);
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1091
|
+
const quoteMsg = useMemo(() => {
|
|
1092
|
+
const quoteMsg2 = {};
|
|
1093
|
+
if (message2.quoteMsg?.id) {
|
|
1094
|
+
if (message2.quoteMsg.msgContent) {
|
|
1095
|
+
quoteMsg2.msgContent = message2.quoteMsg.msgContent;
|
|
1096
|
+
}
|
|
1097
|
+
if (message2.quoteMsg.msgFiles?.length) {
|
|
1098
|
+
quoteMsg2.msgFiles = message2.quoteMsg.msgFiles;
|
|
1099
|
+
}
|
|
1100
|
+
} else if (message2.params) {
|
|
1101
|
+
try {
|
|
1102
|
+
const citation = JSON.parse(message2.params).citation;
|
|
1103
|
+
if (citation) {
|
|
1104
|
+
quoteMsg2.msgContent = citation;
|
|
1105
|
+
}
|
|
1106
|
+
} catch (e) {
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
if (quoteMsg2.msgContent) {
|
|
1110
|
+
quoteMsg2.msgContentText = markdownToText(quoteMsg2.msgContent);
|
|
1088
1111
|
}
|
|
1089
|
-
return
|
|
1090
|
-
}, [message2.params]);
|
|
1091
|
-
|
|
1092
|
-
content &&
|
|
1112
|
+
return isEmptyObj(quoteMsg2) ? null : quoteMsg2;
|
|
1113
|
+
}, [message2.params, message2.quoteMsg]);
|
|
1114
|
+
const filePreview = (file) => {
|
|
1115
|
+
if (file.content && !["image"].includes(file.type)) {
|
|
1116
|
+
onFilePreview?.(file);
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
return /* @__PURE__ */ jsx(Flex, { vertical: true, children: !(msgContent || message2.msgFiles.length) ? /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(Spin, { size: "small" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1120
|
+
msgContent && /* @__PURE__ */ jsx(
|
|
1093
1121
|
Bubble,
|
|
1094
1122
|
{
|
|
1095
1123
|
placement,
|
|
1096
1124
|
className: classNames9({ [styles_module_default2.loadingMessage]: message2.type }),
|
|
1097
|
-
content: /* @__PURE__ */ jsx(RenderMarkdown, { content:
|
|
1125
|
+
content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceMarkdownTags(msgContent), customComponents, message: message2 })
|
|
1098
1126
|
}
|
|
1099
1127
|
),
|
|
1100
1128
|
message2.msgFiles?.map((file) => /* @__PURE__ */ jsx(
|
|
@@ -1103,7 +1131,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1103
1131
|
className: "m-t-8",
|
|
1104
1132
|
variant: "borderless",
|
|
1105
1133
|
placement,
|
|
1106
|
-
content: /* @__PURE__ */ jsx(
|
|
1134
|
+
content: /* @__PURE__ */ jsx("div", { className: "cursor-pointer", onClick: () => filePreview(file), children: /* @__PURE__ */ jsx(
|
|
1107
1135
|
Attachments.FileCard,
|
|
1108
1136
|
{
|
|
1109
1137
|
item: {
|
|
@@ -1111,25 +1139,36 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1111
1139
|
name: file.name,
|
|
1112
1140
|
url: file.content
|
|
1113
1141
|
}
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
)
|
|
1142
|
+
}
|
|
1143
|
+
) })
|
|
1117
1144
|
},
|
|
1118
1145
|
file.content
|
|
1119
1146
|
)),
|
|
1120
|
-
|
|
1147
|
+
quoteMsg && /* @__PURE__ */ jsx(
|
|
1121
1148
|
Bubble,
|
|
1122
1149
|
{
|
|
1123
|
-
className:
|
|
1150
|
+
className: styles_module_default2.chatQuoteMsg,
|
|
1124
1151
|
placement,
|
|
1125
1152
|
content: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1153
|
+
quoteMsg.msgContent && /* @__PURE__ */ jsx(
|
|
1154
|
+
Tooltip,
|
|
1155
|
+
{
|
|
1156
|
+
color: "#fff",
|
|
1157
|
+
classNames: {
|
|
1158
|
+
root: styles_module_default2.quoteTooltip,
|
|
1159
|
+
body: `${styles_module_default2.quoteTooltipContainer} scroll-fade-in`
|
|
1160
|
+
},
|
|
1161
|
+
title: /* @__PURE__ */ jsx(RenderMarkdown, { content: quoteMsg.msgContent }),
|
|
1162
|
+
getPopupContainer: (node) => node,
|
|
1163
|
+
children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1164
|
+
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1165
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis-2", children: quoteMsg.msgContentText })
|
|
1166
|
+
] })
|
|
1167
|
+
}
|
|
1168
|
+
),
|
|
1169
|
+
quoteMsg?.msgFiles && /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1131
1170
|
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6587\u4EF6\u3011\uFF1A" }),
|
|
1132
|
-
/* @__PURE__ */ jsx(Flex, { gap: 8, wrap: true, flex: 1, children:
|
|
1171
|
+
/* @__PURE__ */ jsx(Flex, { gap: 8, wrap: true, flex: 1, children: quoteMsg.msgFiles.map((file) => /* @__PURE__ */ jsx("div", { className: "cursor-pointer", onClick: () => filePreview(file), children: /* @__PURE__ */ jsx(
|
|
1133
1172
|
Attachments.FileCard,
|
|
1134
1173
|
{
|
|
1135
1174
|
item: {
|
|
@@ -1137,22 +1176,11 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1137
1176
|
name: file.name,
|
|
1138
1177
|
url: file.content
|
|
1139
1178
|
}
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
)) })
|
|
1179
|
+
}
|
|
1180
|
+
) }, file.content)) })
|
|
1143
1181
|
] })
|
|
1144
1182
|
] })
|
|
1145
1183
|
}
|
|
1146
|
-
) : paramsCitation && /* @__PURE__ */ jsx(
|
|
1147
|
-
Bubble,
|
|
1148
|
-
{
|
|
1149
|
-
className: classNames9(styles_module_default2.chatQuoteMsg),
|
|
1150
|
-
placement,
|
|
1151
|
-
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1152
|
-
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1153
|
-
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis", title: paramsCitation, children: /* @__PURE__ */ jsx(RenderMarkdown, { content: paramsCitation }) })
|
|
1154
|
-
] }) })
|
|
1155
|
-
}
|
|
1156
1184
|
)
|
|
1157
1185
|
] }) });
|
|
1158
1186
|
};
|
|
@@ -1324,8 +1352,19 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
|
|
|
1324
1352
|
placement: role.placement,
|
|
1325
1353
|
variant: "borderless",
|
|
1326
1354
|
avatar: role.avatar,
|
|
1327
|
-
content: /* @__PURE__ */ jsx(
|
|
1328
|
-
|
|
1355
|
+
content: /* @__PURE__ */ jsx(
|
|
1356
|
+
MessageRender_default,
|
|
1357
|
+
{
|
|
1358
|
+
message: message2,
|
|
1359
|
+
placement: role.placement,
|
|
1360
|
+
onFilePreview: (file) => chatStore.setPreview({
|
|
1361
|
+
fileUrl: file.content,
|
|
1362
|
+
suffix: file.extension,
|
|
1363
|
+
fileName: file.name
|
|
1364
|
+
})
|
|
1365
|
+
}
|
|
1366
|
+
),
|
|
1367
|
+
footer: /* @__PURE__ */ jsx(Flex, { children: role.user === "agent" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1329
1368
|
/* @__PURE__ */ jsx(Button, { onClick: () => copyText(message2.msgContent), color: "default", variant: "text", size: "small", icon: /* @__PURE__ */ jsx(CopyOutlined, {}) }),
|
|
1330
1369
|
/* @__PURE__ */ jsx(
|
|
1331
1370
|
Button,
|
|
@@ -1349,7 +1388,7 @@ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, av
|
|
|
1349
1388
|
onClick: () => chatStore.feedback(conversationState.active.id, message2.id, 2, index)
|
|
1350
1389
|
}
|
|
1351
1390
|
)
|
|
1352
|
-
] })
|
|
1391
|
+
] }) })
|
|
1353
1392
|
// ...(isHasTime
|
|
1354
1393
|
// ? { rootClassName: styles.hasSendTime, classNames: { header: styles.sendTime }, header: <span>{formatDate(message.sendDate)}</span> }
|
|
1355
1394
|
// : {})
|
|
@@ -1719,6 +1758,7 @@ var Attachments_default = forwardRef(({ fileUpload, fileUploadConfig = [], fileL
|
|
|
1719
1758
|
beforeUpload: (file, files) => onBeforeUpload(files),
|
|
1720
1759
|
items: attachedFiles,
|
|
1721
1760
|
onRemove,
|
|
1761
|
+
overflow: "wrap",
|
|
1722
1762
|
placeholder: (type) => type === "drop" ? { title: "\u5C06\u6587\u4EF6\u653E\u5230\u8FD9\u91CC" } : {
|
|
1723
1763
|
icon: /* @__PURE__ */ jsx(CloudUploadOutlined, {}),
|
|
1724
1764
|
title: "\u63D0\u4EA4\u6587\u4EF6",
|
|
@@ -1791,7 +1831,7 @@ var ChatSender_default = forwardRef(
|
|
|
1791
1831
|
autoSize: { minRows: 2, maxRows: 6 },
|
|
1792
1832
|
onCancel,
|
|
1793
1833
|
footer: ({ components }) => {
|
|
1794
|
-
const { SendButton, LoadingButton
|
|
1834
|
+
const { SendButton, LoadingButton } = components;
|
|
1795
1835
|
return /* @__PURE__ */ jsxs(Flex, { vertical: true, children: [
|
|
1796
1836
|
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 12, children: [
|
|
1797
1837
|
/* @__PURE__ */ jsxs(Flex, { className: "flex-1", gap: 6, align: "center", children: [
|
|
@@ -1799,10 +1839,7 @@ var ChatSender_default = forwardRef(
|
|
|
1799
1839
|
extraFooter,
|
|
1800
1840
|
" "
|
|
1801
1841
|
] }),
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */ jsx(SpeechButton, {}),
|
|
1804
|
-
loading ? /* @__PURE__ */ jsx(LoadingButton, { disabled: false }) : /* @__PURE__ */ jsx(SendButton, { ...sendBtnProps })
|
|
1805
|
-
] })
|
|
1842
|
+
/* @__PURE__ */ jsx(Flex, { align: "center", gap: 6, children: loading ? /* @__PURE__ */ jsx(LoadingButton, { disabled: false }) : /* @__PURE__ */ jsx(SendButton, { ...sendBtnProps }) })
|
|
1806
1843
|
] }),
|
|
1807
1844
|
extraFooterBelow
|
|
1808
1845
|
] });
|
|
@@ -1865,12 +1902,16 @@ var ChatSender_default2 = forwardRef(
|
|
|
1865
1902
|
() => conversationState.messages[conversationState.active.id] || {},
|
|
1866
1903
|
[conversationState.messages[conversationState.active.id]]
|
|
1867
1904
|
);
|
|
1905
|
+
const referenceContent = useMemo(() => {
|
|
1906
|
+
const content = chatMessage.references?.content?.name;
|
|
1907
|
+
if (content) {
|
|
1908
|
+
return markdownToText(content);
|
|
1909
|
+
}
|
|
1910
|
+
}, [chatMessage.references]);
|
|
1868
1911
|
const referenceHandle = (con) => {
|
|
1869
1912
|
if (chatMessage?.loading) return;
|
|
1870
1913
|
chatStore.setContent(con);
|
|
1871
|
-
|
|
1872
|
-
chatStore.sendMessage();
|
|
1873
|
-
}, 10);
|
|
1914
|
+
chatStore.sendMessage();
|
|
1874
1915
|
};
|
|
1875
1916
|
return /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, className: "zero-chat-sender", children: [
|
|
1876
1917
|
/* @__PURE__ */ jsx(RenderWrapper, { control: prompts, DefaultComponent: SenderPromptsItems_default }),
|
|
@@ -1928,9 +1969,9 @@ var ChatSender_default2 = forwardRef(
|
|
|
1928
1969
|
{
|
|
1929
1970
|
title: /* @__PURE__ */ jsxs(Flex, { gap: 4, children: [
|
|
1930
1971
|
/* @__PURE__ */ jsx(EnterOutlined, {}),
|
|
1931
|
-
/* @__PURE__ */ jsx(Typography.Text, { type: "secondary", ellipsis: true, children:
|
|
1972
|
+
/* @__PURE__ */ jsx(Typography.Text, { type: "secondary", ellipsis: true, children: referenceContent })
|
|
1932
1973
|
] }),
|
|
1933
|
-
open: !!
|
|
1974
|
+
open: !!referenceContent,
|
|
1934
1975
|
onOpenChange: () => chatStore.setReferences(),
|
|
1935
1976
|
classNames: {
|
|
1936
1977
|
header: styles_module_default3.nsSenderReferenceHeaderTitle,
|