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.
@@ -29552,7 +29552,6 @@ __webpack_require__.r(__webpack_exports__);
29552
29552
  // EXPORTS
29553
29553
  __webpack_require__.d(__webpack_exports__, {
29554
29554
  ChatClientMgr: function() { return /* reexport */ ChatClientMgr; },
29555
- addAndCleanDocument: function() { return /* reexport */ addAndCleanDocument; },
29556
29555
  addEventAction: function() { return /* reexport */ addEventAction; },
29557
29556
  addIMMapping: function() { return /* reexport */ addIMMapping; },
29558
29557
  addObjectUsedTimes: function() { return /* reexport */ addObjectUsedTimes; },
@@ -29611,6 +29610,7 @@ __webpack_require__.d(__webpack_exports__, {
29611
29610
  removeEventAction: function() { return /* reexport */ removeEventAction; },
29612
29611
  removeEventListener: function() { return /* reexport */ removeEventListener; },
29613
29612
  removeWindowTrustedOrigin: function() { return /* reexport */ removeWindowTrustedOrigin; },
29613
+ sendPostToAIAgent: function() { return /* reexport */ sendPostToAIAgent; },
29614
29614
  sendWindowMessage: function() { return /* reexport */ sendWindowMessage; },
29615
29615
  setPortalPageConfig: function() { return /* reexport */ setPortalPageConfig; },
29616
29616
  switchPortalLogin: function() { return /* reexport */ switchPortalLogin; },
@@ -31019,7 +31019,6 @@ class ChatClientMgr {
31019
31019
  this.customParams = params.customParams || {};
31020
31020
  this.chartOrigin = params.chartOrigin;
31021
31021
  console.log("ChatClientMgr init:", this.actionKey);
31022
- // this.charAIs = {};
31023
31022
  }
31024
31023
  makeKey(key) {
31025
31024
  return `${key}-${this.actionKey}`;
@@ -31390,35 +31389,22 @@ const getIMHanlder = customerHanlder => {
31390
31389
  ;// ./src/api/dify.js
31391
31390
 
31392
31391
 
31393
- const addAndCleanDocument = async (fileUrl, options = {}) => {
31394
- let home_page = window.smardaten_api_context_path;
31395
- let finalUrl = `${home_page}/storage_area/public${fileUrl}`;
31396
- let fileType = finalUrl.split(".").pop().toLowerCase();
31397
- let fileName = options.fileName || dify_extractFilenameFromUrl(finalUrl);
31398
- fileType = getDifyFileType(fileType);
31399
- let loginUserData = window.anonymousIsLogin || window.currentUser;
31400
- let user_id = options.userID || loginUserData?.id;
31401
- let appid = options.appID || getPoratlAppID(false, []);
31392
+ const sendPostToAIAgent = async (queryData, successCallback, errorCallback) => {
31393
+ let appid = getPoratlAppID(false, []);
31402
31394
  let appCustomData = await getAppCustomData(appid);
31403
- let aiAgentServerIP = options.aiAgentServerIP || appCustomData?.aiAgentServerIP || "";
31395
+ let aiAgentServerIP = appCustomData?.aiAgentServerIP || "";
31396
+ if (!aiAgentServerIP) {
31397
+ console.error("没有配置AI Agent服务地址,请联系管理员");
31398
+ if (errorCallback) errorCallback("没有配置AI Agent服务地址,请联系管理员");
31399
+ return;
31400
+ }
31404
31401
  let serverUrl = `${aiAgentServerIP}/addAndCleanDocument`;
31405
- let queryData = {
31406
- params: {
31407
- inputs: {
31408
- fileName: fileName
31409
- },
31410
- files: [{
31411
- type: fileType,
31412
- transfer_method: options.transfer_method || "remote_url",
31413
- url: finalUrl
31414
- }],
31415
- user: user_id
31416
- }
31417
- };
31418
31402
  request.post(serverUrl, JSON.stringify(queryData)).then(res => {
31419
31403
  console.log("发送消息成功:", res);
31404
+ if (successCallback) successCallback(res);
31420
31405
  }).catch(error => {
31421
31406
  console.error("发送消息失败:", error);
31407
+ if (errorCallback) errorCallback(error);
31422
31408
  });
31423
31409
  };
31424
31410
  const getDifyFileType = fileType => {
@@ -31459,10 +31445,10 @@ const getDifyFileType = fileType => {
31459
31445
  return typeOptions[key] || "custom";
31460
31446
  };
31461
31447
 
31462
- /**
31463
- * 从 URL 中提取文件名(如 https://example.com/path/image.png → image.png)
31464
- * @param {string} url - 文件 URL
31465
- * @returns {string} - 提取的文件名
31448
+ /**
31449
+ * 从 URL 中提取文件名(如 https://example.com/path/image.png → image.png)
31450
+ * @param {string} url - 文件 URL
31451
+ * @returns {string} - 提取的文件名
31466
31452
  */
31467
31453
  const dify_extractFilenameFromUrl = url => {
31468
31454
  try {