@glodon-aiot/chat-app-sdk 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.esm.js +1006 -180
- package/libs/cn/index.js +66 -21
- package/package.json +1 -1
package/es/index.esm.js
CHANGED
|
@@ -9304,6 +9304,12 @@ ___CSS_LOADER_EXPORT___.push([module.id, `:root {
|
|
|
9304
9304
|
.coze-chat-sdk :is(.font-normal) {
|
|
9305
9305
|
font-weight: 400;
|
|
9306
9306
|
}
|
|
9307
|
+
.coze-chat-sdk :is(.uppercase) {
|
|
9308
|
+
text-transform: uppercase;
|
|
9309
|
+
}
|
|
9310
|
+
.coze-chat-sdk :is(.lowercase) {
|
|
9311
|
+
text-transform: lowercase;
|
|
9312
|
+
}
|
|
9307
9313
|
.coze-chat-sdk :is(.\\!leading-28px) {
|
|
9308
9314
|
line-height: var(--coze-28) !important;
|
|
9309
9315
|
}
|
|
@@ -10788,6 +10794,16 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.c8c142b9ad89b1ac {
|
|
|
10788
10794
|
margin-left: auto;
|
|
10789
10795
|
color: #6B6B75;
|
|
10790
10796
|
}
|
|
10797
|
+
.c8c142b9ad89b1ac .fc5357218ceb1c78:hover {
|
|
10798
|
+
background-color: transparent !important;
|
|
10799
|
+
}
|
|
10800
|
+
.c8c142b9ad89b1ac .f07e95aab0abcc5a {
|
|
10801
|
+
margin-left: auto;
|
|
10802
|
+
color: #6B6B75;
|
|
10803
|
+
}
|
|
10804
|
+
.c8c142b9ad89b1ac .f07e95aab0abcc5a:hover {
|
|
10805
|
+
background-color: transparent !important;
|
|
10806
|
+
}
|
|
10791
10807
|
.a513b83ef65c6e47 .ae3efd63d21216ca {
|
|
10792
10808
|
opacity: 0.4;
|
|
10793
10809
|
}
|
|
@@ -10824,6 +10840,8 @@ ___CSS_LOADER_EXPORT___.locals = {
|
|
|
10824
10840
|
"fileText": `d8de5ac7f79d78ac`,
|
|
10825
10841
|
"retry-button": `fc5357218ceb1c78`,
|
|
10826
10842
|
"retryButton": `fc5357218ceb1c78`,
|
|
10843
|
+
"preview-button": `f07e95aab0abcc5a`,
|
|
10844
|
+
"previewButton": `f07e95aab0abcc5a`,
|
|
10827
10845
|
"normal-file-not-success": `a513b83ef65c6e47`,
|
|
10828
10846
|
"normalFileNotSuccess": `a513b83ef65c6e47`,
|
|
10829
10847
|
"file-error-text": `b91da080705f8042`,
|
|
@@ -12911,6 +12929,9 @@ var ___CSS_LOADER_EXPORT___ = _common_temp_default_node_modules_pnpm_css_loader_
|
|
|
12911
12929
|
___CSS_LOADER_EXPORT___.push([module.id, `.chat-uikit-file-card-progress-animation {
|
|
12912
12930
|
transition: width 0.3s linear;
|
|
12913
12931
|
}
|
|
12932
|
+
.chat-uikit-file-card__preview-button:hover {
|
|
12933
|
+
background: transparent !important;
|
|
12934
|
+
}
|
|
12914
12935
|
`, ""]);
|
|
12915
12936
|
// Exports
|
|
12916
12937
|
/* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
@@ -14984,6 +15005,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.f93f377f7f3466bb {
|
|
|
14984
15005
|
.f93f377f7f3466bb .a78675f9ead11e1c {
|
|
14985
15006
|
flex: 1 1 auto;
|
|
14986
15007
|
min-height: 0;
|
|
15008
|
+
position: relative;
|
|
14987
15009
|
}
|
|
14988
15010
|
`, ""]);
|
|
14989
15011
|
// Exports
|
|
@@ -15126,15 +15148,38 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.f86baf679567ad27 {
|
|
|
15126
15148
|
align-self: stretch;
|
|
15127
15149
|
border-radius: var(--mini, 5px);
|
|
15128
15150
|
cursor: pointer;
|
|
15151
|
+
position: relative;
|
|
15129
15152
|
}
|
|
15130
|
-
.b604f7d22988c3dd .
|
|
15131
|
-
|
|
15153
|
+
.b604f7d22988c3dd .f4df3ee0cadb5d32 {
|
|
15154
|
+
position: absolute;
|
|
15155
|
+
right: 8px;
|
|
15156
|
+
top: 50%;
|
|
15157
|
+
transform: translateY(-50%);
|
|
15158
|
+
opacity: 0;
|
|
15159
|
+
pointer-events: none;
|
|
15160
|
+
transition: opacity 0.2s;
|
|
15161
|
+
width: auto;
|
|
15162
|
+
min-width: 0;
|
|
15163
|
+
flex-shrink: 0;
|
|
15164
|
+
display: flex;
|
|
15165
|
+
align-items: center;
|
|
15166
|
+
justify-content: center;
|
|
15167
|
+
}
|
|
15168
|
+
.b604f7d22988c3dd .def35156ce4da8d3 {
|
|
15169
|
+
width: auto;
|
|
15170
|
+
min-width: 0;
|
|
15171
|
+
flex-shrink: 0;
|
|
15172
|
+
background: #F1F1F1 !important;
|
|
15173
|
+
}
|
|
15174
|
+
.b604f7d22988c3dd .def35156ce4da8d3:hover {
|
|
15175
|
+
background: #DFDFDF !important;
|
|
15132
15176
|
}
|
|
15133
15177
|
.b604f7d22988c3dd:hover {
|
|
15134
15178
|
background: #F1F1F1;
|
|
15135
15179
|
}
|
|
15136
|
-
.b604f7d22988c3dd:hover .
|
|
15137
|
-
|
|
15180
|
+
.b604f7d22988c3dd:hover .f4df3ee0cadb5d32 {
|
|
15181
|
+
opacity: 1;
|
|
15182
|
+
pointer-events: auto;
|
|
15138
15183
|
}
|
|
15139
15184
|
.d20070d79d26fc4c {
|
|
15140
15185
|
background: #DFDFDF;
|
|
@@ -15148,8 +15193,10 @@ ___CSS_LOADER_EXPORT___.locals = {
|
|
|
15148
15193
|
"conversationItemTime": `a333a6f519d76789`,
|
|
15149
15194
|
"conversation-item-content": `b604f7d22988c3dd`,
|
|
15150
15195
|
"conversationItemContent": `b604f7d22988c3dd`,
|
|
15151
|
-
"conversation-operate": `
|
|
15152
|
-
"
|
|
15196
|
+
"conversation-operate-wrapper": `f4df3ee0cadb5d32`,
|
|
15197
|
+
"conversationOperateWrapper": `f4df3ee0cadb5d32`,
|
|
15198
|
+
"conversation-operate-button": `def35156ce4da8d3`,
|
|
15199
|
+
"conversationOperateButton": `def35156ce4da8d3`,
|
|
15153
15200
|
"conversation-item-content-active": `d20070d79d26fc4c`,
|
|
15154
15201
|
"conversationItemContentActive": `d20070d79d26fc4c`
|
|
15155
15202
|
};
|
|
@@ -15640,6 +15687,8 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.c64c9a8ea4a38e72 {
|
|
|
15640
15687
|
width: 100%;
|
|
15641
15688
|
height: 100%;
|
|
15642
15689
|
min-height: 0;
|
|
15690
|
+
padding-bottom: 34px;
|
|
15691
|
+
box-sizing: border-box;
|
|
15643
15692
|
}
|
|
15644
15693
|
.c5a6e169fa0cf192 * {
|
|
15645
15694
|
box-sizing: border-box;
|
|
@@ -267629,10 +267678,11 @@ class PreSendLocalMessageFactory {
|
|
|
267629
267678
|
/**
|
|
267630
267679
|
* Update image message content
|
|
267631
267680
|
*/ updateImageMessageContent(message, uploadResult) {
|
|
267632
|
-
const { Uri = '', Url = '', ImageWidth = 0, ImageHeight = 0 } = uploadResult;
|
|
267681
|
+
const { Uri = '', Url = '', ImageWidth = 0, ImageHeight = 0, Id } = uploadResult;
|
|
267633
267682
|
message.content_obj.image_list[0] = {
|
|
267634
267683
|
...message.content_obj.image_list[0],
|
|
267635
267684
|
key: Uri,
|
|
267685
|
+
id: Id,
|
|
267636
267686
|
image_thumb: {
|
|
267637
267687
|
...message.content_obj.image_list[0].image_thumb,
|
|
267638
267688
|
width: ImageWidth,
|
|
@@ -267651,8 +267701,9 @@ class PreSendLocalMessageFactory {
|
|
|
267651
267701
|
/**
|
|
267652
267702
|
* Update file message content
|
|
267653
267703
|
*/ updateFileMessageContent(message, uploadResult) {
|
|
267654
|
-
const { Uri = '', Url = '' } = uploadResult;
|
|
267655
|
-
message.content_obj.file_list[0].file_key = Uri;
|
|
267704
|
+
const { Uri = '', Url = '', Id } = uploadResult;
|
|
267705
|
+
message.content_obj.file_list[0].file_key = Uri; // URI for URL generation/viewing
|
|
267706
|
+
message.content_obj.file_list[0].file_id = Id; // Backend file ID for file_id in API calls
|
|
267656
267707
|
message.content_obj.file_list[0].file_url = Url;
|
|
267657
267708
|
message.content = JSON.stringify(message.content_obj);
|
|
267658
267709
|
}
|
|
@@ -267700,6 +267751,7 @@ class PreSendLocalMessageFactory {
|
|
|
267700
267751
|
type,
|
|
267701
267752
|
file: {
|
|
267702
267753
|
file_key: item.uri,
|
|
267754
|
+
file_id: item.id,
|
|
267703
267755
|
file_name: item.file.name,
|
|
267704
267756
|
file_type: fileType,
|
|
267705
267757
|
file_size: item.file.size,
|
|
@@ -267713,6 +267765,7 @@ class PreSendLocalMessageFactory {
|
|
|
267713
267765
|
type,
|
|
267714
267766
|
image: {
|
|
267715
267767
|
key: item.uri,
|
|
267768
|
+
id: item.id,
|
|
267716
267769
|
image_thumb: {
|
|
267717
267770
|
url: blobUrl,
|
|
267718
267771
|
width: item.width,
|
|
@@ -271591,6 +271644,7 @@ class ChatCoreUploadPlugin {
|
|
|
271591
271644
|
}
|
|
271592
271645
|
});
|
|
271593
271646
|
this.dataAuth = dataAuth.data || {};
|
|
271647
|
+
// DataAuth structure may vary, using any for flexibility
|
|
271594
271648
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
271595
271649
|
const { service_id, upload_host, schema } = this.dataAuth || {};
|
|
271596
271650
|
this.uploader = getUploader({
|
|
@@ -271608,6 +271662,29 @@ class ChatCoreUploadPlugin {
|
|
|
271608
271662
|
}, false);
|
|
271609
271663
|
this.addFile(this.uploaderConfig.file, this.uploaderConfig.type);
|
|
271610
271664
|
this.uploader.on('complete', (info)=>{
|
|
271665
|
+
const extendedInfo = info;
|
|
271666
|
+
// Try to extract raw backend data from info object
|
|
271667
|
+
let backendData = null;
|
|
271668
|
+
if (extendedInfo.task) {
|
|
271669
|
+
var _extendedInfo_task_response, _extendedInfo_task_responseData, _extendedInfo_task__response, _extendedInfo_task_rawResponse;
|
|
271670
|
+
backendData = ((_extendedInfo_task_response = extendedInfo.task.response) === null || _extendedInfo_task_response === void 0 ? void 0 : _extendedInfo_task_response.data) || ((_extendedInfo_task_responseData = extendedInfo.task.responseData) === null || _extendedInfo_task_responseData === void 0 ? void 0 : _extendedInfo_task_responseData.data) || ((_extendedInfo_task__response = extendedInfo.task._response) === null || _extendedInfo_task__response === void 0 ? void 0 : _extendedInfo_task__response.data) || ((_extendedInfo_task_rawResponse = extendedInfo.task.rawResponse) === null || _extendedInfo_task_rawResponse === void 0 ? void 0 : _extendedInfo_task_rawResponse.data) || extendedInfo.task.data || null;
|
|
271671
|
+
}
|
|
271672
|
+
if (!backendData) {
|
|
271673
|
+
var _extendedInfo_response, _extendedInfo_result;
|
|
271674
|
+
backendData = extendedInfo.data || ((_extendedInfo_response = extendedInfo.response) === null || _extendedInfo_response === void 0 ? void 0 : _extendedInfo_response.data) || extendedInfo.responseData || ((_extendedInfo_result = extendedInfo.result) === null || _extendedInfo_result === void 0 ? void 0 : _extendedInfo_result.data) || null;
|
|
271675
|
+
}
|
|
271676
|
+
// If we found raw backend data, add uri and id to uploadResult
|
|
271677
|
+
if (backendData && extendedInfo.uploadResult) {
|
|
271678
|
+
if (backendData.uri) {
|
|
271679
|
+
extendedInfo.uploadResult.Uri = backendData.uri;
|
|
271680
|
+
}
|
|
271681
|
+
if (backendData.id) {
|
|
271682
|
+
extendedInfo.uploadResult.Id = backendData.id;
|
|
271683
|
+
}
|
|
271684
|
+
if (backendData.url) {
|
|
271685
|
+
extendedInfo.uploadResult.Url = backendData.url;
|
|
271686
|
+
}
|
|
271687
|
+
}
|
|
271611
271688
|
this.eventBus.emit('complete', info);
|
|
271612
271689
|
});
|
|
271613
271690
|
this.uploader.on('progress', (info)=>{
|
|
@@ -271616,9 +271693,6 @@ class ChatCoreUploadPlugin {
|
|
|
271616
271693
|
this.uploader.on('error', (info)=>{
|
|
271617
271694
|
this.eventBus.emit('error', info);
|
|
271618
271695
|
});
|
|
271619
|
-
this.uploader.on('complete', (info)=>{
|
|
271620
|
-
this.eventBus.emit('complete', info);
|
|
271621
|
-
});
|
|
271622
271696
|
this.uploader.start();
|
|
271623
271697
|
} catch (e) {
|
|
271624
271698
|
safeAsyncThrow(`upload-plugin error: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -296996,7 +297070,13 @@ const TextItemList = (param)=>{
|
|
|
296996
297070
|
showBackground
|
|
296997
297071
|
}),
|
|
296998
297072
|
style: {
|
|
296999
|
-
width: 'fit-content'
|
|
297073
|
+
width: 'fit-content',
|
|
297074
|
+
marginLeft: 'auto',
|
|
297075
|
+
// mix-content 内的文本内容应该和纯文本消息使用相同的样式
|
|
297076
|
+
background: '#F4F4F4',
|
|
297077
|
+
padding: '10px',
|
|
297078
|
+
borderRadius: '10px 0 10px 10px',
|
|
297079
|
+
textAlign: 'right'
|
|
297000
297080
|
},
|
|
297001
297081
|
children: [
|
|
297002
297082
|
TextContentAddonTop,
|
|
@@ -297823,6 +297903,129 @@ UIKitTooltip.displayName = 'UIKitTooltip';
|
|
|
297823
297903
|
return `${digit} ${sizes[i]}`;
|
|
297824
297904
|
};
|
|
297825
297905
|
|
|
297906
|
+
;// CONCATENATED MODULE: ../../../common/chat-area/chat-uikit/src/hooks/use-doc-viewer-config.ts
|
|
297907
|
+
/*
|
|
297908
|
+
* Copyright 2025 coze-dev Authors
|
|
297909
|
+
*
|
|
297910
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
297911
|
+
* you may not use this file except in compliance with the License.
|
|
297912
|
+
* You may obtain a copy of the License at
|
|
297913
|
+
*
|
|
297914
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
297915
|
+
*
|
|
297916
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
297917
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
297918
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
297919
|
+
* See the License for the specific language governing permissions and
|
|
297920
|
+
* limitations under the License.
|
|
297921
|
+
*/ // Try to import useChatAppProps and useChatAppStore from open-chat if available
|
|
297922
|
+
|
|
297923
|
+
|
|
297924
|
+
|
|
297925
|
+
let useChatAppProps = null;
|
|
297926
|
+
let useChatAppStore = null;
|
|
297927
|
+
try {
|
|
297928
|
+
// Dynamic import, module may not be available
|
|
297929
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- Dynamic require needed for optional dependency
|
|
297930
|
+
const openChatModule = __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module '@coze-studio/open-chat'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
|
|
297931
|
+
// eslint-disable-next-line prefer-destructuring -- Direct assignment needed for conditional hook usage
|
|
297932
|
+
useChatAppProps = openChatModule.useChatAppProps;
|
|
297933
|
+
// eslint-disable-next-line prefer-destructuring -- Direct assignment needed for conditional hook usage
|
|
297934
|
+
useChatAppStore = openChatModule.useChatAppStore;
|
|
297935
|
+
} catch (error) {
|
|
297936
|
+
// Module not available, will use default values
|
|
297937
|
+
// Error is expected when module is not available, so we can safely ignore it
|
|
297938
|
+
if (false) {}
|
|
297939
|
+
}
|
|
297940
|
+
/**
|
|
297941
|
+
* Parse domain and productCode from apiUrl
|
|
297942
|
+
* apiUrl format: 域名/api/productCode/flow
|
|
297943
|
+
* Example: https://aiot-dev.glodon.com/api/cvforce/flow
|
|
297944
|
+
* Returns: { domain: 'https://aiot-dev.glodon.com', productCode: 'cvforce' }
|
|
297945
|
+
*/ const parseApiUrl = (apiUrl)=>{
|
|
297946
|
+
const defaultDomain = 'https://aiot-dev.glodon.com';
|
|
297947
|
+
const defaultProductCode = 'cvforcepd';
|
|
297948
|
+
if (!apiUrl) {
|
|
297949
|
+
return {
|
|
297950
|
+
domain: defaultDomain,
|
|
297951
|
+
productCode: defaultProductCode
|
|
297952
|
+
};
|
|
297953
|
+
}
|
|
297954
|
+
try {
|
|
297955
|
+
// Parse URL: 域名/api/productCode/flow
|
|
297956
|
+
const url = new URL(apiUrl);
|
|
297957
|
+
const domain = `${url.protocol}//${url.host}`;
|
|
297958
|
+
const pathParts = url.pathname.split('/').filter(Boolean);
|
|
297959
|
+
// Find 'api' in path and get the next part as productCode
|
|
297960
|
+
const apiIndex = pathParts.indexOf('api');
|
|
297961
|
+
if (apiIndex >= 0 && apiIndex < pathParts.length - 1) {
|
|
297962
|
+
const productCode = pathParts[apiIndex + 1];
|
|
297963
|
+
return {
|
|
297964
|
+
domain,
|
|
297965
|
+
productCode
|
|
297966
|
+
};
|
|
297967
|
+
}
|
|
297968
|
+
} catch (urlError) {
|
|
297969
|
+
// If URL parsing fails, try regex
|
|
297970
|
+
const match = apiUrl.match(/^(https?:\/\/[^\/]+)\/api\/([^\/]+)\//);
|
|
297971
|
+
if (match) {
|
|
297972
|
+
return {
|
|
297973
|
+
domain: match[1],
|
|
297974
|
+
productCode: match[2]
|
|
297975
|
+
};
|
|
297976
|
+
}
|
|
297977
|
+
// If regex also fails, log in development mode
|
|
297978
|
+
if (false) {}
|
|
297979
|
+
}
|
|
297980
|
+
return {
|
|
297981
|
+
domain: defaultDomain,
|
|
297982
|
+
productCode: defaultProductCode
|
|
297983
|
+
};
|
|
297984
|
+
};
|
|
297985
|
+
/**
|
|
297986
|
+
* Build default doc viewer URL from apiUrl
|
|
297987
|
+
* Format: 域名/portal/_/productCode/doc-viewer/
|
|
297988
|
+
* Example: https://aiot-dev.glodon.com/api/cvforce/flow -> https://aiot-dev.glodon.com/portal/_/cvforce/doc-viewer/
|
|
297989
|
+
*/ const buildDefaultDocViewerUrl = (apiUrl)=>{
|
|
297990
|
+
const { domain, productCode } = parseApiUrl(apiUrl);
|
|
297991
|
+
return `${domain}/portal/_/${productCode}/doc-viewer/`;
|
|
297992
|
+
};
|
|
297993
|
+
/**
|
|
297994
|
+
* Get document viewer configuration from SDK config
|
|
297995
|
+
* Falls back to default values parsed from apiUrl if SDK config is not available
|
|
297996
|
+
*/ const useDocViewerConfig = ()=>{
|
|
297997
|
+
let docViewerConfig;
|
|
297998
|
+
let apiUrl;
|
|
297999
|
+
// These hooks are dynamically imported and may not be available
|
|
298000
|
+
if (useChatAppProps) {
|
|
298001
|
+
try {
|
|
298002
|
+
var _chatConfigResult_chatConfig_extra, _chatConfigResult_chatConfig;
|
|
298003
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Hook is conditionally available
|
|
298004
|
+
const chatConfigResult = useChatAppProps();
|
|
298005
|
+
docViewerConfig = chatConfigResult === null || chatConfigResult === void 0 ? void 0 : (_chatConfigResult_chatConfig = chatConfigResult.chatConfig) === null || _chatConfigResult_chatConfig === void 0 ? void 0 : (_chatConfigResult_chatConfig_extra = _chatConfigResult_chatConfig.extra) === null || _chatConfigResult_chatConfig_extra === void 0 ? void 0 : _chatConfigResult_chatConfig_extra.docViewer;
|
|
298006
|
+
} catch (hookError) {
|
|
298007
|
+
// Hook not available in this context, use defaults
|
|
298008
|
+
if (false) {}
|
|
298009
|
+
}
|
|
298010
|
+
}
|
|
298011
|
+
if (useChatAppStore) {
|
|
298012
|
+
try {
|
|
298013
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Hook is conditionally available
|
|
298014
|
+
apiUrl = useChatAppStore((state)=>state.apiUrl);
|
|
298015
|
+
} catch (storeError) {
|
|
298016
|
+
// Store not available in this context, use defaults
|
|
298017
|
+
if (false) {}
|
|
298018
|
+
}
|
|
298019
|
+
}
|
|
298020
|
+
// Default values: use config if provided, otherwise parse from apiUrl
|
|
298021
|
+
const baseUrl = (docViewerConfig === null || docViewerConfig === void 0 ? void 0 : docViewerConfig.baseUrl) || buildDefaultDocViewerUrl(apiUrl);
|
|
298022
|
+
const urlParam = (docViewerConfig === null || docViewerConfig === void 0 ? void 0 : docViewerConfig.urlParam) || 'url';
|
|
298023
|
+
return {
|
|
298024
|
+
baseUrl,
|
|
298025
|
+
urlParam
|
|
298026
|
+
};
|
|
298027
|
+
};
|
|
298028
|
+
|
|
297826
298029
|
;// CONCATENATED MODULE: ../../../common/chat-area/chat-uikit/src/components/contents/file-content/components/FileCard/variants.ts
|
|
297827
298030
|
/*
|
|
297828
298031
|
* Copyright 2025 coze-dev Authors
|
|
@@ -298597,7 +298800,68 @@ var file_card_update = injectStylesIntoStyleTag_default()(file_card/* ["default"
|
|
|
298597
298800
|
|
|
298598
298801
|
|
|
298599
298802
|
|
|
298600
|
-
|
|
298803
|
+
|
|
298804
|
+
/**
|
|
298805
|
+
* Get file URL from URI using GetImagexShortUrl API (same as image)
|
|
298806
|
+
* Falls back to URI if API call fails
|
|
298807
|
+
*/ const getFileUrlFromUri = async (uri)=>{
|
|
298808
|
+
try {
|
|
298809
|
+
// Build API URL using the same logic as getBaseURL from @coze-arch/bot-http
|
|
298810
|
+
const productCode = // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Window global property may not be typed
|
|
298811
|
+
window.__PRODUCT_CODE__ || {"NODE_ENV":"production","CHAT_APP_CHATFLOW_COZE_APP_ID":"","CHAT_APP_CHATFLOW_COZE_WORKFLOW_ID":"","CHAT_APP_INDEX_COZE_BOT_ID":"","CHAT_APP_COZE_TOKEN":"","CHAT_APP_COZE_BOT_USER_URL":""}.VITE_PRODUCD_CODE || location.pathname.split('/')[3];
|
|
298812
|
+
const isLocal = "production" === 'development';
|
|
298813
|
+
const baseUrl = {"NODE_ENV":"production","CHAT_APP_CHATFLOW_COZE_APP_ID":"","CHAT_APP_CHATFLOW_COZE_WORKFLOW_ID":"","CHAT_APP_INDEX_COZE_BOT_ID":"","CHAT_APP_COZE_TOKEN":"","CHAT_APP_COZE_BOT_USER_URL":""}.VITE_BASE_API || window.location.origin;
|
|
298814
|
+
const apiPath = '/api/playground_api/get_imagex_url';
|
|
298815
|
+
const apiUrl = isLocal ? `${window.location.origin}/server/api/${productCode}/flow${apiPath}` : `${baseUrl}/api/${productCode}/flow${apiPath}`;
|
|
298816
|
+
// Get auth token - try to use the same method as axiosInstance
|
|
298817
|
+
const getAuthToken = ()=>{
|
|
298818
|
+
var _document_cookie_split_find;
|
|
298819
|
+
if (window.location.hash.includes('/embed/application')) {
|
|
298820
|
+
return localStorage.getItem('embed.token');
|
|
298821
|
+
}
|
|
298822
|
+
// Try to get token from localStorage (same as getTokenWithSync)
|
|
298823
|
+
return localStorage.getItem('token') || localStorage.getItem('coze_token') || ((_document_cookie_split_find = document.cookie.split(';').find((c)=>c.trim().startsWith('token='))) === null || _document_cookie_split_find === void 0 ? void 0 : _document_cookie_split_find.split('=')[1]);
|
|
298824
|
+
};
|
|
298825
|
+
const token = getAuthToken();
|
|
298826
|
+
const headers = {
|
|
298827
|
+
'Content-Type': 'application/json',
|
|
298828
|
+
'x-requested-with': 'XMLHttpRequest',
|
|
298829
|
+
'Agw-Js-Conv': 'str'
|
|
298830
|
+
};
|
|
298831
|
+
if (token) {
|
|
298832
|
+
headers.Authorization = `Bearer ${token}`;
|
|
298833
|
+
}
|
|
298834
|
+
// Call GetImagexShortUrl API with uris array
|
|
298835
|
+
const response = await fetch(apiUrl, {
|
|
298836
|
+
method: 'POST',
|
|
298837
|
+
headers,
|
|
298838
|
+
credentials: 'include',
|
|
298839
|
+
body: JSON.stringify({
|
|
298840
|
+
uris: [
|
|
298841
|
+
uri
|
|
298842
|
+
]
|
|
298843
|
+
})
|
|
298844
|
+
});
|
|
298845
|
+
if (response.ok) {
|
|
298846
|
+
const contentType = response.headers.get('content-type');
|
|
298847
|
+
if (contentType && contentType.includes('application/json')) {
|
|
298848
|
+
var _result_data_url_info_uri, _result_data_url_info, _result_data;
|
|
298849
|
+
const result = await response.json();
|
|
298850
|
+
// Get URL from url_info map using URI as key (same as image)
|
|
298851
|
+
const url = result === null || result === void 0 ? void 0 : (_result_data = result.data) === null || _result_data === void 0 ? void 0 : (_result_data_url_info = _result_data.url_info) === null || _result_data_url_info === void 0 ? void 0 : (_result_data_url_info_uri = _result_data_url_info[uri]) === null || _result_data_url_info_uri === void 0 ? void 0 : _result_data_url_info_uri.url;
|
|
298852
|
+
if (url) {
|
|
298853
|
+
return url;
|
|
298854
|
+
}
|
|
298855
|
+
}
|
|
298856
|
+
}
|
|
298857
|
+
} catch (error) {
|
|
298858
|
+
// Silently fail and fall back to URI
|
|
298859
|
+
if (false) {}
|
|
298860
|
+
}
|
|
298861
|
+
// Fallback to URI if API call fails
|
|
298862
|
+
return uri;
|
|
298863
|
+
};
|
|
298864
|
+
// eslint-disable-next-line @coze-arch/max-line-per-function -- FileCard component requires many lines
|
|
298601
298865
|
const FileCard_FileCard = (props)=>{
|
|
298602
298866
|
const { file, attributeKeys, tooltipsCopywriting, readonly, onCancel, onCopy, onRetry, className, layout, showBackground } = props;
|
|
298603
298867
|
const { statusKey, statusEnum, percentKey } = attributeKeys;
|
|
@@ -298609,6 +298873,74 @@ const FileCard_FileCard = (props)=>{
|
|
|
298609
298873
|
const buttonsVisible = !readonly;
|
|
298610
298874
|
const { extension, nameWithoutExtension } = getFileExtensionAndName(file.file_name);
|
|
298611
298875
|
const isCanceled = file[statusKey] === statusEnum.cancelEnum;
|
|
298876
|
+
const fileStatusValue = file[statusKey];
|
|
298877
|
+
const fileUrl = file.file_url;
|
|
298878
|
+
const fileKey = file.file_key;
|
|
298879
|
+
// If upload_status is undefined but file has file_url or file_key, consider it as success
|
|
298880
|
+
// This handles files from server messages that don't have upload_status field
|
|
298881
|
+
const isSuccess = fileStatusValue === statusEnum.successEnum || fileStatusValue === undefined && (fileUrl || fileKey);
|
|
298882
|
+
const { baseUrl, urlParam } = useDocViewerConfig();
|
|
298883
|
+
const buildDocViewerUrl = (fileUrlParam)=>{
|
|
298884
|
+
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
298885
|
+
return `${baseUrl}${separator}${urlParam}=${encodeURIComponent(fileUrlParam)}`;
|
|
298886
|
+
};
|
|
298887
|
+
const handlePreview = async (e)=>{
|
|
298888
|
+
e.stopPropagation();
|
|
298889
|
+
if (!isSuccess) {
|
|
298890
|
+
return;
|
|
298891
|
+
}
|
|
298892
|
+
// 优先使用 file_url,如果没有则使用 file_key (URI)
|
|
298893
|
+
if (fileUrl) {
|
|
298894
|
+
const docViewerUrl = buildDocViewerUrl(fileUrl);
|
|
298895
|
+
window.open(docViewerUrl, '_blank');
|
|
298896
|
+
return;
|
|
298897
|
+
}
|
|
298898
|
+
if (fileKey) {
|
|
298899
|
+
// Get URL from URI using API
|
|
298900
|
+
try {
|
|
298901
|
+
const resolvedUrl = await getFileUrlFromUri(fileKey);
|
|
298902
|
+
const docViewerUrl = buildDocViewerUrl(resolvedUrl);
|
|
298903
|
+
window.open(docViewerUrl, '_blank');
|
|
298904
|
+
} catch (error) {
|
|
298905
|
+
// Fallback to using URI directly
|
|
298906
|
+
if (false) {}
|
|
298907
|
+
const docViewerUrl = buildDocViewerUrl(fileKey);
|
|
298908
|
+
window.open(docViewerUrl, '_blank');
|
|
298909
|
+
}
|
|
298910
|
+
return;
|
|
298911
|
+
}
|
|
298912
|
+
};
|
|
298913
|
+
const handleClick = async (e)=>{
|
|
298914
|
+
if (!isSuccess) {
|
|
298915
|
+
return;
|
|
298916
|
+
}
|
|
298917
|
+
// 如果点击的是操作按钮或其子元素,不执行跳转
|
|
298918
|
+
const target = e.target;
|
|
298919
|
+
const isButton = target.closest('button') || target.closest('[role="button"]') || target.closest('[class*="IconButton"]');
|
|
298920
|
+
if (isButton) {
|
|
298921
|
+
return;
|
|
298922
|
+
}
|
|
298923
|
+
// 优先使用 file_url,如果没有则使用 file_key (URI)
|
|
298924
|
+
if (fileUrl) {
|
|
298925
|
+
const docViewerUrl = buildDocViewerUrl(fileUrl);
|
|
298926
|
+
window.open(docViewerUrl, '_blank');
|
|
298927
|
+
return;
|
|
298928
|
+
}
|
|
298929
|
+
if (fileKey) {
|
|
298930
|
+
// Get URL from URI using API
|
|
298931
|
+
try {
|
|
298932
|
+
const resolvedUrl = await getFileUrlFromUri(fileKey);
|
|
298933
|
+
const docViewerUrl = buildDocViewerUrl(resolvedUrl);
|
|
298934
|
+
window.open(docViewerUrl, '_blank');
|
|
298935
|
+
} catch (error) {
|
|
298936
|
+
// Fallback to using URI directly
|
|
298937
|
+
if (false) {}
|
|
298938
|
+
const docViewerUrl = buildDocViewerUrl(fileKey);
|
|
298939
|
+
window.open(docViewerUrl, '_blank');
|
|
298940
|
+
}
|
|
298941
|
+
return;
|
|
298942
|
+
}
|
|
298943
|
+
};
|
|
298612
298944
|
return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
|
|
298613
298945
|
// className={classNames(className, 'chat-uikit-file-card', {
|
|
298614
298946
|
// 'chat-uikit-file-card--error': file[statusKey] === statusEnum.failEnum,
|
|
@@ -298621,7 +298953,8 @@ const FileCard_FileCard = (props)=>{
|
|
|
298621
298953
|
isError: file[statusKey] === statusEnum.failEnum,
|
|
298622
298954
|
layout: layout === common_Layout.PC ? 'pc' : 'mobile',
|
|
298623
298955
|
showBackground
|
|
298624
|
-
}), className),
|
|
298956
|
+
}), className, 'cursor-pointer'),
|
|
298957
|
+
onClick: handleClick,
|
|
298625
298958
|
children: [
|
|
298626
298959
|
/*#__PURE__*/ (0,jsx_runtime.jsx)("img", {
|
|
298627
298960
|
src: fileIconMap[file.file_type],
|
|
@@ -298653,7 +298986,7 @@ const FileCard_FileCard = (props)=>{
|
|
|
298653
298986
|
}),
|
|
298654
298987
|
children: nameWithoutExtension
|
|
298655
298988
|
}),
|
|
298656
|
-
/*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
|
|
298989
|
+
file.file_size > 0 && /*#__PURE__*/ (0,jsx_runtime.jsx)("span", {
|
|
298657
298990
|
// chat-uikit-file-card__info__size
|
|
298658
298991
|
className: classnames_default()('text-base font-normal leading-[16px]', isCanceled ? 'coz-fg-dim' : 'coz-fg-secondary'),
|
|
298659
298992
|
children: convertBytes(file.file_size)
|
|
@@ -298677,7 +299010,10 @@ const FileCard_FileCard = (props)=>{
|
|
|
298677
299010
|
, {}),
|
|
298678
299011
|
size: "small",
|
|
298679
299012
|
color: "secondary",
|
|
298680
|
-
onClick:
|
|
299013
|
+
onClick: (e)=>{
|
|
299014
|
+
e.stopPropagation();
|
|
299015
|
+
onCancel();
|
|
299016
|
+
}
|
|
298681
299017
|
})
|
|
298682
299018
|
}),
|
|
298683
299019
|
[
|
|
@@ -298694,21 +299030,47 @@ const FileCard_FileCard = (props)=>{
|
|
|
298694
299030
|
, {}),
|
|
298695
299031
|
size: "small",
|
|
298696
299032
|
color: "secondary",
|
|
298697
|
-
onClick:
|
|
299033
|
+
onClick: (e)=>{
|
|
299034
|
+
e.stopPropagation();
|
|
299035
|
+
onRetry();
|
|
299036
|
+
}
|
|
298698
299037
|
})
|
|
298699
299038
|
}),
|
|
299039
|
+
isSuccess ? /*#__PURE__*/ (0,jsx_runtime.jsx)(UIKitTooltip, {
|
|
299040
|
+
theme: "light",
|
|
299041
|
+
position: "top",
|
|
299042
|
+
content: (tooltipsCopywriting === null || tooltipsCopywriting === void 0 ? void 0 : tooltipsCopywriting.preview) || '预览',
|
|
299043
|
+
hideToolTip: layout === common_Layout.MOBILE,
|
|
299044
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
299045
|
+
className: "chat-uikit-file-card__preview-button-wrapper",
|
|
299046
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_webpack_exports_IconButton, {
|
|
299047
|
+
icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(__webpack_exports__IconCozEye, {}),
|
|
299048
|
+
size: "small",
|
|
299049
|
+
color: "secondary",
|
|
299050
|
+
onClick: handlePreview,
|
|
299051
|
+
className: "chat-uikit-file-card__preview-button"
|
|
299052
|
+
})
|
|
299053
|
+
})
|
|
299054
|
+
}) : null,
|
|
298700
299055
|
file[statusKey] === statusEnum.successEnum && /*#__PURE__*/ (0,jsx_runtime.jsx)(UIKitTooltip, {
|
|
298701
299056
|
theme: "light",
|
|
298702
299057
|
position: "top",
|
|
298703
299058
|
content: tooltipsCopywriting === null || tooltipsCopywriting === void 0 ? void 0 : tooltipsCopywriting.copy,
|
|
298704
299059
|
hideToolTip: layout === common_Layout.MOBILE,
|
|
298705
|
-
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(
|
|
298706
|
-
|
|
298707
|
-
|
|
298708
|
-
|
|
298709
|
-
|
|
298710
|
-
|
|
298711
|
-
|
|
299060
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
299061
|
+
className: "chat-uikit-file-card__copy-button-wrapper",
|
|
299062
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_webpack_exports_IconButton, {
|
|
299063
|
+
// chat-uikit-file-card__buttons__button
|
|
299064
|
+
icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(__webpack_exports__IconCozCopy // chat-uikit-file-card__buttons__icon
|
|
299065
|
+
, {}),
|
|
299066
|
+
size: "small",
|
|
299067
|
+
color: "secondary",
|
|
299068
|
+
onClick: (e)=>{
|
|
299069
|
+
e.stopPropagation();
|
|
299070
|
+
onCopy();
|
|
299071
|
+
},
|
|
299072
|
+
className: "chat-uikit-file-card__copy-button"
|
|
299073
|
+
})
|
|
298712
299074
|
})
|
|
298713
299075
|
})
|
|
298714
299076
|
]
|
|
@@ -298747,6 +299109,19 @@ FileCard_FileCard.displayName = 'FileCard';
|
|
|
298747
299109
|
*/
|
|
298748
299110
|
|
|
298749
299111
|
|
|
299112
|
+
// 默认的 fileAttributeKeys,用于混合消息中的文件显示
|
|
299113
|
+
// 注意:这些值需要与实际的 FileStatus 枚举值匹配
|
|
299114
|
+
// FileStatus: Init=0, Uploading=1, Success=2, Canceled=3, Error=4
|
|
299115
|
+
const DEFAULT_FILE_ATTRIBUTE_KEYS = {
|
|
299116
|
+
statusKey: 'upload_status',
|
|
299117
|
+
statusEnum: {
|
|
299118
|
+
successEnum: 2,
|
|
299119
|
+
failEnum: 4,
|
|
299120
|
+
cancelEnum: 3,
|
|
299121
|
+
uploadingEnum: 1
|
|
299122
|
+
},
|
|
299123
|
+
percentKey: 'upload_percent'
|
|
299124
|
+
};
|
|
298750
299125
|
const FileItemList = (param)=>{
|
|
298751
299126
|
let { fileItemList, fileAttributeKeys, fileCopywriting, readonly, onRetry, onCancel, onCopy, message, layout, showBackground } = param;
|
|
298752
299127
|
/**
|
|
@@ -298773,13 +299148,15 @@ const FileItemList = (param)=>{
|
|
|
298773
299148
|
extra: {}
|
|
298774
299149
|
});
|
|
298775
299150
|
};
|
|
299151
|
+
// 使用传入的 fileAttributeKeys 或默认值
|
|
299152
|
+
const effectiveFileAttributeKeys = fileAttributeKeys || DEFAULT_FILE_ATTRIBUTE_KEYS;
|
|
298776
299153
|
return /*#__PURE__*/ (0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
298777
299154
|
children: fileItemList.map((item)=>{
|
|
298778
|
-
if (isFileMixItem(item)
|
|
299155
|
+
if (isFileMixItem(item)) {
|
|
298779
299156
|
return /*#__PURE__*/ (0,jsx_runtime.jsx)(components_FileCard, {
|
|
298780
299157
|
className: "chat-uikit-multi-modal-file-image-content select-none",
|
|
298781
299158
|
file: item.file,
|
|
298782
|
-
attributeKeys:
|
|
299159
|
+
attributeKeys: effectiveFileAttributeKeys,
|
|
298783
299160
|
tooltipsCopywriting: fileCopywriting === null || fileCopywriting === void 0 ? void 0 : fileCopywriting.tooltips,
|
|
298784
299161
|
readonly: readonly,
|
|
298785
299162
|
onCancel: handleCancel,
|
|
@@ -300098,6 +300475,7 @@ var message_box_update = injectStylesIntoStyleTag_default()(message_box/* ["defa
|
|
|
300098
300475
|
|
|
300099
300476
|
|
|
300100
300477
|
|
|
300478
|
+
|
|
300101
300479
|
const MessageBoxWrap = (props)=>{
|
|
300102
300480
|
const { children, theme, nickname, avatar, showUserInfo, renderFooter, hoverContent, right, senderId, classname, messageBubbleClassname, messageBubbleWrapperClassname, messageBoxWrapperClassname, messageHoverWrapperClassName, messageErrorWrapperClassname, isHoverShowUserInfo = true, layout, contentTime, showBackground, extendedUserInfo, topRightSlot, imageAutoSizeContainerWidth, enableImageAutoSize, messageId, eventCallbacks, onError } = props;
|
|
300103
300481
|
const { userLabel, userUniqueName } = extendedUserInfo ?? {};
|
|
@@ -300110,6 +300488,10 @@ const MessageBoxWrap = (props)=>{
|
|
|
300110
300488
|
const isMobileLayout = layout === common_Layout.MOBILE;
|
|
300111
300489
|
// 判断是否为发送消息:发送消息通常使用 'primary' 主题
|
|
300112
300490
|
const isSentMessage = theme === 'primary';
|
|
300491
|
+
// 判断是否为 mix-content 消息:mix-content 消息使用 'none' 主题,但仍然是发送的消息
|
|
300492
|
+
const isMixContentMessage = theme === 'none' && (classname === null || classname === void 0 ? void 0 : classname.includes('chat-uikit-mix-content-message-box'));
|
|
300493
|
+
// 判断是否应该应用发送消息的样式(包括纯文本和 mix-content)
|
|
300494
|
+
const shouldApplySentMessageStyle = isSentMessage || isMixContentMessage;
|
|
300113
300495
|
const refreshContainerWidthConditionally = use_event_callback_useEventCallback(()=>{
|
|
300114
300496
|
if (!messageContainerRef.current || !messageFooterRef.current) {
|
|
300115
300497
|
return;
|
|
@@ -300167,14 +300549,14 @@ const MessageBoxWrap = (props)=>{
|
|
|
300167
300549
|
// chat-uikit-message-box-container chat-uikit-message-box-container-pc
|
|
300168
300550
|
className: classnames_default()(messageBoxContainerVariants({
|
|
300169
300551
|
isMobileLayout,
|
|
300170
|
-
isSentMessage
|
|
300552
|
+
isSentMessage: shouldApplySentMessageStyle
|
|
300171
300553
|
}), messageBoxWrapperClassname),
|
|
300172
300554
|
children: [
|
|
300173
300555
|
showUserInfo ? /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
300174
300556
|
// chat-uikit-message-box-container__avatar-wrap
|
|
300175
300557
|
className: classnames_default()('w-32px h-32px', {
|
|
300176
|
-
'ml-[12px]':
|
|
300177
|
-
'mr-[12px]': !
|
|
300558
|
+
'ml-[12px]': shouldApplySentMessageStyle,
|
|
300559
|
+
'mr-[12px]': !shouldApplySentMessageStyle
|
|
300178
300560
|
}),
|
|
300179
300561
|
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(AvatarWrap, {
|
|
300180
300562
|
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_webpack_exports_Avatar, {
|
|
@@ -300189,7 +300571,7 @@ const MessageBoxWrap = (props)=>{
|
|
|
300189
300571
|
// chat-uikit-message-box-container__message
|
|
300190
300572
|
className: classnames_default()('flex-1', {
|
|
300191
300573
|
'max-w-[calc(100%-80px)]': true,
|
|
300192
|
-
'flex justify-end':
|
|
300574
|
+
'flex justify-end': shouldApplySentMessageStyle
|
|
300193
300575
|
}),
|
|
300194
300576
|
children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
|
|
300195
300577
|
// chat-uikit-message-box-container__message__message-box
|
|
@@ -358055,9 +358437,10 @@ const removeAllListeners = (instance)=>{
|
|
|
358055
358437
|
instance.removeAllListeners('error');
|
|
358056
358438
|
instance.removeAllListeners('progress');
|
|
358057
358439
|
};
|
|
358058
|
-
// eslint-disable-next-line max-lines-per-function
|
|
358440
|
+
// eslint-disable-next-line @coze-arch/max-line-per-function, max-lines-per-function -- Upload function requires many lines for complete functionality
|
|
358059
358441
|
function upload_uploadFile(param) {
|
|
358060
358442
|
let { file, fileType = 'image', userId, signal, onProgress, onUploaderReady, onUploadError, onGetTokenError, onSuccess } = param;
|
|
358443
|
+
// eslint-disable-next-line @coze-arch/max-line-per-function, max-lines-per-function -- Promise handler requires many lines
|
|
358061
358444
|
return new Promise((resolve)=>{
|
|
358062
358445
|
let bytedUploader = null;
|
|
358063
358446
|
let shouldContinue = true;
|
|
@@ -358107,6 +358490,34 @@ function upload_uploadFile(param) {
|
|
|
358107
358490
|
}, false);
|
|
358108
358491
|
onUploaderReady === null || onUploaderReady === void 0 ? void 0 : onUploaderReady(bytedUploader);
|
|
358109
358492
|
bytedUploader.on('complete', (inform)=>{
|
|
358493
|
+
var _informAny_response, _informAny_result, _informAny__response, _informAny_rawResponse;
|
|
358494
|
+
// Backend returns: { data: { uri: "xxx", id: "yyy", url: "zzz" } }
|
|
358495
|
+
// Upload adapter may not map data.uri correctly - check complete inform structure
|
|
358496
|
+
const informAny = inform;
|
|
358497
|
+
// Check task object for raw response data
|
|
358498
|
+
let rawResponseData = null;
|
|
358499
|
+
if (informAny.task) {
|
|
358500
|
+
var _informAny_task_response, _informAny_task_responseData, _informAny_task_result, _informAny_task__response, _informAny_task_rawResponse;
|
|
358501
|
+
// Check various possible locations in task
|
|
358502
|
+
rawResponseData = ((_informAny_task_response = informAny.task.response) === null || _informAny_task_response === void 0 ? void 0 : _informAny_task_response.data) || ((_informAny_task_responseData = informAny.task.responseData) === null || _informAny_task_responseData === void 0 ? void 0 : _informAny_task_responseData.data) || ((_informAny_task_result = informAny.task.result) === null || _informAny_task_result === void 0 ? void 0 : _informAny_task_result.data) || informAny.task.data || ((_informAny_task__response = informAny.task._response) === null || _informAny_task__response === void 0 ? void 0 : _informAny_task__response.data) || ((_informAny_task_rawResponse = informAny.task.rawResponse) === null || _informAny_task_rawResponse === void 0 ? void 0 : _informAny_task_rawResponse.data);
|
|
358503
|
+
}
|
|
358504
|
+
// Also check inform level - check all possible nested paths
|
|
358505
|
+
const informLevelData = informAny.data || ((_informAny_response = informAny.response) === null || _informAny_response === void 0 ? void 0 : _informAny_response.data) || informAny.responseData || ((_informAny_result = informAny.result) === null || _informAny_result === void 0 ? void 0 : _informAny_result.data) || ((_informAny__response = informAny._response) === null || _informAny__response === void 0 ? void 0 : _informAny__response.data) || ((_informAny_rawResponse = informAny.rawResponse) === null || _informAny_rawResponse === void 0 ? void 0 : _informAny_rawResponse.data);
|
|
358506
|
+
// Use rawResponseData or informLevelData
|
|
358507
|
+
const backendData = rawResponseData || informLevelData;
|
|
358508
|
+
if (informAny.uploadResult && backendData) {
|
|
358509
|
+
// Backend returns lowercase fields: uri, id, url
|
|
358510
|
+
// Map them correctly to uploadResult
|
|
358511
|
+
if (backendData.uri) {
|
|
358512
|
+
informAny.uploadResult.uri = backendData.uri;
|
|
358513
|
+
}
|
|
358514
|
+
if (backendData.id) {
|
|
358515
|
+
informAny.uploadResult.id = backendData.id;
|
|
358516
|
+
}
|
|
358517
|
+
if (backendData.url) {
|
|
358518
|
+
informAny.uploadResult.url = backendData.url;
|
|
358519
|
+
}
|
|
358520
|
+
}
|
|
358110
358521
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(inform);
|
|
358111
358522
|
resolve();
|
|
358112
358523
|
});
|
|
@@ -358180,7 +358591,7 @@ const checkHasFileOnDrag = (e)=>{
|
|
|
358180
358591
|
Boolean((_e_dataTransfer = e.dataTransfer) === null || _e_dataTransfer === void 0 ? void 0 : _e_dataTransfer.types.includes('Files')));
|
|
358181
358592
|
};
|
|
358182
358593
|
const formatFileDataListToMessagePayload = (fileDataList)=>fileDataList.map((data)=>{
|
|
358183
|
-
const { uri } = data;
|
|
358594
|
+
const { uri, fileId } = data;
|
|
358184
358595
|
if (!uri) {
|
|
358185
358596
|
throw new Error('failed to get file uri');
|
|
358186
358597
|
}
|
|
@@ -358188,7 +358599,8 @@ const formatFileDataListToMessagePayload = (fileDataList)=>fileDataList.map((dat
|
|
|
358188
358599
|
const filePayload = {
|
|
358189
358600
|
type: types_ContentType.File,
|
|
358190
358601
|
file: data.file,
|
|
358191
|
-
uri
|
|
358602
|
+
uri,
|
|
358603
|
+
id: fileId || undefined
|
|
358192
358604
|
};
|
|
358193
358605
|
return filePayload;
|
|
358194
358606
|
}
|
|
@@ -358198,7 +358610,8 @@ const formatFileDataListToMessagePayload = (fileDataList)=>fileDataList.map((dat
|
|
|
358198
358610
|
file: data.file,
|
|
358199
358611
|
uri,
|
|
358200
358612
|
width: (meta === null || meta === void 0 ? void 0 : meta.width) ?? 0,
|
|
358201
|
-
height: (meta === null || meta === void 0 ? void 0 : meta.height) ?? 0
|
|
358613
|
+
height: (meta === null || meta === void 0 ? void 0 : meta.height) ?? 0,
|
|
358614
|
+
id: fileId || undefined
|
|
358202
358615
|
};
|
|
358203
358616
|
return imagePayload;
|
|
358204
358617
|
});
|
|
@@ -358438,17 +358851,52 @@ const useUpload = ()=>{
|
|
|
358438
358851
|
data.percent = event.percent;
|
|
358439
358852
|
});
|
|
358440
358853
|
},
|
|
358441
|
-
onComplete: (
|
|
358442
|
-
|
|
358854
|
+
onComplete: (event, id)=>{
|
|
358855
|
+
const { uploadResult } = event;
|
|
358856
|
+
// Event structure may contain additional properties from uploader library
|
|
358857
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Event structure varies
|
|
358858
|
+
const eventAny = event;
|
|
358443
358859
|
immerUpdateFileDataById(id, (data)=>{
|
|
358444
358860
|
data.status = types_FileStatus.Success;
|
|
358445
358861
|
data.percent = MAX_UPLOAD_PROGRESS;
|
|
358446
|
-
|
|
358447
|
-
|
|
358862
|
+
// Backend returns: { data: { uri: "xxx", id: "yyy", url: "zzz" } }
|
|
358863
|
+
// Upload adapter may map data.id to uploadResult.Uri (incorrectly)
|
|
358864
|
+
// We need to check the actual structure to get both id and uri correctly
|
|
358865
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- UploadResult structure varies
|
|
358866
|
+
const uploadResultAny = uploadResult;
|
|
358867
|
+
// Try to get raw response data from event object
|
|
358868
|
+
let backendData = null;
|
|
358869
|
+
if (eventAny.task) {
|
|
358870
|
+
var _eventAny_task_response, _eventAny_task_responseData, _eventAny_task_result;
|
|
358871
|
+
backendData = ((_eventAny_task_response = eventAny.task.response) === null || _eventAny_task_response === void 0 ? void 0 : _eventAny_task_response.data) || ((_eventAny_task_responseData = eventAny.task.responseData) === null || _eventAny_task_responseData === void 0 ? void 0 : _eventAny_task_responseData.data) || ((_eventAny_task_result = eventAny.task.result) === null || _eventAny_task_result === void 0 ? void 0 : _eventAny_task_result.data) || eventAny.task.data;
|
|
358872
|
+
}
|
|
358873
|
+
if (!backendData) {
|
|
358874
|
+
var _eventAny_response, _eventAny_result;
|
|
358875
|
+
backendData = eventAny.data || ((_eventAny_response = eventAny.response) === null || _eventAny_response === void 0 ? void 0 : _eventAny_response.data) || eventAny.responseData || ((_eventAny_result = eventAny.result) === null || _eventAny_result === void 0 ? void 0 : _eventAny_result.data);
|
|
358876
|
+
}
|
|
358877
|
+
// Backend returns lowercase fields: data.uri and data.id
|
|
358878
|
+
// Check if uploadResult has these fields directly (from raw response)
|
|
358879
|
+
// Or check if they're mapped to different fields
|
|
358880
|
+
const backendId = (backendData === null || backendData === void 0 ? void 0 : backendData.id) || // From raw backend response
|
|
358881
|
+
uploadResultAny.id || // Backend returns lowercase 'id'
|
|
358882
|
+
uploadResultAny.Id || // Check uppercase variant
|
|
358883
|
+
uploadResult.Uri || // Fallback to Uri if id not available
|
|
358884
|
+
null;
|
|
358885
|
+
// Backend returns lowercase 'uri' field
|
|
358886
|
+
// This is the real URI we need for getting file URL
|
|
358887
|
+
const backendUri = (backendData === null || backendData === void 0 ? void 0 : backendData.uri) || // From raw backend response - this is the real uri!
|
|
358888
|
+
uploadResultAny.uri || // Backend returns lowercase 'uri'
|
|
358889
|
+
uploadResultAny.Uri || // Check uppercase variant
|
|
358890
|
+
null;
|
|
358891
|
+
// Save backend file ID (used for other operations)
|
|
358892
|
+
data.fileId = backendId;
|
|
358893
|
+
// Save backend URI (used to get URL) - this should be the real URI from backend
|
|
358894
|
+
data.uri = backendUri;
|
|
358895
|
+
data.url = uploadResult.Url || uploadResultAny.url || (backendData === null || backendData === void 0 ? void 0 : backendData.url) || null;
|
|
358896
|
+
if (!data.uri && !data.fileId) {
|
|
358448
358897
|
data.status = types_FileStatus.Error;
|
|
358449
|
-
throw new Error('upload complete without uri');
|
|
358898
|
+
throw new Error('upload complete without uri or id');
|
|
358450
358899
|
}
|
|
358451
|
-
data.uri = uri;
|
|
358452
358900
|
if (data.fileType !== types_FileType.Image) {
|
|
358453
358901
|
return;
|
|
358454
358902
|
}
|
|
@@ -382853,7 +383301,10 @@ const scroll_view_ScrollView = /*#__PURE__*/ (0,react.forwardRef)(function Scrol
|
|
|
382853
383301
|
value: scrollViewContentRef,
|
|
382854
383302
|
children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
|
|
382855
383303
|
className: classnames_default()(src_scroll_view_index_module["scroll-view"], className),
|
|
382856
|
-
style:
|
|
383304
|
+
style: {
|
|
383305
|
+
...style,
|
|
383306
|
+
flexGrow: 1
|
|
383307
|
+
},
|
|
382857
383308
|
ref: wrapperRef,
|
|
382858
383309
|
children: [
|
|
382859
383310
|
before ? /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
@@ -382870,6 +383321,9 @@ const scroll_view_ScrollView = /*#__PURE__*/ (0,react.forwardRef)(function Scrol
|
|
|
382870
383321
|
className: classnames_default()(src_scroll_view_index_module.scrollable, showScrollbar && src_scroll_view_index_module["show-scrollbar"], autoShowScrollbar && src_scroll_view_index_module["auto-show-scrollbar"], scrollbarWidthNone && src_scroll_view_index_module["scrollbar-width-none"], {
|
|
382871
383322
|
[src_scroll_view_index_module.reverse]: reverse
|
|
382872
383323
|
}),
|
|
383324
|
+
// style={{
|
|
383325
|
+
// height: '100%',
|
|
383326
|
+
// }}
|
|
382873
383327
|
onScroll: handleScroll,
|
|
382874
383328
|
children: [
|
|
382875
383329
|
lodash_es_isFunction(children) ? children(controller) : children,
|
|
@@ -396331,7 +396785,10 @@ const DeleteFileButton = (param)=>{
|
|
|
396331
396785
|
};
|
|
396332
396786
|
return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
396333
396787
|
className: batch_upload_file_list_delete_file_button_index_module["icon-close"],
|
|
396334
|
-
onClick:
|
|
396788
|
+
onClick: (e)=>{
|
|
396789
|
+
e.stopPropagation();
|
|
396790
|
+
onDelete();
|
|
396791
|
+
},
|
|
396335
396792
|
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(IconCloseNoCycle, {})
|
|
396336
396793
|
});
|
|
396337
396794
|
};
|
|
@@ -396541,6 +396998,131 @@ const ui_button_Button = /*#__PURE__*/ (0,react.forwardRef)((param, ref)=>{
|
|
|
396541
396998
|
});
|
|
396542
396999
|
});
|
|
396543
397000
|
|
|
397001
|
+
;// CONCATENATED MODULE: ../../../common/chat-area/chat-area/src/hooks/use-doc-viewer-config.ts
|
|
397002
|
+
/*
|
|
397003
|
+
* Copyright 2025 coze-dev Authors
|
|
397004
|
+
*
|
|
397005
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
397006
|
+
* you may not use this file except in compliance with the License.
|
|
397007
|
+
* You may obtain a copy of the License at
|
|
397008
|
+
*
|
|
397009
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
397010
|
+
*
|
|
397011
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
397012
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
397013
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
397014
|
+
* See the License for the specific language governing permissions and
|
|
397015
|
+
* limitations under the License.
|
|
397016
|
+
*/ // Try to import useChatAppProps and useChatAppStore from open-chat if available
|
|
397017
|
+
|
|
397018
|
+
|
|
397019
|
+
|
|
397020
|
+
let use_doc_viewer_config_useChatAppProps = null;
|
|
397021
|
+
let use_doc_viewer_config_useChatAppStore = null;
|
|
397022
|
+
try {
|
|
397023
|
+
// Dynamic import, module may not be available
|
|
397024
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- Dynamic require needed for optional dependency
|
|
397025
|
+
const openChatModule = __webpack_require__(Object(function webpackMissingModule() { var e = new Error("Cannot find module '@coze-studio/open-chat'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
|
|
397026
|
+
// eslint-disable-next-line prefer-destructuring -- Direct assignment needed for conditional hook usage
|
|
397027
|
+
use_doc_viewer_config_useChatAppProps = openChatModule.useChatAppProps;
|
|
397028
|
+
// eslint-disable-next-line prefer-destructuring -- Direct assignment needed for conditional hook usage
|
|
397029
|
+
use_doc_viewer_config_useChatAppStore = openChatModule.useChatAppStore;
|
|
397030
|
+
} catch (error) {
|
|
397031
|
+
// Module not available, will use default values
|
|
397032
|
+
// Error is expected when module is not available, so we can safely ignore it
|
|
397033
|
+
if (false) {}
|
|
397034
|
+
}
|
|
397035
|
+
/**
|
|
397036
|
+
* Parse domain and productCode from apiUrl
|
|
397037
|
+
* apiUrl format: 域名/api/productCode/flow
|
|
397038
|
+
* Example: https://aiot-dev.glodon.com/api/cvforce/flow
|
|
397039
|
+
* Returns: { domain: 'https://aiot-dev.glodon.com', productCode: 'cvforce' }
|
|
397040
|
+
*/ const use_doc_viewer_config_parseApiUrl = (apiUrl)=>{
|
|
397041
|
+
const defaultDomain = 'https://aiot-dev.glodon.com';
|
|
397042
|
+
const defaultProductCode = 'cvforcepd';
|
|
397043
|
+
if (!apiUrl) {
|
|
397044
|
+
return {
|
|
397045
|
+
domain: defaultDomain,
|
|
397046
|
+
productCode: defaultProductCode
|
|
397047
|
+
};
|
|
397048
|
+
}
|
|
397049
|
+
try {
|
|
397050
|
+
// Parse URL: 域名/api/productCode/flow
|
|
397051
|
+
const url = new URL(apiUrl);
|
|
397052
|
+
const domain = `${url.protocol}//${url.host}`;
|
|
397053
|
+
const pathParts = url.pathname.split('/').filter(Boolean);
|
|
397054
|
+
// Find 'api' in path and get the next part as productCode
|
|
397055
|
+
const apiIndex = pathParts.indexOf('api');
|
|
397056
|
+
if (apiIndex >= 0 && apiIndex < pathParts.length - 1) {
|
|
397057
|
+
const productCode = pathParts[apiIndex + 1];
|
|
397058
|
+
if (productCode) {
|
|
397059
|
+
return {
|
|
397060
|
+
domain,
|
|
397061
|
+
productCode
|
|
397062
|
+
};
|
|
397063
|
+
}
|
|
397064
|
+
}
|
|
397065
|
+
} catch (urlError) {
|
|
397066
|
+
// If URL parsing fails, try regex
|
|
397067
|
+
const match = apiUrl.match(/^(https?:\/\/[^\/]+)\/api\/([^\/]+)\//);
|
|
397068
|
+
if (match && match[1] && match[2]) {
|
|
397069
|
+
return {
|
|
397070
|
+
domain: match[1],
|
|
397071
|
+
productCode: match[2]
|
|
397072
|
+
};
|
|
397073
|
+
}
|
|
397074
|
+
// If regex also fails, log in development mode
|
|
397075
|
+
if (false) {}
|
|
397076
|
+
}
|
|
397077
|
+
return {
|
|
397078
|
+
domain: defaultDomain,
|
|
397079
|
+
productCode: defaultProductCode
|
|
397080
|
+
};
|
|
397081
|
+
};
|
|
397082
|
+
/**
|
|
397083
|
+
* Build default doc viewer URL from apiUrl
|
|
397084
|
+
* Format: 域名/portal/_/productCode/doc-viewer/
|
|
397085
|
+
* Example: https://aiot-dev.glodon.com/api/cvforce/flow -> https://aiot-dev.glodon.com/portal/_/cvforce/doc-viewer/
|
|
397086
|
+
*/ const use_doc_viewer_config_buildDefaultDocViewerUrl = (apiUrl)=>{
|
|
397087
|
+
const { domain, productCode } = use_doc_viewer_config_parseApiUrl(apiUrl);
|
|
397088
|
+
return `${domain}/portal/_/${productCode}/doc-viewer/`;
|
|
397089
|
+
};
|
|
397090
|
+
/**
|
|
397091
|
+
* Get document viewer configuration from SDK config
|
|
397092
|
+
* Falls back to default values parsed from apiUrl if SDK config is not available
|
|
397093
|
+
*/ const use_doc_viewer_config_useDocViewerConfig = ()=>{
|
|
397094
|
+
let docViewerConfig;
|
|
397095
|
+
let apiUrl;
|
|
397096
|
+
// These hooks are dynamically imported and may not be available
|
|
397097
|
+
if (use_doc_viewer_config_useChatAppProps) {
|
|
397098
|
+
try {
|
|
397099
|
+
var _chatConfigResult_chatConfig_extra, _chatConfigResult_chatConfig;
|
|
397100
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Hook is conditionally available
|
|
397101
|
+
const chatConfigResult = use_doc_viewer_config_useChatAppProps();
|
|
397102
|
+
docViewerConfig = chatConfigResult === null || chatConfigResult === void 0 ? void 0 : (_chatConfigResult_chatConfig = chatConfigResult.chatConfig) === null || _chatConfigResult_chatConfig === void 0 ? void 0 : (_chatConfigResult_chatConfig_extra = _chatConfigResult_chatConfig.extra) === null || _chatConfigResult_chatConfig_extra === void 0 ? void 0 : _chatConfigResult_chatConfig_extra.docViewer;
|
|
397103
|
+
} catch (hookError) {
|
|
397104
|
+
// Hook not available in this context, use defaults
|
|
397105
|
+
if (false) {}
|
|
397106
|
+
}
|
|
397107
|
+
}
|
|
397108
|
+
if (use_doc_viewer_config_useChatAppStore) {
|
|
397109
|
+
try {
|
|
397110
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- Hook is conditionally available
|
|
397111
|
+
apiUrl = use_doc_viewer_config_useChatAppStore((state)=>state.apiUrl);
|
|
397112
|
+
} catch (storeError) {
|
|
397113
|
+
// Store not available in this context, use defaults
|
|
397114
|
+
if (false) {}
|
|
397115
|
+
}
|
|
397116
|
+
}
|
|
397117
|
+
// Default values: use config if provided, otherwise parse from apiUrl
|
|
397118
|
+
const baseUrl = (docViewerConfig === null || docViewerConfig === void 0 ? void 0 : docViewerConfig.baseUrl) || use_doc_viewer_config_buildDefaultDocViewerUrl(apiUrl);
|
|
397119
|
+
const urlParam = (docViewerConfig === null || docViewerConfig === void 0 ? void 0 : docViewerConfig.urlParam) || 'url';
|
|
397120
|
+
return {
|
|
397121
|
+
baseUrl,
|
|
397122
|
+
urlParam
|
|
397123
|
+
};
|
|
397124
|
+
};
|
|
397125
|
+
|
|
396544
397126
|
// EXTERNAL MODULE: ../../../../../common/temp/default/node_modules/.pnpm/css-loader@6.11.0_@rspack+core@1.5.8_webpack@5.91.0/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!../../../../../common/temp/default/node_modules/.pnpm/postcss-loader@7.3.4_postcss@8.5.6_typescript@5.8.2_webpack@5.91.0/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[7].use[2]!../../../../../common/temp/default/node_modules/.pnpm/less-loader@11.1.4_less@4.4.2_webpack@5.91.0/node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[7].use[3]!../../../common/chat-area/chat-area/src/components/batch-upload-file-list/common-file/index.module.less
|
|
396545
397127
|
var common_file_index_module = __webpack_require__(26758);
|
|
396546
397128
|
;// CONCATENATED MODULE: ../../../common/chat-area/chat-area/src/components/batch-upload-file-list/common-file/index.module.less
|
|
@@ -396628,8 +397210,12 @@ const ProgressMask = (param)=>{
|
|
|
396628
397210
|
|
|
396629
397211
|
|
|
396630
397212
|
|
|
397213
|
+
|
|
397214
|
+
|
|
397215
|
+
|
|
397216
|
+
|
|
396631
397217
|
const CommonFile = (param)=>{
|
|
396632
|
-
let { file, status, percent, id, className } = param;
|
|
397218
|
+
let { file, status, percent, id, className, uri, url } = param;
|
|
396633
397219
|
const ref = (0,react.useRef)(null);
|
|
396634
397220
|
const isHover = es_useHover(ref);
|
|
396635
397221
|
const retryUpload = useRetryUpload();
|
|
@@ -396638,9 +397224,59 @@ const CommonFile = (param)=>{
|
|
|
396638
397224
|
const isSuccess = status === types_FileStatus.Success;
|
|
396639
397225
|
const fileTypeConfig = getFileTypConfig(file);
|
|
396640
397226
|
const { extension, nameWithoutExtension } = getFileExtensionAndName(file.name);
|
|
397227
|
+
const { baseUrl, urlParam } = use_doc_viewer_config_useDocViewerConfig();
|
|
397228
|
+
const buildDocViewerUrl = (fileUrl)=>{
|
|
397229
|
+
const separator = baseUrl.includes('?') ? '&' : '?';
|
|
397230
|
+
return `${baseUrl}${separator}${urlParam}=${encodeURIComponent(fileUrl)}`;
|
|
397231
|
+
};
|
|
397232
|
+
const handlePreview = (e)=>{
|
|
397233
|
+
e.stopPropagation();
|
|
397234
|
+
if (!isSuccess) {
|
|
397235
|
+
return;
|
|
397236
|
+
}
|
|
397237
|
+
// 如果已经有 url,直接使用
|
|
397238
|
+
if (url) {
|
|
397239
|
+
const docViewerUrl = buildDocViewerUrl(url);
|
|
397240
|
+
window.open(docViewerUrl, '_blank');
|
|
397241
|
+
return;
|
|
397242
|
+
}
|
|
397243
|
+
if (!uri) {
|
|
397244
|
+
console.warn('File URI is not available, cannot open file');
|
|
397245
|
+
return;
|
|
397246
|
+
}
|
|
397247
|
+
const docViewerUrl = buildDocViewerUrl(uri);
|
|
397248
|
+
window.open(docViewerUrl, '_blank');
|
|
397249
|
+
};
|
|
397250
|
+
const handleClick = (e)=>{
|
|
397251
|
+
if (!isSuccess) {
|
|
397252
|
+
return;
|
|
397253
|
+
}
|
|
397254
|
+
// 如果点击的是操作按钮或其子元素,不执行跳转
|
|
397255
|
+
// 操作按钮已经通过 stopPropagation 阻止冒泡,这里作为额外保护
|
|
397256
|
+
const target = e.target;
|
|
397257
|
+
if (target.closest(`.${batch_upload_file_list_common_file_index_module["retry-button"]}`) || target.closest(`.${batch_upload_file_list_common_file_index_module["preview-button"]}`) || target.closest('[class*="icon-close"]') || target.closest('button')) {
|
|
397258
|
+
return;
|
|
397259
|
+
}
|
|
397260
|
+
// 如果已经有 url,直接使用
|
|
397261
|
+
if (url) {
|
|
397262
|
+
const docViewerUrl = buildDocViewerUrl(url);
|
|
397263
|
+
window.open(docViewerUrl, '_blank');
|
|
397264
|
+
return;
|
|
397265
|
+
}
|
|
397266
|
+
if (!uri) {
|
|
397267
|
+
console.warn('File URI is not available, cannot open file');
|
|
397268
|
+
return;
|
|
397269
|
+
}
|
|
397270
|
+
const docViewerUrl = buildDocViewerUrl(uri);
|
|
397271
|
+
window.open(docViewerUrl, '_blank');
|
|
397272
|
+
};
|
|
396641
397273
|
return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", {
|
|
396642
397274
|
ref: ref,
|
|
396643
397275
|
className: classnames_default()(batch_upload_file_list_common_file_index_module["normal-file"], !isSuccess && batch_upload_file_list_common_file_index_module["normal-file-not-success"], className),
|
|
397276
|
+
style: {
|
|
397277
|
+
cursor: 'pointer'
|
|
397278
|
+
},
|
|
397279
|
+
onClick: handleClick,
|
|
396644
397280
|
children: [
|
|
396645
397281
|
/*#__PURE__*/ (0,jsx_runtime.jsx)("img", {
|
|
396646
397282
|
src: getCommonFileIcon(fileTypeConfig === null || fileTypeConfig === void 0 ? void 0 : fileTypeConfig.fileType),
|
|
@@ -396675,10 +397311,24 @@ const CommonFile = (param)=>{
|
|
|
396675
397311
|
}),
|
|
396676
397312
|
isError ? /*#__PURE__*/ (0,jsx_runtime.jsx)(ui_button_Button, {
|
|
396677
397313
|
icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(src_IconRefresh, {}),
|
|
396678
|
-
onClick:
|
|
397314
|
+
onClick: (e)=>{
|
|
397315
|
+
e.stopPropagation();
|
|
397316
|
+
onRetry();
|
|
397317
|
+
},
|
|
396679
397318
|
theme: "borderless",
|
|
396680
397319
|
className: batch_upload_file_list_common_file_index_module["retry-button"]
|
|
396681
397320
|
}) : null,
|
|
397321
|
+
isSuccess ? /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_webpack_exports_Tooltip, {
|
|
397322
|
+
content: "预览",
|
|
397323
|
+
theme: "light",
|
|
397324
|
+
position: "top",
|
|
397325
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ui_button_Button, {
|
|
397326
|
+
icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(__webpack_exports__IconCozEye, {}),
|
|
397327
|
+
onClick: handlePreview,
|
|
397328
|
+
theme: "borderless",
|
|
397329
|
+
className: batch_upload_file_list_common_file_index_module["preview-button"]
|
|
397330
|
+
})
|
|
397331
|
+
}) : null,
|
|
396682
397332
|
!isError && !isSuccess && /*#__PURE__*/ (0,jsx_runtime.jsx)(ProgressMask, {
|
|
396683
397333
|
percent: percent
|
|
396684
397334
|
}),
|
|
@@ -398290,9 +398940,6 @@ const ChatAreaMain = (param)=>{
|
|
|
398290
398940
|
[src_chat_area_main_index_modules["chat-area-main-pc"]]: layout === common_Layout.PC,
|
|
398291
398941
|
[src_chat_area_main_index_modules["chat-area-main-mobile"]]: layout === common_Layout.MOBILE
|
|
398292
398942
|
}, classname),
|
|
398293
|
-
style: {
|
|
398294
|
-
justifyContent: !hasMessages ? 'center' : 'auto'
|
|
398295
|
-
},
|
|
398296
398943
|
children: [
|
|
398297
398944
|
/*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
398298
398945
|
className: src_chat_area_main_index_modules["header-node"],
|
|
@@ -398523,6 +399170,31 @@ class upload_plugin_UploadPlugin {
|
|
|
398523
399170
|
this.eventBus.emit('error', errorEvent);
|
|
398524
399171
|
},
|
|
398525
399172
|
onSuccess: (event)=>{
|
|
399173
|
+
// Event structure may contain additional properties from uploader library
|
|
399174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Event structure varies
|
|
399175
|
+
const eventAny = event;
|
|
399176
|
+
// Try to get raw response from task if it exists
|
|
399177
|
+
let backendData = null;
|
|
399178
|
+
if (eventAny.task) {
|
|
399179
|
+
var _eventAny_task_response, _eventAny_task_responseData, _eventAny_task__response, _eventAny_task_rawResponse;
|
|
399180
|
+
backendData = ((_eventAny_task_response = eventAny.task.response) === null || _eventAny_task_response === void 0 ? void 0 : _eventAny_task_response.data) || ((_eventAny_task_responseData = eventAny.task.responseData) === null || _eventAny_task_responseData === void 0 ? void 0 : _eventAny_task_responseData.data) || ((_eventAny_task__response = eventAny.task._response) === null || _eventAny_task__response === void 0 ? void 0 : _eventAny_task__response.data) || ((_eventAny_task_rawResponse = eventAny.task.rawResponse) === null || _eventAny_task_rawResponse === void 0 ? void 0 : _eventAny_task_rawResponse.data) || eventAny.task.data;
|
|
399181
|
+
}
|
|
399182
|
+
if (!backendData) {
|
|
399183
|
+
var _eventAny_response, _eventAny_result;
|
|
399184
|
+
backendData = eventAny.data || ((_eventAny_response = eventAny.response) === null || _eventAny_response === void 0 ? void 0 : _eventAny_response.data) || eventAny.responseData || ((_eventAny_result = eventAny.result) === null || _eventAny_result === void 0 ? void 0 : _eventAny_result.data);
|
|
399185
|
+
}
|
|
399186
|
+
// If we found raw data, add uri and id to uploadResult
|
|
399187
|
+
if (backendData && eventAny.uploadResult) {
|
|
399188
|
+
if (backendData.uri) {
|
|
399189
|
+
eventAny.uploadResult.uri = backendData.uri;
|
|
399190
|
+
}
|
|
399191
|
+
if (backendData.id) {
|
|
399192
|
+
eventAny.uploadResult.id = backendData.id;
|
|
399193
|
+
}
|
|
399194
|
+
if (backendData.url) {
|
|
399195
|
+
eventAny.uploadResult.url = backendData.url;
|
|
399196
|
+
}
|
|
399197
|
+
}
|
|
398526
399198
|
const completeEvent = event;
|
|
398527
399199
|
this.eventBus.emit('complete', completeEvent);
|
|
398528
399200
|
}
|
|
@@ -398574,7 +399246,9 @@ class UploadController {
|
|
|
398574
399246
|
type: batch_file_upload_isImage(file) ? 'image' : 'object'
|
|
398575
399247
|
});
|
|
398576
399248
|
this.uploadPlugin.on('progress', (event)=>onProgress(event, fileId));
|
|
398577
|
-
this.uploadPlugin.on('complete', (event)=>
|
|
399249
|
+
this.uploadPlugin.on('complete', (event)=>{
|
|
399250
|
+
onComplete(event, fileId);
|
|
399251
|
+
});
|
|
398578
399252
|
this.uploadPlugin.on('error', (event)=>onError(event, fileId));
|
|
398579
399253
|
this.uploadPlugin.on('ready', (event)=>onReady(event, fileId));
|
|
398580
399254
|
}
|
|
@@ -403173,7 +403847,9 @@ const createBatchFileUploadStore = (mark)=>esm_create()(devtools((set, get)=>({
|
|
|
403173
403847
|
set(immer_produce((state)=>{
|
|
403174
403848
|
const baseFileData = {
|
|
403175
403849
|
percent: 0,
|
|
403850
|
+
fileId: null,
|
|
403176
403851
|
uri: null,
|
|
403852
|
+
url: null,
|
|
403177
403853
|
file,
|
|
403178
403854
|
id,
|
|
403179
403855
|
status: types_FileStatus.Uploading
|
|
@@ -406908,8 +407584,8 @@ const usePaginationRequest = (param)=>{
|
|
|
406908
407584
|
// eslint-disable-next-line @coze-arch/max-line-per-function
|
|
406909
407585
|
const useConversationList = (conversationListParams)=>{
|
|
406910
407586
|
const { pageSize = 20, initialPageNum = 1, order = 'updated_at' } = conversationListParams ?? {};
|
|
406911
|
-
const { chatConfig: { bot_id: botId, appInfo, type: chatType, auth: { connectorId } = {} } } =
|
|
406912
|
-
const { cozeApiSdk, currentConversationInfo, updateCurrentConversationInfo, conversations, updateConversations } =
|
|
407587
|
+
const { chatConfig: { bot_id: botId, appInfo, type: chatType, auth: { connectorId } = {} } } = context_useChatAppProps();
|
|
407588
|
+
const { cozeApiSdk, currentConversationInfo, updateCurrentConversationInfo, conversations, updateConversations } = context_useChatAppStore(shallow_useShallow((state)=>({
|
|
406913
407589
|
cozeApiSdk: state.cozeApi,
|
|
406914
407590
|
conversations: state.conversations,
|
|
406915
407591
|
updateCurrentConversationInfo: state.updateCurrentConversationInfo,
|
|
@@ -406936,7 +407612,7 @@ const useConversationList = (conversationListParams)=>{
|
|
|
406936
407612
|
}
|
|
406937
407613
|
setAppModeLoading(true);
|
|
406938
407614
|
try {
|
|
406939
|
-
var _res_data;
|
|
407615
|
+
var _res_data, _res_data1;
|
|
406940
407616
|
const res = await cozeApiSdk.get('/v1/workflow/conversations', {
|
|
406941
407617
|
app_id: appId,
|
|
406942
407618
|
workflow_id: workflowId,
|
|
@@ -406965,8 +407641,9 @@ const useConversationList = (conversationListParams)=>{
|
|
|
406965
407641
|
title: item.title
|
|
406966
407642
|
}
|
|
406967
407643
|
}));
|
|
406968
|
-
//
|
|
406969
|
-
|
|
407644
|
+
// 使用 API 返回的 has_more 字段来判断是否还有更多数据
|
|
407645
|
+
// 如果 API 没有返回 has_more,则根据返回的数据量判断(兼容旧版本)
|
|
407646
|
+
const hasMoreData = ((_res_data1 = res.data) === null || _res_data1 === void 0 ? void 0 : _res_data1.has_more) !== undefined ? res.data.has_more : convertedConversations.length >= pageSize;
|
|
406970
407647
|
if (beforeTimestamp === undefined) {
|
|
406971
407648
|
// 首次加载,替换数据
|
|
406972
407649
|
setAppModeData(convertedConversations);
|
|
@@ -406979,9 +407656,9 @@ const useConversationList = (conversationListParams)=>{
|
|
|
406979
407656
|
}
|
|
406980
407657
|
// 更新 before_updated_at:使用返回数据中最小的 updated_at(原始毫秒级时间戳)
|
|
406981
407658
|
if (convertedConversations.length > 0) {
|
|
406982
|
-
var
|
|
407659
|
+
var _res_data2;
|
|
406983
407660
|
// 从原始数据中找到最小的 updated_at(毫秒级)
|
|
406984
|
-
const minUpdatedAtMs = Math.min(...(((
|
|
407661
|
+
const minUpdatedAtMs = Math.min(...(((_res_data2 = res.data) === null || _res_data2 === void 0 ? void 0 : _res_data2.conversations) || []).map((item)=>item.updated_at || 0));
|
|
406985
407662
|
if (minUpdatedAtMs > 0) {
|
|
406986
407663
|
setBeforeUpdatedAt(minUpdatedAtMs);
|
|
406987
407664
|
} else {
|
|
@@ -406991,6 +407668,7 @@ const useConversationList = (conversationListParams)=>{
|
|
|
406991
407668
|
// 如果没有返回数据,说明没有更多了
|
|
406992
407669
|
setAppModeHasMore(false);
|
|
406993
407670
|
}
|
|
407671
|
+
// 根据 API 返回的 has_more 字段设置状态
|
|
406994
407672
|
setAppModeHasMore(hasMoreData);
|
|
406995
407673
|
} catch (e) {
|
|
406996
407674
|
console.error(e);
|
|
@@ -407010,8 +407688,9 @@ const useConversationList = (conversationListParams)=>{
|
|
|
407010
407688
|
appModeLoading
|
|
407011
407689
|
]);
|
|
407012
407690
|
// App 模式:首次加载
|
|
407691
|
+
// 只在列表为空且 hasMore 为 true 时才加载,避免 has_more: false 时重复请求
|
|
407013
407692
|
(0,react.useEffect)(()=>{
|
|
407014
|
-
if (isAppType && cozeApiSdk && hasValidId && appModeData.length === 0) {
|
|
407693
|
+
if (isAppType && cozeApiSdk && hasValidId && appModeData.length === 0 && appModeHasMore && !appModeLoading) {
|
|
407015
407694
|
loadAppModeConversations();
|
|
407016
407695
|
}
|
|
407017
407696
|
}, [
|
|
@@ -407019,9 +407698,12 @@ const useConversationList = (conversationListParams)=>{
|
|
|
407019
407698
|
cozeApiSdk,
|
|
407020
407699
|
hasValidId,
|
|
407021
407700
|
loadAppModeConversations,
|
|
407022
|
-
appModeData.length
|
|
407701
|
+
appModeData.length,
|
|
407702
|
+
appModeHasMore,
|
|
407703
|
+
appModeLoading
|
|
407023
407704
|
]);
|
|
407024
407705
|
// App 模式:loadMore 函数
|
|
407706
|
+
// 只在 has_more 为 true 时才发送请求
|
|
407025
407707
|
const appModeLoadMore = (0,react.useCallback)(async ()=>{
|
|
407026
407708
|
if (appModeHasMore && !appModeLoading && beforeUpdatedAt !== undefined) {
|
|
407027
407709
|
await loadAppModeConversations(beforeUpdatedAt);
|
|
@@ -407717,23 +408399,26 @@ const PcConversationItem = (param)=>{
|
|
|
407717
408399
|
},
|
|
407718
408400
|
children: item.title || intl_i18n.t('web_sdk_conversation_default_name')
|
|
407719
408401
|
}),
|
|
407720
|
-
/*#__PURE__*/ (0,jsx_runtime.jsx)(
|
|
407721
|
-
|
|
407722
|
-
|
|
407723
|
-
|
|
407724
|
-
|
|
407725
|
-
|
|
407726
|
-
|
|
407727
|
-
|
|
407728
|
-
|
|
407729
|
-
|
|
407730
|
-
|
|
407731
|
-
|
|
407732
|
-
|
|
407733
|
-
|
|
407734
|
-
|
|
407735
|
-
|
|
407736
|
-
|
|
408402
|
+
/*#__PURE__*/ (0,jsx_runtime.jsx)("div", {
|
|
408403
|
+
className: conversation_item_pc_index_module["conversation-operate-wrapper"],
|
|
408404
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(Operate, {
|
|
408405
|
+
onRename: ()=>{
|
|
408406
|
+
onRename(item);
|
|
408407
|
+
setVisible(false);
|
|
408408
|
+
},
|
|
408409
|
+
onDelete: ()=>{
|
|
408410
|
+
onDelete(item);
|
|
408411
|
+
setVisible(false);
|
|
408412
|
+
},
|
|
408413
|
+
visible: visible,
|
|
408414
|
+
setVisible: setVisible,
|
|
408415
|
+
children: /*#__PURE__*/ (0,jsx_runtime.jsx)(esm_webpack_exports_IconButton, {
|
|
408416
|
+
className: conversation_item_pc_index_module["conversation-operate-button"],
|
|
408417
|
+
onClick: handleClick,
|
|
408418
|
+
size: "small",
|
|
408419
|
+
icon: /*#__PURE__*/ (0,jsx_runtime.jsx)(__webpack_exports__IconCozMore, {}),
|
|
408420
|
+
color: "secondary"
|
|
408421
|
+
})
|
|
407737
408422
|
})
|
|
407738
408423
|
})
|
|
407739
408424
|
]
|
|
@@ -407802,7 +408487,7 @@ var conversation_list_index_module_update = injectStylesIntoStyleTag_default()(c
|
|
|
407802
408487
|
const ConversationList = /*#__PURE__*/ (0,react.forwardRef)(// eslint-disable-next-line @coze-arch/max-line-per-function
|
|
407803
408488
|
(param, ref)=>{
|
|
407804
408489
|
let { onRename, onDelete, loading, groupedConversations, conversations, hasMore, loadMore, removeConversation } = param;
|
|
407805
|
-
const { currentConversationInfo, updateCurrentConversationInfo, cozeApi, updateConversations } =
|
|
408490
|
+
const { currentConversationInfo, updateCurrentConversationInfo, cozeApi, updateConversations } = context_useChatAppStore(shallow_useShallow((state)=>({
|
|
407806
408491
|
currentConversationInfo: state.currentConversationInfo,
|
|
407807
408492
|
updateCurrentConversationInfo: state.updateCurrentConversationInfo,
|
|
407808
408493
|
cozeApi: state.cozeApi,
|
|
@@ -407811,7 +408496,7 @@ const ConversationList = /*#__PURE__*/ (0,react.forwardRef)(// eslint-disable-ne
|
|
|
407811
408496
|
const conversationRef = (0,react.useRef)();
|
|
407812
408497
|
const [addLoading, setAddLoading] = (0,react.useState)(false);
|
|
407813
408498
|
const isCreatingRef = (0,react.useRef)(false);
|
|
407814
|
-
const { layout, chatConfig: { type: chatType } } =
|
|
408499
|
+
const { layout, chatConfig: { type: chatType } } = context_useChatAppProps();
|
|
407815
408500
|
// 确保 conversationRef 与 currentConversationInfo 保持同步
|
|
407816
408501
|
// 这样在重载页面后,getConversationInfo 也能返回正确的值
|
|
407817
408502
|
// 注意:即使 id 为空字符串,也要更新 conversationRef,以便 getConversationInfo 返回空会话
|
|
@@ -408140,13 +408825,13 @@ var conversation_list_sider_index_module_update = injectStylesIntoStyleTag_defau
|
|
|
408140
408825
|
/* eslint-disable @coze-arch/max-line-per-function -- This component handles complex conversation list sidebar logic */ const ConversationListSider = /*#__PURE__*/ (0,react.forwardRef)((param, ref)=>{
|
|
408141
408826
|
let { children } = param;
|
|
408142
408827
|
const conversationListRef = (0,react.useRef)(null);
|
|
408143
|
-
const { currentConversationInfo, updateConversations, updateCurrentConversationInfo, cozeApi } =
|
|
408828
|
+
const { currentConversationInfo, updateConversations, updateCurrentConversationInfo, cozeApi } = context_useChatAppStore(shallow_useShallow((state)=>({
|
|
408144
408829
|
currentConversationInfo: state.currentConversationInfo,
|
|
408145
408830
|
updateConversations: state.updateConversations,
|
|
408146
408831
|
updateCurrentConversationInfo: state.updateCurrentConversationInfo,
|
|
408147
408832
|
cozeApi: state.cozeApi
|
|
408148
408833
|
})));
|
|
408149
|
-
const { chatConfig: { type: chatType } } =
|
|
408834
|
+
const { chatConfig: { type: chatType } } = context_useChatAppProps();
|
|
408150
408835
|
const { loading, conversations, hasMore, loadMore, removeConversation } = useConversationList();
|
|
408151
408836
|
const groupedConversations = useGroupedConversations(conversations);
|
|
408152
408837
|
const [isModalLoading, setIsModalLoading] = (0,react.useState)(false);
|
|
@@ -408814,7 +409499,7 @@ const ChatPropsProvider = (param)=>{
|
|
|
408814
409499
|
}) : children
|
|
408815
409500
|
});
|
|
408816
409501
|
};
|
|
408817
|
-
const
|
|
409502
|
+
const context_useChatAppProps = ()=>{
|
|
408818
409503
|
const { appProps } = (0,react.useContext)(ChatPropsContext);
|
|
408819
409504
|
const { chatConfig = {
|
|
408820
409505
|
conversation_id: index_browser_nanoid(),
|
|
@@ -408828,7 +409513,7 @@ const useChatAppProps = ()=>{
|
|
|
408828
409513
|
enableReplacePrologueNicknameWithVar
|
|
408829
409514
|
};
|
|
408830
409515
|
};
|
|
408831
|
-
const
|
|
409516
|
+
const context_useChatAppStore = (selector)=>{
|
|
408832
409517
|
const { store } = (0,react.useContext)(ChatPropsContext);
|
|
408833
409518
|
if (!store) {
|
|
408834
409519
|
throw ChatSdkError.create(error_SDKErrorCode.StoreProvider);
|
|
@@ -408854,8 +409539,8 @@ const useChatAppStore = (selector)=>{
|
|
|
408854
409539
|
*/
|
|
408855
409540
|
const useIsShowBackground = ()=>{
|
|
408856
409541
|
var _backgroundInfo_mobile_background_image;
|
|
408857
|
-
const backgroundInfo =
|
|
408858
|
-
const { isCustomBackground } =
|
|
409542
|
+
const backgroundInfo = context_useChatAppStore((s)=>s.backgroundInfo);
|
|
409543
|
+
const { isCustomBackground } = context_useChatAppProps();
|
|
408859
409544
|
// 自定义背景图,或者背景图有数据,则有背景状态
|
|
408860
409545
|
return isCustomBackground || !!(backgroundInfo === null || backgroundInfo === void 0 ? void 0 : (_backgroundInfo_mobile_background_image = backgroundInfo.mobile_background_image) === null || _backgroundInfo_mobile_background_image === void 0 ? void 0 : _backgroundInfo_mobile_background_image.origin_image_url) || false;
|
|
408861
409546
|
};
|
|
@@ -412906,13 +413591,23 @@ const createSDKUploadPluginClass = (param)=>{
|
|
|
412906
413591
|
this.file = props.file;
|
|
412907
413592
|
this.fileType = props.type;
|
|
412908
413593
|
this.upload().then((meta)=>{
|
|
413594
|
+
// Backend returns: { uri: "xxx", id: "yyy", url: "zzz" }
|
|
413595
|
+
// meta.uri should be the real URI (not the id)
|
|
413596
|
+
// meta.id should be the backend file ID
|
|
413597
|
+
// UploadResult structure requires dynamic properties, using type assertion
|
|
413598
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- UploadResult structure requires dynamic properties
|
|
413599
|
+
const uploadResult = {
|
|
413600
|
+
Uri: meta.uri,
|
|
413601
|
+
Url: meta.url
|
|
413602
|
+
};
|
|
413603
|
+
// Add id if available
|
|
413604
|
+
if (meta.id) {
|
|
413605
|
+
uploadResult.Id = meta.id;
|
|
413606
|
+
}
|
|
412909
413607
|
this.eventBus.emit('complete', {
|
|
412910
413608
|
percent: 100,
|
|
412911
413609
|
status: types_FileStatus.Success,
|
|
412912
|
-
uploadResult
|
|
412913
|
-
Uri: meta.uri,
|
|
412914
|
-
Url: meta.url
|
|
412915
|
-
},
|
|
413610
|
+
uploadResult,
|
|
412916
413611
|
type: 'success'
|
|
412917
413612
|
});
|
|
412918
413613
|
}).catch((err)=>{
|
|
@@ -413011,7 +413706,7 @@ studioOpenClientReporter.init(studio_open_client_reporter_slardarInstance);
|
|
|
413011
413706
|
|
|
413012
413707
|
const useUpdateConversationNameByMessage = ()=>{
|
|
413013
413708
|
const currentConversationNameRef = (0,react.useRef)();
|
|
413014
|
-
const { updateCurrentConversationNameByMessage, currentConversationInfo } =
|
|
413709
|
+
const { updateCurrentConversationNameByMessage, currentConversationInfo } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
413015
413710
|
updateCurrentConversationNameByMessage: s.updateCurrentConversationNameByMessage,
|
|
413016
413711
|
currentConversationInfo: s.currentConversationInfo
|
|
413017
413712
|
})));
|
|
@@ -413055,7 +413750,7 @@ const useUpdateConversationNameByMessage = ()=>{
|
|
|
413055
413750
|
|
|
413056
413751
|
|
|
413057
413752
|
const useUserInfo = ()=>{
|
|
413058
|
-
const userInfo =
|
|
413753
|
+
const userInfo = context_useChatAppStore((s)=>s.userInfo);
|
|
413059
413754
|
return (0,react.useMemo)(()=>{
|
|
413060
413755
|
const openUserInfo = userInfo;
|
|
413061
413756
|
if (!openUserInfo || !openUserInfo.id) {
|
|
@@ -416016,9 +416711,9 @@ class CozeApiCustom extends CozeAPI {
|
|
|
416016
416711
|
|
|
416017
416712
|
|
|
416018
416713
|
const useApiClient = ()=>{
|
|
416019
|
-
const { debug } =
|
|
416714
|
+
const { debug } = context_useChatAppProps();
|
|
416020
416715
|
const { token = '', refreshToken: refreshTokenRaw, setToken, setCozeApi, // 从 store 中获取 apiUrl
|
|
416021
|
-
apiUrl } =
|
|
416716
|
+
apiUrl } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
416022
416717
|
token: s.token,
|
|
416023
416718
|
setToken: s.setToken,
|
|
416024
416719
|
refreshToken: s.refreshToken,
|
|
@@ -416145,9 +416840,20 @@ const useUploadFileApi = ()=>{
|
|
|
416145
416840
|
const result = await (cozeApiSdk === null || cozeApiSdk === void 0 ? void 0 : cozeApiSdk.files.upload({
|
|
416146
416841
|
file
|
|
416147
416842
|
}));
|
|
416843
|
+
// Backend response structure may vary, using type assertion for flexibility
|
|
416844
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Backend response structure varies
|
|
416845
|
+
const resultAny = result;
|
|
416846
|
+
// Backend returns: { data: { uri: "xxx", id: "yyy", url: "zzz" } }
|
|
416847
|
+
// Or possibly: { id: "yyy", uri: "xxx", url: "zzz" }
|
|
416848
|
+
// We need to extract both uri and id correctly
|
|
416849
|
+
const backendData = (resultAny === null || resultAny === void 0 ? void 0 : resultAny.data) || resultAny;
|
|
416850
|
+
const uri = (backendData === null || backendData === void 0 ? void 0 : backendData.uri) || ''; // Real URI from backend
|
|
416851
|
+
const id = (backendData === null || backendData === void 0 ? void 0 : backendData.id) || (resultAny === null || resultAny === void 0 ? void 0 : resultAny.id) || ''; // Backend file ID
|
|
416852
|
+
const url = (backendData === null || backendData === void 0 ? void 0 : backendData.url) || (resultAny === null || resultAny === void 0 ? void 0 : resultAny.url) || '';
|
|
416148
416853
|
return {
|
|
416149
|
-
uri:
|
|
416150
|
-
url
|
|
416854
|
+
uri: uri || id,
|
|
416855
|
+
url,
|
|
416856
|
+
id: id || undefined
|
|
416151
416857
|
};
|
|
416152
416858
|
}, [
|
|
416153
416859
|
cozeApiSdk
|
|
@@ -416270,7 +416976,45 @@ const convertShortcutData = (shortcutCommands, botInfo)=>//@ts-expect-error: 不
|
|
|
416270
416976
|
|
|
416271
416977
|
|
|
416272
416978
|
|
|
416979
|
+
|
|
416980
|
+
|
|
416981
|
+
|
|
416273
416982
|
const microSeconds = 1000;
|
|
416983
|
+
/**
|
|
416984
|
+
* 从URL中提取文件名
|
|
416985
|
+
* @param url 文件URL
|
|
416986
|
+
* @returns 文件名,如果无法提取则返回空字符串
|
|
416987
|
+
*/ const extractFileNameFromUrl = (url)=>{
|
|
416988
|
+
if (!url) {
|
|
416989
|
+
return '';
|
|
416990
|
+
}
|
|
416991
|
+
try {
|
|
416992
|
+
const urlObj = new URL(url);
|
|
416993
|
+
const { pathname } = urlObj;
|
|
416994
|
+
let fileName = pathname.split('/').pop() || '';
|
|
416995
|
+
// 移除查询参数和hash
|
|
416996
|
+
fileName = fileName.split('?')[0].split('#')[0] || '';
|
|
416997
|
+
// 解码URI编码的文件名
|
|
416998
|
+
try {
|
|
416999
|
+
return decodeURIComponent(fileName);
|
|
417000
|
+
} catch {
|
|
417001
|
+
// 如果解码失败,返回原始文件名
|
|
417002
|
+
return fileName;
|
|
417003
|
+
}
|
|
417004
|
+
} catch {
|
|
417005
|
+
// 如果不是有效的URL,尝试直接解析路径
|
|
417006
|
+
const parts = url.split('/');
|
|
417007
|
+
let fileName = parts[parts.length - 1] || '';
|
|
417008
|
+
fileName = fileName.split('?')[0].split('#')[0] || '';
|
|
417009
|
+
// 解码URI编码的文件名
|
|
417010
|
+
try {
|
|
417011
|
+
return decodeURIComponent(fileName);
|
|
417012
|
+
} catch {
|
|
417013
|
+
// 如果解码失败,返回原始文件名
|
|
417014
|
+
return fileName;
|
|
417015
|
+
}
|
|
417016
|
+
}
|
|
417017
|
+
};
|
|
416274
417018
|
// 消息转换成 Coze的消息,主要用于消息接收后,在页面显示。
|
|
416275
417019
|
class MessageConverseToCoze {
|
|
416276
417020
|
convertMessageListResponse(res) {
|
|
@@ -416421,22 +417165,25 @@ class MessageConverseToCoze {
|
|
|
416421
417165
|
}
|
|
416422
417166
|
case 'file':
|
|
416423
417167
|
{
|
|
416424
|
-
const
|
|
416425
|
-
getFileInfo(new File([],
|
|
416426
|
-
|
|
417168
|
+
const fileName = (item === null || item === void 0 ? void 0 : item.name) || extractFileNameFromUrl(item === null || item === void 0 ? void 0 : item.file_url);
|
|
417169
|
+
const { fileType = const_FileTypeEnum.DEFAULT_UNKNOWN } = getFileInfo(new File([], fileName)) || {};
|
|
417170
|
+
console.log('convertMixContent file', item);
|
|
417171
|
+
// 当没有 file_id 时,使用 file_url 作为 file_key
|
|
417172
|
+
const fileKey = item.file_id || item.file_url || '';
|
|
417173
|
+
const fileData = {
|
|
416427
417174
|
type: types_ContentType.File,
|
|
416428
417175
|
file: {
|
|
416429
|
-
file_key:
|
|
416430
|
-
|
|
416431
|
-
|
|
416432
|
-
// @ts-expect-error -- linter-disable-autofix, 新添加参数,sdk中还未支持到
|
|
416433
|
-
file_size: item === null || item === void 0 ? void 0 : item.size,
|
|
417176
|
+
file_key: fileKey,
|
|
417177
|
+
file_name: fileName || '未知文件',
|
|
417178
|
+
file_size: (item === null || item === void 0 ? void 0 : item.size) ?? 0,
|
|
416434
417179
|
file_type: fileType,
|
|
416435
|
-
file_url: item === null || item === void 0 ? void 0 : item.file_url
|
|
417180
|
+
file_url: (item === null || item === void 0 ? void 0 : item.file_url) || ''
|
|
416436
417181
|
},
|
|
416437
417182
|
// @ts-expect-error -- linter-disable-autofix
|
|
416438
417183
|
is_refer: item.is_refer || undefined
|
|
416439
417184
|
};
|
|
417185
|
+
console.log('convertMixContent file result', fileData);
|
|
417186
|
+
return fileData;
|
|
416440
417187
|
}
|
|
416441
417188
|
case 'json':
|
|
416442
417189
|
{
|
|
@@ -416485,7 +417232,7 @@ const messageConverterToCoze = new MessageConverseToCoze();
|
|
|
416485
417232
|
|
|
416486
417233
|
const useMessageList = ()=>{
|
|
416487
417234
|
const getMessageListByPairs = useGetMessageListByPairs();
|
|
416488
|
-
const { chatConfig } =
|
|
417235
|
+
const { chatConfig } = context_useChatAppProps();
|
|
416489
417236
|
const { bot_id: botId } = chatConfig || {};
|
|
416490
417237
|
const { refMessageListLeft } = useChatCozeSdk();
|
|
416491
417238
|
return (0,react.useMemo)(()=>{
|
|
@@ -416716,14 +417463,14 @@ const getCustomInitInfo = async (param)=>{
|
|
|
416716
417463
|
};
|
|
416717
417464
|
const useRequestInit = ()=>{
|
|
416718
417465
|
var _chatConfig_auth;
|
|
416719
|
-
const { chatConfig, openRequestInit, defaultHistoryMessage = [], onDefaultHistoryClear } =
|
|
417466
|
+
const { chatConfig, openRequestInit, defaultHistoryMessage = [], onDefaultHistoryClear } = context_useChatAppProps();
|
|
416720
417467
|
const { cozeApiSdk } = useChatCozeSdk();
|
|
416721
|
-
const setInitError =
|
|
416722
|
-
const setDefaultInputMode =
|
|
416723
|
-
const updateShortcuts =
|
|
416724
|
-
const setIsStartBotVoiceCall =
|
|
416725
|
-
const updateBackgroundInfo =
|
|
416726
|
-
const { currentConversationInfo, updateCurrentConversationInfo, conversations } =
|
|
417468
|
+
const setInitError = context_useChatAppStore((s)=>s.setInitError);
|
|
417469
|
+
const setDefaultInputMode = context_useChatAppStore((s)=>s.setDefaultInputMode);
|
|
417470
|
+
const updateShortcuts = context_useChatAppStore((s)=>s.updateShortcuts);
|
|
417471
|
+
const setIsStartBotVoiceCall = context_useChatAppStore((s)=>s.setIsStartBotVoiceCall);
|
|
417472
|
+
const updateBackgroundInfo = context_useChatAppStore((s)=>s.updateBackgroundInfo);
|
|
417473
|
+
const { currentConversationInfo, updateCurrentConversationInfo, conversations } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
416727
417474
|
currentConversationInfo: s.currentConversationInfo,
|
|
416728
417475
|
updateCurrentConversationInfo: s.updateCurrentConversationInfo,
|
|
416729
417476
|
conversations: s.conversations
|
|
@@ -416911,7 +417658,7 @@ const useRequestInit = ()=>{
|
|
|
416911
417658
|
|
|
416912
417659
|
|
|
416913
417660
|
const useClearMessageContextAdapter = ()=>{
|
|
416914
|
-
const { chatConfig: { type: chatType } } =
|
|
417661
|
+
const { chatConfig: { type: chatType } } = context_useChatAppProps();
|
|
416915
417662
|
return (0,react.useMemo)(()=>{
|
|
416916
417663
|
const isAppType = chatType === client_ChatType.APP;
|
|
416917
417664
|
const baseUrl = isAppType ? '/v1/workflow/conversations/:conversation_id/clear' : '/v1/conversations/:conversation_id/clear';
|
|
@@ -416953,6 +417700,35 @@ const useClearMessageContextAdapter = ()=>{
|
|
|
416953
417700
|
]);
|
|
416954
417701
|
};
|
|
416955
417702
|
|
|
417703
|
+
;// CONCATENATED MODULE: ../open-chat/src/chat/builder-chat/helper/get-connector-id.ts
|
|
417704
|
+
/*
|
|
417705
|
+
* Copyright 2025 coze-dev Authors
|
|
417706
|
+
*
|
|
417707
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
417708
|
+
* you may not use this file except in compliance with the License.
|
|
417709
|
+
* You may obtain a copy of the License at
|
|
417710
|
+
*
|
|
417711
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
417712
|
+
*
|
|
417713
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
417714
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
417715
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
417716
|
+
* See the License for the specific language governing permissions and
|
|
417717
|
+
* limitations under the License.
|
|
417718
|
+
*/
|
|
417719
|
+
const getConnectorId = (props)=>{
|
|
417720
|
+
const { project } = props;
|
|
417721
|
+
const { mode, connectorId } = project || {};
|
|
417722
|
+
if (!connectorId) {
|
|
417723
|
+
if (mode === 'websdk') {
|
|
417724
|
+
return webSdkDefaultConnectorId;
|
|
417725
|
+
} else if (mode === 'draft') {
|
|
417726
|
+
return chatflowDraftConnectorId;
|
|
417727
|
+
}
|
|
417728
|
+
}
|
|
417729
|
+
return connectorId;
|
|
417730
|
+
};
|
|
417731
|
+
|
|
416956
417732
|
;// CONCATENATED MODULE: ../open-chat/src/chat/builder-chat/services/create-conversation.ts
|
|
416957
417733
|
/*
|
|
416958
417734
|
* Copyright 2025 coze-dev Authors
|
|
@@ -416970,6 +417746,7 @@ const useClearMessageContextAdapter = ()=>{
|
|
|
416970
417746
|
* limitations under the License.
|
|
416971
417747
|
*/
|
|
416972
417748
|
|
|
417749
|
+
|
|
416973
417750
|
// 用于发送消息时创建 conversation 的函数
|
|
416974
417751
|
const createConversationForMessage = async (apiSdk, props)=>{
|
|
416975
417752
|
let conversationId = '';
|
|
@@ -417090,13 +417867,87 @@ const createConversationForMessage = async (apiSdk, props)=>{
|
|
|
417090
417867
|
throw new Error(`Failed to create conversation: ${JSON.stringify(error)}`);
|
|
417091
417868
|
}
|
|
417092
417869
|
};
|
|
417093
|
-
const createOrGetConversation = (apiSdk, props)
|
|
417870
|
+
const createOrGetConversation = async (apiSdk, props)=>{
|
|
417871
|
+
// 如果没有 conversationName,保持现有行为:不创建会话,返回空值
|
|
417094
417872
|
// conversation 将在用户发送第一条消息时创建
|
|
417095
|
-
|
|
417873
|
+
if (!props.project.conversationName || props.project.conversationName.trim() === '') {
|
|
417874
|
+
return {
|
|
417875
|
+
conversationId: '',
|
|
417876
|
+
sectionId: '',
|
|
417877
|
+
conversationName: undefined
|
|
417878
|
+
};
|
|
417879
|
+
}
|
|
417880
|
+
// 如果有 conversationName,在初始化时就创建/获取会话
|
|
417881
|
+
if (props.project.type === 'app') {
|
|
417882
|
+
try {
|
|
417883
|
+
const connectorId = getConnectorId(props);
|
|
417884
|
+
const createPayload = {
|
|
417885
|
+
app_id: props.project.id,
|
|
417886
|
+
draft_mode: props.project.mode === 'draft',
|
|
417887
|
+
workflow_id: props.workflow.id || '',
|
|
417888
|
+
connector_id: connectorId,
|
|
417889
|
+
get_or_create: true,
|
|
417890
|
+
conversation_name: props.project.conversationName
|
|
417891
|
+
};
|
|
417892
|
+
const res = await (apiSdk === null || apiSdk === void 0 ? void 0 : apiSdk.post('/v1/workflow/conversation/create', createPayload, false, {
|
|
417893
|
+
headers: {
|
|
417894
|
+
'Accept-Language': intl.language === 'zh-CN' ? 'zh' : 'en'
|
|
417895
|
+
}
|
|
417896
|
+
}));
|
|
417897
|
+
if ((res === null || res === void 0 ? void 0 : res.code) === 0 && (res === null || res === void 0 ? void 0 : res.data)) {
|
|
417898
|
+
const conversationId = res.data.id || '';
|
|
417899
|
+
const sectionId = res.data.last_section_id || '';
|
|
417900
|
+
// 确保 conversationId 不为空
|
|
417901
|
+
if (!conversationId || conversationId.trim() === '') {
|
|
417902
|
+
throw new Error('Failed to create conversation: empty conversationId returned');
|
|
417903
|
+
}
|
|
417904
|
+
// 获取会话详情以获取 conversation_name
|
|
417905
|
+
let conversationName = undefined;
|
|
417906
|
+
if (conversationId) {
|
|
417907
|
+
try {
|
|
417908
|
+
const detailRes = await (apiSdk === null || apiSdk === void 0 ? void 0 : apiSdk.get(`/v1/workflow/conversations/${conversationId}`, {
|
|
417909
|
+
app_id: props.project.id,
|
|
417910
|
+
workflow_id: props.workflow.id || '',
|
|
417911
|
+
connector_id: connectorId
|
|
417912
|
+
}));
|
|
417913
|
+
if ((detailRes === null || detailRes === void 0 ? void 0 : detailRes.code) === 0 && (detailRes === null || detailRes === void 0 ? void 0 : detailRes.data)) {
|
|
417914
|
+
const name = detailRes.data.conversation_name || detailRes.data.name || detailRes.data.title;
|
|
417915
|
+
conversationName = name || undefined;
|
|
417916
|
+
}
|
|
417917
|
+
} catch (detailError) {
|
|
417918
|
+
console.warn('Failed to fetch conversation detail:', detailError);
|
|
417919
|
+
conversationName = props.project.conversationName;
|
|
417920
|
+
}
|
|
417921
|
+
}
|
|
417922
|
+
return {
|
|
417923
|
+
conversationId,
|
|
417924
|
+
sectionId,
|
|
417925
|
+
conversationName: conversationName || props.project.conversationName
|
|
417926
|
+
};
|
|
417927
|
+
} else {
|
|
417928
|
+
const errorMsg = (res === null || res === void 0 ? void 0 : res.msg) || `code=${(res === null || res === void 0 ? void 0 : res.code) ?? 'unknown'}`;
|
|
417929
|
+
throw new Error(`Failed to create conversation: ${errorMsg}`);
|
|
417930
|
+
}
|
|
417931
|
+
} catch (error) {
|
|
417932
|
+
console.error('createOrGetConversation error:', error);
|
|
417933
|
+
// 如果创建失败,返回空值,让系统在发送消息时再创建
|
|
417934
|
+
if (error instanceof Error) {
|
|
417935
|
+
console.warn('Failed to create conversation during init, will create on first message:', error.message);
|
|
417936
|
+
}
|
|
417937
|
+
return {
|
|
417938
|
+
conversationId: '',
|
|
417939
|
+
sectionId: '',
|
|
417940
|
+
conversationName: undefined
|
|
417941
|
+
};
|
|
417942
|
+
}
|
|
417943
|
+
}
|
|
417944
|
+
// Bot 模式:保持现有行为,不在这里创建会话
|
|
417945
|
+
return {
|
|
417096
417946
|
conversationId: '',
|
|
417097
417947
|
sectionId: '',
|
|
417098
417948
|
conversationName: undefined
|
|
417099
|
-
}
|
|
417949
|
+
};
|
|
417950
|
+
};
|
|
417100
417951
|
|
|
417101
417952
|
;// CONCATENATED MODULE: ../open-chat/src/components/studio-open-chat/provider/coz-sdk/api-adapter/message/message-convert-to-sdk.ts
|
|
417102
417953
|
/*
|
|
@@ -417208,10 +418059,12 @@ class MessageConverterToSdk {
|
|
|
417208
418059
|
case types_ContentType.Image:
|
|
417209
418060
|
{
|
|
417210
418061
|
var _item_image_image_ori;
|
|
418062
|
+
// Use id (backend file ID) if available, fallback to key (URI) for backward compatibility
|
|
418063
|
+
const fileId = item.image.id || item.image.key;
|
|
417211
418064
|
return {
|
|
417212
418065
|
type: 'image',
|
|
417213
|
-
file_id:
|
|
417214
|
-
file_url: isNeedFileUrl || !
|
|
418066
|
+
file_id: fileId,
|
|
418067
|
+
file_url: isNeedFileUrl || !fileId ? (_item_image_image_ori = item.image.image_ori) === null || _item_image_image_ori === void 0 ? void 0 : _item_image_image_ori.url : undefined,
|
|
417215
418068
|
// @ts-expect-error -- linter-disable-autofix
|
|
417216
418069
|
is_refer: item.is_refer || undefined
|
|
417217
418070
|
};
|
|
@@ -417219,9 +418072,11 @@ class MessageConverterToSdk {
|
|
|
417219
418072
|
case types_ContentType.File:
|
|
417220
418073
|
{
|
|
417221
418074
|
var _item_file;
|
|
418075
|
+
// Use file_id (backend file ID) if available, fallback to file_key (URI) for backward compatibility
|
|
418076
|
+
const fileId = item.file.file_id || item.file.file_key;
|
|
417222
418077
|
return {
|
|
417223
418078
|
type: 'file',
|
|
417224
|
-
file_id:
|
|
418079
|
+
file_id: fileId,
|
|
417225
418080
|
file_url: isNeedFileUrl ? (_item_file = item.file) === null || _item_file === void 0 ? void 0 : _item_file.file_url : undefined,
|
|
417226
418081
|
// @ts-expect-error -- linter-disable-autofix
|
|
417227
418082
|
is_refer: item.is_refer || undefined
|
|
@@ -419238,8 +420093,8 @@ class MessageParser {
|
|
|
419238
420093
|
|
|
419239
420094
|
/* eslint-disable @coze-arch/max-line-per-function -- This adapter function handles complex message sending logic */ const useSendMessageAdapter = (userInfo, refChatFunc)=>{
|
|
419240
420095
|
var _chatConfig_auth;
|
|
419241
|
-
const { debug, chatConfig } =
|
|
419242
|
-
const { shortcuts, apiUrl, updateConversations, updateCurrentConversationInfo, currentConversationInfo, conversations, cozeApi } =
|
|
420096
|
+
const { debug, chatConfig } = context_useChatAppProps();
|
|
420097
|
+
const { shortcuts, apiUrl, updateConversations, updateCurrentConversationInfo, currentConversationInfo, conversations, cozeApi } = context_useChatAppStore(shallow_useShallow((state)=>({
|
|
419243
420098
|
shortcuts: state.shortcuts,
|
|
419244
420099
|
apiUrl: state.apiUrl,
|
|
419245
420100
|
updateConversations: state.updateConversations,
|
|
@@ -419616,7 +420471,7 @@ class MessageParser {
|
|
|
419616
420471
|
const useClearHistoryAdapter = (param)=>{
|
|
419617
420472
|
let { refChatFunc } = param;
|
|
419618
420473
|
var _chatConfig_auth;
|
|
419619
|
-
const { chatConfig } =
|
|
420474
|
+
const { chatConfig } = context_useChatAppProps();
|
|
419620
420475
|
const refConnectorId = (0,react.useRef)('');
|
|
419621
420476
|
refConnectorId.current = (chatConfig === null || chatConfig === void 0 ? void 0 : (_chatConfig_auth = chatConfig.auth) === null || _chatConfig_auth === void 0 ? void 0 : _chatConfig_auth.connectorId) || '';
|
|
419622
420477
|
return (0,react.useMemo)(()=>{
|
|
@@ -419680,7 +420535,7 @@ const useClearHistoryAdapter = (param)=>{
|
|
|
419680
420535
|
|
|
419681
420536
|
|
|
419682
420537
|
const useCommonOnBeforeRequestHooks = ()=>{
|
|
419683
|
-
const { debug } =
|
|
420538
|
+
const { debug } = context_useChatAppProps();
|
|
419684
420539
|
return [
|
|
419685
420540
|
// 去除无用的头部
|
|
419686
420541
|
(requestConfig)=>{
|
|
@@ -419805,7 +420660,7 @@ const useCoreManager = (param)=>{
|
|
|
419805
420660
|
const userInfo = useUserInfo();
|
|
419806
420661
|
const { refreshToken } = useChatCozeSdk();
|
|
419807
420662
|
// 获取 apiUrl
|
|
419808
|
-
const { apiUrl } =
|
|
420663
|
+
const { apiUrl } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
419809
420664
|
apiUrl: s.apiUrl
|
|
419810
420665
|
})));
|
|
419811
420666
|
const clearMessageContextAdapter = useClearMessageContextAdapter();
|
|
@@ -419817,7 +420672,7 @@ const useCoreManager = (param)=>{
|
|
|
419817
420672
|
const commonOnAfterResponseHooks = useCommonOnAfterResponseHooks(refreshToken);
|
|
419818
420673
|
const commonErrorResponseHooks = useCommonErrorResponseHooks(refreshToken);
|
|
419819
420674
|
const messageListAdapter = useMessageList();
|
|
419820
|
-
const { requestManagerOptions } =
|
|
420675
|
+
const { requestManagerOptions } = context_useChatAppProps();
|
|
419821
420676
|
const breakMessageAdapter = useBreakMessage();
|
|
419822
420677
|
// 计算最终的 baseURL
|
|
419823
420678
|
const finalBaseURL = apiUrl || openApiHostByRegionWithToken;
|
|
@@ -419871,7 +420726,7 @@ const useCoreManager = (param)=>{
|
|
|
419871
420726
|
|
|
419872
420727
|
const useCoreOverrideConfig = (param)=>{
|
|
419873
420728
|
let { refChatFunc } = param;
|
|
419874
|
-
const { chatConfig } =
|
|
420729
|
+
const { chatConfig } = context_useChatAppProps();
|
|
419875
420730
|
const { tokenManager } = useChatCozeSdk();
|
|
419876
420731
|
const requestManagerOptions = useCoreManager({
|
|
419877
420732
|
refChatFunc
|
|
@@ -420025,10 +420880,10 @@ const services_life_cycle_bizLifeCycleServiceGenerator = (plugin)=>({
|
|
|
420025
420880
|
|
|
420026
420881
|
const useMessageGroupFooterInfo = (messageGroup)=>{
|
|
420027
420882
|
var _messageInfo_extra_info;
|
|
420028
|
-
const feedbackInfo =
|
|
420883
|
+
const feedbackInfo = context_useChatAppStore((s)=>s.feedbackInfo);
|
|
420029
420884
|
const { useMessagesStore } = use_chat_area_context_useChatAreaStoreSet();
|
|
420030
420885
|
const { findMessage } = useMessagesStore.getState();
|
|
420031
|
-
const lastGroupFeedbackInfo =
|
|
420886
|
+
const lastGroupFeedbackInfo = context_useChatAppStore((s)=>s.lastGroupFeedbackInfo);
|
|
420032
420887
|
const { messageId } = lastGroupFeedbackInfo;
|
|
420033
420888
|
const messageInfo = findMessage(messageId || '');
|
|
420034
420889
|
// @ts-expect-error -- linter-disable-autofix, 新添加参数,接口未支持
|
|
@@ -421705,7 +422560,7 @@ const BotTriggerConfigButtonGroup = (param)=>{
|
|
|
421705
422560
|
const useCurMessageInfo = ()=>{
|
|
421706
422561
|
var _chatConfig_ui_chatBot, _chatConfig_ui;
|
|
421707
422562
|
const { message } = message_box_useMessageBoxContext();
|
|
421708
|
-
const { chatConfig } =
|
|
422563
|
+
const { chatConfig } = context_useChatAppProps();
|
|
421709
422564
|
// @ts-expect-error -- linter-disable-autofix, 新添加参数,接口未支持
|
|
421710
422565
|
const cozeApiMessageId = message.extra_info.coze_api_message_id;
|
|
421711
422566
|
// @ts-expect-error -- linter-disable-autofix, 新添加参数,接口未支持
|
|
@@ -421812,7 +422667,7 @@ const delete_message_DeleteMessage = (param)=>{
|
|
|
421812
422667
|
const { useGlobalInitStore } = storeSet;
|
|
421813
422668
|
const { groupId } = message_box_useMessageBoxContext();
|
|
421814
422669
|
const isDeleteMessageLock = use_is_delete_message_lock_useIsDeleteMessageLock(groupId);
|
|
421815
|
-
const { chatConfig } =
|
|
422670
|
+
const { chatConfig } = context_useChatAppProps();
|
|
421816
422671
|
const deleteMessage = useDeleteMessage();
|
|
421817
422672
|
const conversationId = useGlobalInitStore((state)=>state.conversationId);
|
|
421818
422673
|
const { messageId, cozeApiMessageId, isShowDelete } = useCurMessageInfo();
|
|
@@ -421913,7 +422768,7 @@ const useMessageHoverInfo = ()=>{
|
|
|
421913
422768
|
const UIKitMessageBoxHoverSlot = ()=>{
|
|
421914
422769
|
const { meta } = message_box_useMessageBoxContext();
|
|
421915
422770
|
const { message } = message_box_useMessageBoxContext();
|
|
421916
|
-
const { readonly } =
|
|
422771
|
+
const { readonly } = context_useChatAppProps();
|
|
421917
422772
|
const isLastGroupMessage = meta.isGroupLastMessage && meta.isFromLatestGroup && (message === null || message === void 0 ? void 0 : message.type) === 'answer';
|
|
421918
422773
|
if (isLastGroupMessage || readonly) {
|
|
421919
422774
|
/*
|
|
@@ -422091,7 +422946,7 @@ const UIKitMessageBoxFooter = (param)=>{
|
|
|
422091
422946
|
const { meta } = message_box_useMessageBoxContext();
|
|
422092
422947
|
const { message } = message_box_useMessageBoxContext();
|
|
422093
422948
|
const { useWaitingStore } = use_chat_area_context_useChatAreaStoreSet();
|
|
422094
|
-
const { readonly } =
|
|
422949
|
+
const { readonly } = context_useChatAppProps();
|
|
422095
422950
|
const waiting = useWaitingStore((state)=>!!state.waiting);
|
|
422096
422951
|
const isAnswerMessage = message.type === 'answer';
|
|
422097
422952
|
const isLastGroupMessage = meta.isGroupLastMessage && meta.isFromLatestGroup;
|
|
@@ -422582,8 +423437,8 @@ const createChatBackgroundPlugin = ()=>{
|
|
|
422582
423437
|
|
|
422583
423438
|
const useBgBackgroundPlugin = ()=>{
|
|
422584
423439
|
const { ChatBackgroundPlugin, chatBackgroundEvent } = (0,react.useMemo)(()=>createChatBackgroundPlugin(), []);
|
|
422585
|
-
const { isCustomBackground } =
|
|
422586
|
-
const backgroundInfo =
|
|
423440
|
+
const { isCustomBackground } = context_useChatAppProps();
|
|
423441
|
+
const backgroundInfo = context_useChatAppStore((s)=>s.backgroundInfo);
|
|
422587
423442
|
const backgroundInfoToShow = isCustomBackground ? undefined : backgroundInfo;
|
|
422588
423443
|
(0,react.useEffect)(()=>{
|
|
422589
423444
|
// 监听用户设置背景图,将更新的背景图信息传入插件
|
|
@@ -422643,8 +423498,8 @@ const useBgBackgroundPlugin = ()=>{
|
|
|
422643
423498
|
const ChatProviderFuncComp = /*#__PURE__*/ (0,react.forwardRef)((param, ref)=>{
|
|
422644
423499
|
let { children } = param;
|
|
422645
423500
|
var _chatConfig_ui_conversations, _chatConfig_ui;
|
|
422646
|
-
const { chatConfig } =
|
|
422647
|
-
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, conversations } =
|
|
423501
|
+
const { chatConfig } = context_useChatAppProps();
|
|
423502
|
+
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, conversations } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
422648
423503
|
updateCurrentConversationInfo: s.updateCurrentConversationInfo,
|
|
422649
423504
|
currentConversationInfo: s.currentConversationInfo,
|
|
422650
423505
|
updateConversations: s.updateConversations,
|
|
@@ -422759,12 +423614,12 @@ const ChatProviderImpl = (param)=>{
|
|
|
422759
423614
|
var _chatConfig_ui, _chatConfig_appInfo, _chatConfig_ui_chatBot, _chatConfig_ui1;
|
|
422760
423615
|
const refLastIsError = (0,react.useRef)(false);
|
|
422761
423616
|
const { refreshToken } = useChatCozeSdk();
|
|
422762
|
-
const { initError, setInitError } =
|
|
423617
|
+
const { initError, setInitError } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
422763
423618
|
initError: s.initError,
|
|
422764
423619
|
setInitError: s.setInitError
|
|
422765
423620
|
})));
|
|
422766
423621
|
const refChatFunc = (0,react.useRef)();
|
|
422767
|
-
const { chatConfig, onImageClick, initErrorFallbackFC: ErrorFallback } =
|
|
423622
|
+
const { chatConfig, onImageClick, initErrorFallbackFC: ErrorFallback } = context_useChatAppProps();
|
|
422768
423623
|
const userInfoRaw = useUserInfo();
|
|
422769
423624
|
// 确保 userInfo 始终有效,即使 useUserInfo 返回 null(虽然不应该)
|
|
422770
423625
|
const userInfo = userInfoRaw && userInfoRaw.id ? userInfoRaw : {
|
|
@@ -422933,8 +423788,8 @@ const ChatProvider = (param)=>{
|
|
|
422933
423788
|
const provider_ChatProvider = (param)=>{
|
|
422934
423789
|
let { children, plugins } = param;
|
|
422935
423790
|
var _chatConfig_extra;
|
|
422936
|
-
const { chatConfig, onImageClick, onThemeChange } =
|
|
422937
|
-
const setInitError =
|
|
423791
|
+
const { chatConfig, onImageClick, onThemeChange } = context_useChatAppProps();
|
|
423792
|
+
const setInitError = context_useChatAppStore((s)=>s.setInitError);
|
|
422938
423793
|
// plugin初始化
|
|
422939
423794
|
const commonChatPlugin = getChatCommonPlugin({
|
|
422940
423795
|
onImageClick,
|
|
@@ -434413,7 +435268,7 @@ const shortcut_bar_ShortcutBar = (param)=>{
|
|
|
434413
435268
|
var _shortcuts_at;
|
|
434414
435269
|
const activeShortcutRef = (0,react.useRef)(undefined);
|
|
434415
435270
|
const showBackground = useIsShowBackground();
|
|
434416
|
-
const shortcuts =
|
|
435271
|
+
const shortcuts = context_useChatAppStore((store)=>store.shortcuts);
|
|
434417
435272
|
const defaultId = (_shortcuts_at = shortcuts.at(0)) === null || _shortcuts_at === void 0 ? void 0 : _shortcuts_at.command_id;
|
|
434418
435273
|
if (!(shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.length)) {
|
|
434419
435274
|
return null;
|
|
@@ -434523,7 +435378,7 @@ const IconAddNewConversation = (param)=>{
|
|
|
434523
435378
|
|
|
434524
435379
|
const useChatOpInfo = ()=>{
|
|
434525
435380
|
var _chatConfig_ui_header, _chatConfig_ui;
|
|
434526
|
-
const { chatConfig } =
|
|
435381
|
+
const { chatConfig } = context_useChatAppProps();
|
|
434527
435382
|
const chatInputLeftOps = [];
|
|
434528
435383
|
const headerTopLeftOps = [];
|
|
434529
435384
|
console.log('useChatOpInfo:', chatConfig);
|
|
@@ -434565,7 +435420,7 @@ const useChatOpInfo = ()=>{
|
|
|
434565
435420
|
};
|
|
434566
435421
|
const useChatChatButtonInfo = (opList)=>{
|
|
434567
435422
|
const { isClearHistoryButtonDisabled, isClearContextButtonDisabled } = useBuiltinButtonStatus({});
|
|
434568
|
-
const { readonly } =
|
|
435423
|
+
const { readonly } = context_useChatAppProps();
|
|
434569
435424
|
const { clearHistory } = useChatAreaController();
|
|
434570
435425
|
const clearContext = useClearContext();
|
|
434571
435426
|
const buttonList = (0,react.useMemo)(()=>opList.map((item)=>{
|
|
@@ -434678,7 +435533,7 @@ const MoreBtn = (param)=>{
|
|
|
434678
435533
|
let { buttonList } = param;
|
|
434679
435534
|
const showBackground = useIsShowBackground();
|
|
434680
435535
|
const [visible, setVisible] = (0,react.useState)(false);
|
|
434681
|
-
const { readonly } =
|
|
435536
|
+
const { readonly } = context_useChatAppProps();
|
|
434682
435537
|
(0,react.useEffect)(()=>{
|
|
434683
435538
|
document.addEventListener('click', ()=>{
|
|
434684
435539
|
setVisible(false);
|
|
@@ -434728,7 +435583,7 @@ const ChatInputLeftSlot = ()=>{
|
|
|
434728
435583
|
var _chatConfig_ui_base, _chatConfig_ui;
|
|
434729
435584
|
const { chatInputLeftOps } = useChatOpInfo();
|
|
434730
435585
|
const showBackground = useIsShowBackground();
|
|
434731
|
-
const { chatConfig } =
|
|
435586
|
+
const { chatConfig } = context_useChatAppProps();
|
|
434732
435587
|
const isMobile = ((_chatConfig_ui = chatConfig.ui) === null || _chatConfig_ui === void 0 ? void 0 : (_chatConfig_ui_base = _chatConfig_ui.base) === null || _chatConfig_ui_base === void 0 ? void 0 : _chatConfig_ui_base.layout) === client_Layout.MOBILE;
|
|
434733
435588
|
const buttonClass = showBackground ? '!coz-fg-images-white' : '';
|
|
434734
435589
|
const buttonList = useChatChatButtonInfo(chatInputLeftOps);
|
|
@@ -434824,10 +435679,10 @@ const StudioChatArea = (param)=>{
|
|
|
434824
435679
|
let { coreAreaClassName, className, showInputArea = true, inputPlaceholder, inputNativeCallbacks, messageGroupListClassName, renderChatInputTopSlot, renderChatInputRightActions, isShowClearContextDivider, headerNode, messageMaxWidth, isMiniScreen, enableMultimodalUpload = false, uiKitCustomComponents, contentBox, getMessageRenderIndex, inputMode, onboardingPrologue, showOnboardingBotInfo, showOnboardingSuggestions } = param;
|
|
434825
435680
|
var _chatConfig_ui_chatBot, _chatConfig_ui, _chatConfig_ui_chatBot1, _chatConfig_ui1, _chatConfig_ui_footer, _chatConfig_ui2;
|
|
434826
435681
|
const initStatus = useInitStatus();
|
|
434827
|
-
const { layout, onInitStateChange, chatConfig } =
|
|
435682
|
+
const { layout, onInitStateChange, chatConfig } = context_useChatAppProps();
|
|
434828
435683
|
const refContainer = (0,react.useRef)(null);
|
|
434829
|
-
const { readonly } =
|
|
434830
|
-
const currentConversationInfo =
|
|
435684
|
+
const { readonly } = context_useChatAppProps();
|
|
435685
|
+
const currentConversationInfo = context_useChatAppStore((state)=>state.currentConversationInfo);
|
|
434831
435686
|
// 空会话的判断:id 为空字符串
|
|
434832
435687
|
const isEmptyConversation = !currentConversationInfo || currentConversationInfo.id === '';
|
|
434833
435688
|
const InputRightActionsComponent = (0,react.useMemo)(()=>renderChatInputRightActions ? (()=>{
|
|
@@ -435038,13 +435893,13 @@ const ChatHeader = (param)=>{
|
|
|
435038
435893
|
let { iconUrl = coze_logo_namespaceObject, title = 'Coze Bot', extra, theme, isShowConversations, isNeedLogo = true } = param;
|
|
435039
435894
|
const { headerTopLeftOps } = useChatOpInfo();
|
|
435040
435895
|
const buttonList = useChatChatButtonInfo(headerTopLeftOps);
|
|
435041
|
-
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, cozeApi } =
|
|
435896
|
+
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, cozeApi } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
435042
435897
|
updateCurrentConversationInfo: s.updateCurrentConversationInfo,
|
|
435043
435898
|
currentConversationInfo: s.currentConversationInfo,
|
|
435044
435899
|
updateConversations: s.updateConversations,
|
|
435045
435900
|
cozeApi: s.cozeApi
|
|
435046
435901
|
})));
|
|
435047
|
-
const { chatConfig: { type: chatType } } =
|
|
435902
|
+
const { chatConfig: { type: chatType } } = context_useChatAppProps();
|
|
435048
435903
|
const [isRenameModalVisible, setIsRenameModalVisible] = (0,react.useState)(false);
|
|
435049
435904
|
const [renameInputValue, setRenameInputValue] = (0,react.useState)('');
|
|
435050
435905
|
const [isRenameLoading, setIsRenameLoading] = (0,react.useState)(false);
|
|
@@ -435290,13 +436145,13 @@ const ChatHeaderMobile = (param)=>{
|
|
|
435290
436145
|
let { iconUrl = coze_logo_namespaceObject, title = 'Coze Bot', extra, theme, isShowConversations, isNeedLogo = true } = param;
|
|
435291
436146
|
const { headerTopLeftOps } = useChatOpInfo();
|
|
435292
436147
|
const buttonList = useChatChatButtonInfo(headerTopLeftOps);
|
|
435293
|
-
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, cozeApi } =
|
|
436148
|
+
const { updateCurrentConversationInfo, currentConversationInfo, updateConversations, cozeApi } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
435294
436149
|
updateCurrentConversationInfo: s.updateCurrentConversationInfo,
|
|
435295
436150
|
currentConversationInfo: s.currentConversationInfo,
|
|
435296
436151
|
updateConversations: s.updateConversations,
|
|
435297
436152
|
cozeApi: s.cozeApi
|
|
435298
436153
|
})));
|
|
435299
|
-
const { chatConfig: { type: chatType } } =
|
|
436154
|
+
const { chatConfig: { type: chatType } } = context_useChatAppProps();
|
|
435300
436155
|
const [isRenameModalVisible, setIsRenameModalVisible] = (0,react.useState)(false);
|
|
435301
436156
|
const [renameInputValue, setRenameInputValue] = (0,react.useState)('');
|
|
435302
436157
|
const [isRenameLoading, setIsRenameLoading] = (0,react.useState)(false);
|
|
@@ -435524,7 +436379,7 @@ var header_index_module_update = injectStylesIntoStyleTag_default()(header_index
|
|
|
435524
436379
|
|
|
435525
436380
|
|
|
435526
436381
|
const FloatBtn = ()=>{
|
|
435527
|
-
const { updateCurrentConversationInfo, currentConversationInfo } =
|
|
436382
|
+
const { updateCurrentConversationInfo, currentConversationInfo } = context_useChatAppStore(shallow_useShallow((s)=>({
|
|
435528
436383
|
updateCurrentConversationInfo: s.updateCurrentConversationInfo,
|
|
435529
436384
|
currentConversationInfo: s.currentConversationInfo
|
|
435530
436385
|
})));
|
|
@@ -436271,35 +437126,6 @@ const getBuilderEventCallbackPlugin = (props)=>{
|
|
|
436271
437126
|
|
|
436272
437127
|
;// CONCATENATED MODULE: ../open-chat/src/assets/chatflow-logo.png
|
|
436273
437128
|
const chatflow_logo_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAwkSURBVHgB7d2xblRXGsDxwyrQGGkxhaHACmsatgEiUQSKYCRoSBHnCYAngDxBnCcIPAEgP0BIkTRBwk4RUiCF0EADSwQFuABWwg0p2PkGhiUBxL0zd+z57v39pNGwu83OzJ2/zzn33DubytLSiwKQwD8KQBKCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWk8VGBEe2emirbtmz5yyPce/as//z0+fNyb22t/wyjECwqixAdmJ7uP/b3HvM7d5Ztmze/DlQVN5486Yds5dGj/r+Xe89Q1aaytPSiwHtEjE7NzZUvZmf7oaoTp6oiWpfu3CnLq6uvR2XwLoLFW96M1PyOHWU9DeJ18e7dAn8nWLwWoTqzd28523uMYyRVR4y0YsT1zc2bRl28JlhMVKjeJUZbwkUQrI6LUC3u2zeRoXpTxOr87dvlXO9BdwlWRx3Yvr1c+PTT/nMmEa6jV64YbXWUjaMdFKOq306cSBersHvr1vKfhYXydW9USPcYYXVIfNkvHDq07mf+xiXOKJ6+ds1oq0OMsDoiYnX12LHWxCrEa4nXFK+NbhCsDogvdkwB2/jFjtfUn95OTxfaT7Ba7uTcXLl6/PjEnwUcRby23z7/vP9aaTfBarH4Al88fLh0RbxW0Wo3wWqpOAPYpVgNnDt40PSwxQSrhQYL7F0U08OYAluIbyfBaplBrNq8ZvUh/Wh1/D1oK8FqmW97UyKji//vOaNdBKtFYvf3wq5dhZcWZmf7F3TTHoLVEjGiWHS5ylsi4kac7SFYLfHdkSOFt8U6lqlhewhWC8TdQZ3Kf7/Y6X/K/qxWEKwWcOeCD4uTEc4a5idYyVmjqSZiZQE+P8FKLEJlqlPdmQm9BTTVCVZi8zMzRlc1GGXlJ1iJWbuq74xgpSZYScWmSKOr+mKU1aabGHaNYCUVP3LKcIyy8hKshAa/zMxwYoRl8T0nwUrIlGY0/Wlh74QF+QhWQqaDo/Me5iRYCRkdjM4oNSfBSibODDo7OLr++zg1VchFsJJxkXNzjLLyEaxkfMmaEz/UQS6ClczHpoONMSXMR7CS8SVrzn7T63QEKxnBao7No/kIVjK+ZM3xXuYjWInYztA8I9ZcBAtIQ7CANAQLSEOwgDQEi057+uefhTwEK5F7z54VmvX0+fNCHoKVzL21tUIz/AHIR7CSMSJojvjnI1jJ/P7kSaEZ/xX/dAQrmRuPHxeasfzoUSEXwUrmhhFWY7yX+QhWMr5kzfFe5iNYycSiuy/a6GJq7QRGPoKV0Iq1l5GtrK4W8hGshC7fv18YjfcwJ8FKKM5umc4MLzaMOkOYk2Aldf727cJwlk0H0xKspC4/eFAYzjc3bxZyEqyk4iyXaU198Z65hjAvwUrMSKG+87duFfISrMRitGCUVV2MrEylcxOs5IyyqvNe5SdYyRllVRPv0cW7dwu5CVYLGDl82Olr1wr5CVYLxOjBvqz3i6A7M9gOgtUSi76U7xTvyTkxbw3Baom4VMe0521Hr1xxGVOLCFaLxNTwq+vXCy+ZCraPYLVMTH8uORvWX9NbdDKidQSrhc72RlldvslfXLYkVu0kWC0UazZfrqx0cjoUr/nLn3+2btVSgtVS8cWNBecuRauLr7lrBKvFuvQFFqtuEKyWG3yR27ymFWtWn/z4o1h1gGB1QHyRP/nhh1buho/XFLGyZtUNgtUhcfawLfu0IlDxWs7ad9Ypm8rS0otCp+zeurVcPXas/5xRTAFP//pr/5luMcLqoJgi/uvy5XR3eYhRVfx/jimgWHWTEVbHxShrcd++cnJurkyyuOworpW0sN5tgkXf/I4d5eteuOJ5kkSoYlTlJoUEweIvDkxPl7P//veGjrhi6je4x5dQ8SbB4p1iqjg/M1PO9OIVEVsPEafv79/v38rYNgXeRbD4oEG8vpid7U8Zt23ZUpowGEmtvLrfukjxIYJFbTHiiojF8/7eIwIW/3nb5s1vxeze2trL595ieTz+6P3n+O+WHz58/b9BVYIFpGEfFpCGYAFpCBaQhmABaQgWkIZgAWkIFpDGR4XW6W/knJp6uZnz1b8HPn7j323wxxubT2MjamxOjR3z8W8759tHsJKLIMXlMkd6j9h5fuDVznNeXvoT97KPR1z+E89uT5Obne4JRaDiur6F3mN3y0ZM4xbRGlxk7U4Q+QhWEoNInZqbM4JqSIy2lldXy/lbtzr9S9mZCNYEizAt7NpVTu7ZM3E31mubCFaEK+4aweQSrAkUoTqzd28523sYTa2vGHXFHU6FazIJ1oSJUMU91oVqYwnXZBKsCRFTvguHDqX96a22inDF7x9efvCgsPFsHN1gMZK6cPhwuXr8uFhNoPhMvpuf739GPp+NZ4S1gWJU9d2RI6Z/SZgmbjwjrA3y7cGD/VGVWOURI6wYacXPobExjLDWWX+K8dln5cD27YW8YhvElysrds6vMyOsdRSRunrsmFi1QFwCFZ+lda31JVjrJNarHODtEp/lbydO2NS7jgRrHcSvKFuvaqf4TOOz3chfyu4SwRqzOJAv9hZqabf4jEVr/ARrjMSqW0Rr/ARrTGJh/dzBg4Vuic88FuQZD8Eag8HWBWtW3ROfeWwGdnJlPASrYf1FWGcDOy0++zgG/MFqnmA1LHawixVxDHxrSaBxgtWguDXMKYuuvBLHQtzTjOYIVkPiL+qia8z4m7ju0Ii7OYLVkLiXlTUL/q5/+6DesUEzBKsBMfR3eQbvE8eGqWEzBGtEMdx3uxE+5Gu3vW6EYI3IGgVVRKyMskYnWCOIUDkrSFVxFtkft9EI1ghMBakjRlmOmdEI1pCMrhiGX+4ejWANyV9KhmUta3iCNYT4Czk/M1NgGGf8ovfQBGsIC7t2WTxlaBErywnDEawhnNyzp8AovpidLdQnWDXFyMqudkYVx9DuqalCPYJVU0wHoQkLRlm1CVZNhvI0xbFUn2DVYDpIk+JYcrawHsGqwY8L0DTbY+oRrBqMrmja/M6dheoEq4YjgkXDjhhh1SJYNZgS0jQbkOsRrIrih1GhabHobj9WdYJVkYOKcbE2Wp1gVWQ6yLjY2lCdYFVkrYFx2e+PYWWCVdHHpoSMybQRVmWCBRvsn4JVmWBVZErIuDihU51gAWkIFpCGYAFpCBaQhmABaQgWkIZgAWkIFpCGYAFpCBaQhmABaQgWkIZgVfT0+fMC43Bvba1QjWBV9PuTJwXGQbCqE6yKbjx+XGAcVh4+LFQjWBVdfvCgwDgsr64WqhGsiu49e1aWHz0q0KQ4puLYohrBquHSnTsFmuSYqkewarh4966/hjQmjqU4pqhOsGo6fe1agSY4luoTrJpizeH87dsFRvHNzZvWRIcgWEM4e/16uWFfFkOKLTKLvWBRn2AN6ehPP4kWtUWsjl65UhiOYA0pLtWJaF2yaEpFcaxErFzmNTzBGkEceKd++aV81ZsiOnvI+8RxEsdIHCtiNZpNZWnpRWFk8cvQi/v2lZNzcwVCxClO0JzrPYSqGYLVsAjX/MxMOblnTzkwPV22bdlS6I4IU6xtfn//fn+PlVA1S7DGbBCtwYN2iiWB/sOdF8bqo8JYOZMIzbHoDqQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGv8DJbWhlGwbFtYAAAAASUVORK5CYII=";
|
|
436274
|
-
;// CONCATENATED MODULE: ../open-chat/src/chat/builder-chat/helper/get-connector-id.ts
|
|
436275
|
-
/*
|
|
436276
|
-
* Copyright 2025 coze-dev Authors
|
|
436277
|
-
*
|
|
436278
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
436279
|
-
* you may not use this file except in compliance with the License.
|
|
436280
|
-
* You may obtain a copy of the License at
|
|
436281
|
-
*
|
|
436282
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
436283
|
-
*
|
|
436284
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
436285
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
436286
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
436287
|
-
* See the License for the specific language governing permissions and
|
|
436288
|
-
* limitations under the License.
|
|
436289
|
-
*/
|
|
436290
|
-
const getConnectorId = (props)=>{
|
|
436291
|
-
const { project } = props;
|
|
436292
|
-
const { mode, connectorId } = project || {};
|
|
436293
|
-
if (!connectorId) {
|
|
436294
|
-
if (mode === 'websdk') {
|
|
436295
|
-
return webSdkDefaultConnectorId;
|
|
436296
|
-
} else if (mode === 'draft') {
|
|
436297
|
-
return chatflowDraftConnectorId;
|
|
436298
|
-
}
|
|
436299
|
-
}
|
|
436300
|
-
return connectorId;
|
|
436301
|
-
};
|
|
436302
|
-
|
|
436303
437129
|
;// CONCATENATED MODULE: ../open-chat/src/chat/builder-chat/services/get-bot-info.ts
|
|
436304
437130
|
/*
|
|
436305
437131
|
* Copyright 2025 coze-dev Authors
|