isdata-customer-sdk 0.1.74 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +15 -29
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +15 -29
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -29562,7 +29562,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29562
29562
|
// EXPORTS
|
|
29563
29563
|
__webpack_require__.d(__webpack_exports__, {
|
|
29564
29564
|
ChatClientMgr: function() { return /* reexport */ ChatClientMgr; },
|
|
29565
|
-
addAndCleanDocument: function() { return /* reexport */ addAndCleanDocument; },
|
|
29566
29565
|
addEventAction: function() { return /* reexport */ addEventAction; },
|
|
29567
29566
|
addIMMapping: function() { return /* reexport */ addIMMapping; },
|
|
29568
29567
|
addObjectUsedTimes: function() { return /* reexport */ addObjectUsedTimes; },
|
|
@@ -29621,6 +29620,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29621
29620
|
removeEventAction: function() { return /* reexport */ removeEventAction; },
|
|
29622
29621
|
removeEventListener: function() { return /* reexport */ removeEventListener; },
|
|
29623
29622
|
removeWindowTrustedOrigin: function() { return /* reexport */ removeWindowTrustedOrigin; },
|
|
29623
|
+
sendPostToAIAgent: function() { return /* reexport */ sendPostToAIAgent; },
|
|
29624
29624
|
sendWindowMessage: function() { return /* reexport */ sendWindowMessage; },
|
|
29625
29625
|
setPortalPageConfig: function() { return /* reexport */ setPortalPageConfig; },
|
|
29626
29626
|
switchPortalLogin: function() { return /* reexport */ switchPortalLogin; },
|
|
@@ -31029,7 +31029,6 @@ class ChatClientMgr {
|
|
|
31029
31029
|
this.customParams = params.customParams || {};
|
|
31030
31030
|
this.chartOrigin = params.chartOrigin;
|
|
31031
31031
|
console.log("ChatClientMgr init:", this.actionKey);
|
|
31032
|
-
// this.charAIs = {};
|
|
31033
31032
|
}
|
|
31034
31033
|
makeKey(key) {
|
|
31035
31034
|
return `${key}-${this.actionKey}`;
|
|
@@ -31400,35 +31399,22 @@ const getIMHanlder = customerHanlder => {
|
|
|
31400
31399
|
;// ./src/api/dify.js
|
|
31401
31400
|
|
|
31402
31401
|
|
|
31403
|
-
const
|
|
31404
|
-
let
|
|
31405
|
-
let finalUrl = `${home_page}/storage_area/public${fileUrl}`;
|
|
31406
|
-
let fileType = finalUrl.split(".").pop().toLowerCase();
|
|
31407
|
-
let fileName = options.fileName || dify_extractFilenameFromUrl(finalUrl);
|
|
31408
|
-
fileType = getDifyFileType(fileType);
|
|
31409
|
-
let loginUserData = window.anonymousIsLogin || window.currentUser;
|
|
31410
|
-
let user_id = options.userID || loginUserData?.id;
|
|
31411
|
-
let appid = options.appID || getPoratlAppID(false, []);
|
|
31402
|
+
const sendPostToAIAgent = async (queryData, successCallback, errorCallback) => {
|
|
31403
|
+
let appid = getPoratlAppID(false, []);
|
|
31412
31404
|
let appCustomData = await getAppCustomData(appid);
|
|
31413
|
-
let aiAgentServerIP =
|
|
31405
|
+
let aiAgentServerIP = appCustomData?.aiAgentServerIP || "";
|
|
31406
|
+
if (!aiAgentServerIP) {
|
|
31407
|
+
console.error("没有配置AI Agent服务地址,请联系管理员");
|
|
31408
|
+
if (errorCallback) errorCallback("没有配置AI Agent服务地址,请联系管理员");
|
|
31409
|
+
return;
|
|
31410
|
+
}
|
|
31414
31411
|
let serverUrl = `${aiAgentServerIP}/addAndCleanDocument`;
|
|
31415
|
-
let queryData = {
|
|
31416
|
-
params: {
|
|
31417
|
-
inputs: {
|
|
31418
|
-
fileName: fileName
|
|
31419
|
-
},
|
|
31420
|
-
files: [{
|
|
31421
|
-
type: fileType,
|
|
31422
|
-
transfer_method: options.transfer_method || "remote_url",
|
|
31423
|
-
url: finalUrl
|
|
31424
|
-
}],
|
|
31425
|
-
user: user_id
|
|
31426
|
-
}
|
|
31427
|
-
};
|
|
31428
31412
|
request.post(serverUrl, JSON.stringify(queryData)).then(res => {
|
|
31429
31413
|
console.log("发送消息成功:", res);
|
|
31414
|
+
if (successCallback) successCallback(res);
|
|
31430
31415
|
}).catch(error => {
|
|
31431
31416
|
console.error("发送消息失败:", error);
|
|
31417
|
+
if (errorCallback) errorCallback(error);
|
|
31432
31418
|
});
|
|
31433
31419
|
};
|
|
31434
31420
|
const getDifyFileType = fileType => {
|
|
@@ -31469,10 +31455,10 @@ const getDifyFileType = fileType => {
|
|
|
31469
31455
|
return typeOptions[key] || "custom";
|
|
31470
31456
|
};
|
|
31471
31457
|
|
|
31472
|
-
/**
|
|
31473
|
-
* 从 URL 中提取文件名(如 https://example.com/path/image.png → image.png)
|
|
31474
|
-
* @param {string} url - 文件 URL
|
|
31475
|
-
* @returns {string} - 提取的文件名
|
|
31458
|
+
/**
|
|
31459
|
+
* 从 URL 中提取文件名(如 https://example.com/path/image.png → image.png)
|
|
31460
|
+
* @param {string} url - 文件 URL
|
|
31461
|
+
* @returns {string} - 提取的文件名
|
|
31476
31462
|
*/
|
|
31477
31463
|
const dify_extractFilenameFromUrl = url => {
|
|
31478
31464
|
try {
|