@glodon-aiot/agent-cli-ui 3.20.0-alpha.5 → 3.21.0-alpha.1

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/es/index.mjs CHANGED
@@ -913,7 +913,7 @@ const CI = (M) => {
913
913
  children: [N.type === 0 && ((a = j == null ? void 0 : j.imageContent) == null ? void 0 : a.length) && /* @__PURE__ */ i("div", {
914
914
  className: "item-user-images",
915
915
  children: /* @__PURE__ */ i(Ke, {
916
- children: j.imageContent.map((W, CM) => `![](${W})`).join(`
916
+ children: j.imageContent.map((W, lM) => `![](${W})`).join(`
917
917
 
918
918
  `)
919
919
  })
@@ -1005,8 +1005,8 @@ const CI = (M) => {
1005
1005
  children: [/* @__PURE__ */ i(ON, {
1006
1006
  ghost: !0,
1007
1007
  expandIconPosition: "right",
1008
- children: (K = j.actions) == null ? void 0 : K.map((W, CM) => {
1009
- var RM, iM, MN, BM, E, J, cM, lM, HM, C, B, H;
1008
+ children: (K = j.actions) == null ? void 0 : K.map((W, lM) => {
1009
+ var RM, iM, MN, BM, x, J, cM, OM, HM, C, B, H;
1010
1010
  return /* @__PURE__ */ o(R, {
1011
1011
  collapsible: L ? "header" : "icon",
1012
1012
  showArrow: L,
@@ -1035,14 +1035,14 @@ const CI = (M) => {
1035
1035
  children: ((MN = W[W.length - 1].data) == null ? void 0 : MN.pluginName) || ((BM = W[W.length - 1].data) == null ? void 0 : BM.pluginCode)
1036
1036
  }), /* @__PURE__ */ i("span", {
1037
1037
  className: "bot-plugin-action",
1038
- children: ((E = W[W.length - 1].data) == null ? void 0 : E.funcName) || ((J = W[W.length - 1].data) == null ? void 0 : J.funcCode)
1038
+ children: ((x = W[W.length - 1].data) == null ? void 0 : x.funcName) || ((J = W[W.length - 1].data) == null ? void 0 : J.funcCode)
1039
1039
  }), (W[W.length - 1].type === "BEFORE_CALL" || W[W.length - 1].type === "FUNCTION_CALL") && /* @__PURE__ */ i("span", {
1040
1040
  className: "bot-plugin-result",
1041
1041
  children: "执行中"
1042
1042
  }), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && qe((cM = W.find((d) => d.type === "RESULT")) == null ? void 0 : cM.data.result) && /* @__PURE__ */ i("span", {
1043
1043
  className: "bot-plugin-result",
1044
1044
  children: "执行成功"
1045
- }), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && !qe((lM = W.find((d) => d.type === "RESULT")) == null ? void 0 : lM.data.result) && /* @__PURE__ */ i("span", {
1045
+ }), (W[W.length - 1].type === "RESULT" || W[W.length - 1].type === "AFTER_CALL") && !qe((OM = W.find((d) => d.type === "RESULT")) == null ? void 0 : OM.data.result) && /* @__PURE__ */ i("span", {
1046
1046
  className: "bot-plugin-result",
1047
1047
  children: "执行失败"
1048
1048
  }), W[W.length - 1].type === "ABORT" && /* @__PURE__ */ i("span", {
@@ -1083,7 +1083,7 @@ const CI = (M) => {
1083
1083
  josn: lI((H = W.find((d) => d.type === "RESULT")) == null ? void 0 : H.data.result)
1084
1084
  })
1085
1085
  })]
1086
- }, CM);
1086
+ }, lM);
1087
1087
  })
1088
1088
  }), j.isLoading && /* @__PURE__ */ i("div", {
1089
1089
  className: "history-input-progress",
@@ -1297,20 +1297,18 @@ const gD = bN((M, N) => {
1297
1297
  getCurrentText: () => n
1298
1298
  })), U(() => {
1299
1299
  if (y(e), e) {
1300
- const E = document.createElement("div");
1301
- E.innerHTML = e;
1302
- const J = E.textContent || E.innerText || "";
1303
- f(J.replace(/[\n\s]+$/, ""));
1300
+ const x = new DOMParser().parseFromString(e, "text/html").body.textContent || "";
1301
+ f(x.replace(/[\n\s]+$/, ""));
1304
1302
  } else
1305
1303
  f(void 0);
1306
1304
  Y.current && (jM(), q());
1307
1305
  }, [e]), U(() => {
1308
1306
  if (!Y.current)
1309
1307
  return;
1310
- const E = Y.current.getEditor();
1311
- if (E && E.bounds !== document.body)
1308
+ const x = Y.current.getEditor();
1309
+ if (x && x.bounds !== document.body)
1312
1310
  try {
1313
- console.log("设置 bounds"), E.bounds = document.body;
1311
+ console.log("设置 bounds"), x.bounds = document.body;
1314
1312
  } catch (J) {
1315
1313
  console.warn("设置 bounds 失败:", J);
1316
1314
  }
@@ -1319,38 +1317,38 @@ const gD = bN((M, N) => {
1319
1317
  var HM;
1320
1318
  if (!Y.current)
1321
1319
  return;
1322
- const E = Y.current.getEditor(), J = E.root;
1323
- let lM = E.getText().trim().length > 0;
1324
- if (!lM) {
1320
+ const x = Y.current.getEditor(), J = x.root;
1321
+ let OM = x.getText().trim().length > 0;
1322
+ if (!OM) {
1325
1323
  const C = J.querySelectorAll("p");
1326
1324
  for (const B of Array.from(C)) {
1327
1325
  const H = Array.from(B.childNodes);
1328
1326
  if (H.length > 1 || H.length === 1 && ((HM = H[0].nodeName) == null ? void 0 : HM.toLowerCase()) !== "br") {
1329
- lM = !0;
1327
+ OM = !0;
1330
1328
  break;
1331
1329
  }
1332
1330
  }
1333
1331
  }
1334
- lM ? J.classList.add("hide-placeholder") : J.classList.remove("hide-placeholder");
1332
+ OM ? J.classList.add("hide-placeholder") : J.classList.remove("hide-placeholder");
1335
1333
  };
1336
1334
  U(() => {
1337
1335
  eM();
1338
1336
  }, [L]), U(() => {
1339
1337
  if (!Y.current)
1340
1338
  return;
1341
- const E = Y.current.getEditor().root, J = () => {
1342
- E.classList.add("hide-placeholder");
1339
+ const x = Y.current.getEditor().root, J = () => {
1340
+ x.classList.add("hide-placeholder");
1343
1341
  }, cM = () => {
1344
1342
  setTimeout(() => {
1345
1343
  eM();
1346
1344
  }, 0);
1347
1345
  };
1348
- return E.addEventListener("compositionstart", J), E.addEventListener("compositionend", cM), () => {
1349
- E.removeEventListener("compositionstart", J), E.removeEventListener("compositionend", cM);
1346
+ return x.addEventListener("compositionstart", J), x.addEventListener("compositionend", cM), () => {
1347
+ x.removeEventListener("compositionstart", J), x.removeEventListener("compositionend", cM);
1350
1348
  };
1351
1349
  }, [Y.current]);
1352
- const O = (E) => {
1353
- y(E), setTimeout(() => {
1350
+ const O = (x) => {
1351
+ y(x), setTimeout(() => {
1354
1352
  eM();
1355
1353
  }, 0);
1356
1354
  }, l = () => {
@@ -1359,57 +1357,57 @@ const gD = bN((M, N) => {
1359
1357
  }, q = () => {
1360
1358
  if (!Y.current || g)
1361
1359
  return;
1362
- const E = Y.current.getEditor();
1363
- E.focus(), setTimeout(() => {
1364
- E.getLength() > 0 && E.setSelection(E.getLength(), E.getLength());
1360
+ const x = Y.current.getEditor();
1361
+ x.focus(), setTimeout(() => {
1362
+ x.getLength() > 0 && x.setSelection(x.getLength(), x.getLength());
1365
1363
  });
1366
1364
  };
1367
1365
  U(() => {
1368
1366
  if (!Y.current)
1369
1367
  return;
1370
- const E = Y.current.getEditor();
1371
- D && (E.on("text-change", () => {
1372
- E.getLength() > D && E.deleteText(D, E.getLength()), jM(), mM(), q();
1373
- }), E.on("selection-change", mM));
1368
+ const x = Y.current.getEditor();
1369
+ D && (x.on("text-change", () => {
1370
+ x.getLength() > D && x.deleteText(D, x.getLength()), jM(), mM(), q();
1371
+ }), x.on("selection-change", mM));
1374
1372
  }, [Y, D]);
1375
1373
  const jM = () => {
1376
1374
  if (!Y.current)
1377
1375
  return;
1378
- const E = Y.current.getEditor(), J = E.getBounds(E.getLength() - 1, E.getLength());
1376
+ const x = Y.current.getEditor(), J = x.getBounds(x.getLength() - 1, x.getLength());
1379
1377
  J && (R(J.left), m(J.top));
1380
- }, mM = (E) => {
1378
+ }, mM = (x) => {
1381
1379
  if (!Y.current)
1382
1380
  return;
1383
- const J = Y.current.getEditor(), cM = E || J.getSelection();
1381
+ const J = Y.current.getEditor(), cM = x || J.getSelection();
1384
1382
  (cM == null ? void 0 : cM.index) !== void 0 && a(cM == null ? void 0 : cM.index);
1385
1383
  };
1386
1384
  di("1", () => {
1387
1385
  var J;
1388
- const E = (J = Y.current) == null ? void 0 : J.getEditor();
1389
- b && I && (E == null || E.blur(), setTimeout(() => W()));
1386
+ const x = (J = Y.current) == null ? void 0 : J.getEditor();
1387
+ b && I && (x == null || x.blur(), setTimeout(() => W()));
1390
1388
  }), di("2", () => {
1391
1389
  var J;
1392
- const E = (J = Y.current) == null ? void 0 : J.getEditor();
1393
- b && (E == null || E.blur(), setTimeout(() => CM()));
1390
+ const x = (J = Y.current) == null ? void 0 : J.getEditor();
1391
+ b && (x == null || x.blur(), setTimeout(() => lM()));
1394
1392
  });
1395
1393
  const W = () => {
1396
1394
  var J;
1397
1395
  if (!I)
1398
1396
  return;
1399
- const E = (J = Y.current) == null ? void 0 : J.getEditor();
1400
- E == null || E.focus(), $(!1), setTimeout(() => E == null ? void 0 : E.insertText(k, Qe.NETWORK));
1401
- }, CM = () => {
1397
+ const x = (J = Y.current) == null ? void 0 : J.getEditor();
1398
+ x == null || x.focus(), $(!1), setTimeout(() => x == null ? void 0 : x.insertText(k, Qe.NETWORK));
1399
+ }, lM = () => {
1402
1400
  var J;
1403
- const E = (J = Y.current) == null ? void 0 : J.getEditor();
1404
- E == null || E.focus(), $(!1), setTimeout(() => E == null ? void 0 : E.insertText(k, Qe.DOCUMENT));
1401
+ const x = (J = Y.current) == null ? void 0 : J.getEditor();
1402
+ x == null || x.focus(), $(!1), setTimeout(() => x == null ? void 0 : x.insertText(k, Qe.DOCUMENT));
1405
1403
  }, RM = () => {
1406
- var J, cM, lM;
1407
- const E = (J = Y.current) == null ? void 0 : J.getEditor();
1408
- return E && (E == null ? void 0 : E.getLength()) > 2 && !((cM = E.getText()) != null && cM.includes(Qe.NETWORK)) && !((lM = E.getText()) != null && lM.includes(Qe.DOCUMENT));
1404
+ var J, cM, OM;
1405
+ const x = (J = Y.current) == null ? void 0 : J.getEditor();
1406
+ return x && (x == null ? void 0 : x.getLength()) > 2 && !((cM = x.getText()) != null && cM.includes(Qe.NETWORK)) && !((OM = x.getText()) != null && OM.includes(Qe.DOCUMENT));
1409
1407
  };
1410
1408
  return U(() => {
1411
- var E, J;
1412
- A ? (E = Y.current) == null || E.getEditor().disable() : (J = Y.current) == null || J.getEditor().enable();
1409
+ var x, J;
1410
+ A ? (x = Y.current) == null || x.getEditor().disable() : (J = Y.current) == null || J.getEditor().enable();
1413
1411
  }, [A]), U(() => (window.addEventListener("resize", jM), () => {
1414
1412
  window.removeEventListener("resize", jM);
1415
1413
  }), []), /* @__PURE__ */ o("div", {
@@ -1422,8 +1420,8 @@ const gD = bN((M, N) => {
1422
1420
  "quill-editor-wrapper": !0,
1423
1421
  "quill-editor-wrapper__scroll": w >= 200
1424
1422
  }),
1425
- onKeyDownCapture: (E) => {
1426
- !E.shiftKey && E.code === "Enter" && E.preventDefault();
1423
+ onKeyDownCapture: (x) => {
1424
+ !x.shiftKey && x.code === "Enter" && x.preventDefault();
1427
1425
  },
1428
1426
  children: [/* @__PURE__ */ i(Vz, {
1429
1427
  theme: "snow",
@@ -1432,8 +1430,8 @@ const gD = bN((M, N) => {
1432
1430
  bounds: document.body,
1433
1431
  onFocus: () => u(!0),
1434
1432
  onBlur: () => u(!1),
1435
- onKeyDown: (E) => {
1436
- if (!E.shiftKey && E.keyCode == 13) {
1433
+ onKeyDown: (x) => {
1434
+ if (!x.shiftKey && x.keyCode == 13) {
1437
1435
  const J = L == null ? void 0 : L.replace(/[\n\s]+$/, "");
1438
1436
  y(J), j && j(n);
1439
1437
  }
@@ -1442,12 +1440,12 @@ const gD = bN((M, N) => {
1442
1440
  modules: {
1443
1441
  toolbar: !1
1444
1442
  },
1445
- onChange: (E, J, cM, lM) => {
1443
+ onChange: (x, J, cM, OM) => {
1446
1444
  if (!J)
1447
1445
  return;
1448
- y(E);
1449
- const HM = lM.getText().replace(/[\n\s]+$/, "");
1450
- f(HM), z && z(E, lM);
1446
+ y(x);
1447
+ const HM = OM.getText().replace(/[\n\s]+$/, "");
1448
+ f(HM), z && z(x, OM);
1451
1449
  }
1452
1450
  }), /* @__PURE__ */ i("div", {
1453
1451
  className: "shortcut-direct",
@@ -1463,9 +1461,9 @@ const gD = bN((M, N) => {
1463
1461
  autoAdjustOverflow: !0,
1464
1462
  placement: "top",
1465
1463
  trigger: "hover",
1466
- getPopupContainer: (E) => E.parentNode,
1467
- onVisibleChange: (E) => {
1468
- $(E);
1464
+ getPopupContainer: (x) => x.parentNode,
1465
+ onVisibleChange: (x) => {
1466
+ $(x);
1469
1467
  },
1470
1468
  content: /* @__PURE__ */ o("div", {
1471
1469
  className: "shortcut-direct-pannel",
@@ -1484,7 +1482,7 @@ const gD = bN((M, N) => {
1484
1482
  })]
1485
1483
  }), /* @__PURE__ */ o("div", {
1486
1484
  className: "shortcut-direct-item",
1487
- onClick: CM,
1485
+ onClick: lM,
1488
1486
  children: [/* @__PURE__ */ i("span", {
1489
1487
  className: "title",
1490
1488
  children: "指定文档回答"
@@ -2026,8 +2024,8 @@ const SI = (M) => {
2026
2024
  return;
2027
2025
  }
2028
2026
  }
2029
- }), CM = () => j ? Promise.resolve(j) : D(), RM = (C) => {
2030
- C.length && CM().then((B) => {
2027
+ }), lM = () => j ? Promise.resolve(j) : D(), RM = (C) => {
2028
+ C.length && lM().then((B) => {
2031
2029
  C == null || C.forEach((H) => {
2032
2030
  var d;
2033
2031
  $.current = !0, (d = cM(B, H)) == null || d.then((_) => {
@@ -2047,7 +2045,7 @@ const SI = (M) => {
2047
2045
  });
2048
2046
  }, iM = (C, B) => O == null ? void 0 : O.postApplicationIdSessionKnowledgeSessionFile(e, C, B), BM = Xz((C) => {
2049
2047
  jM("error", C);
2050
- }, 300), E = (C) => {
2048
+ }, 300), x = (C) => {
2051
2049
  j && C != null && C.id && (O == null || O.delApplicationIdSessionKnowledgeFileId(e, j, C.id).then((B) => {
2052
2050
  const H = n.filter((d) => d.id !== C.id);
2053
2051
  f(H), jM("success", "删除成功"), T && T(C.id);
@@ -2109,7 +2107,7 @@ const SI = (M) => {
2109
2107
  if (!C)
2110
2108
  throw Error("session is not exist.");
2111
2109
  return O == null ? void 0 : O.uploadFile(C, B).catch(() => (jM("error", "服务异常,请稍后再试"), ""));
2112
- }, lM = /* @__PURE__ */ i("div", {
2110
+ }, OM = /* @__PURE__ */ i("div", {
2113
2111
  className: `upload-enter ${z ? "disabled" : ""}`,
2114
2112
  children: /* @__PURE__ */ i(bz, {
2115
2113
  size: "small",
@@ -2151,7 +2149,7 @@ const SI = (M) => {
2151
2149
  });
2152
2150
  return /* @__PURE__ */ o("div", {
2153
2151
  className: "footer-upload",
2154
- children: [z ? lM : /* @__PURE__ */ i($N, {
2152
+ children: [z ? OM : /* @__PURE__ */ i($N, {
2155
2153
  overlayClassName: "upload-popover",
2156
2154
  overlayInnerStyle: {
2157
2155
  width: 264,
@@ -2187,7 +2185,7 @@ const SI = (M) => {
2187
2185
  window.open(`${L}?url=${encodeURIComponent(C == null ? void 0 : C.url)}`);
2188
2186
  },
2189
2187
  remove: () => {
2190
- E(C);
2188
+ x(C);
2191
2189
  },
2192
2190
  download: () => {
2193
2191
  j && (O == null || O.getApplicationIdSessionKnowledgeFileId(e, j, C.id).then((H) => {
@@ -2241,7 +2239,7 @@ const SI = (M) => {
2241
2239
  }),
2242
2240
  title: J,
2243
2241
  trigger: "click",
2244
- children: lM
2242
+ children: OM
2245
2243
  }), K && /* @__PURE__ */ i(SI, {
2246
2244
  isvisible: K,
2247
2245
  onClose: (C) => {
@@ -2733,23 +2731,23 @@ const LD = Vi(void 0), bI = ({
2733
2731
  } = VM(XM), [R, w] = r(t), {
2734
2732
  sessions: m,
2735
2733
  setSessions: k
2736
- } = zt(), [a, b] = r(0), [$, K] = r(""), [Y, eM] = r(null), O = 30, [l, v] = r(!1), [q, jM] = r(!0), [mM, W] = r(!1), CM = bM(void 0), RM = bM(0), iM = bM(null), MN = bM(null), BM = (S) => {
2734
+ } = zt(), [a, b] = r(0), [$, K] = r(""), [Y, eM] = r(null), O = 30, [l, v] = r(!1), [q, jM] = r(!0), [mM, W] = r(!1), lM = bM(void 0), RM = bM(0), iM = bM(null), MN = bM(null), BM = (S) => {
2737
2735
  var gM, ZM;
2738
2736
  if (!(S != null && S.length))
2739
2737
  return;
2740
2738
  let V = (ZM = (gM = S[0]) == null ? void 0 : gM.data) == null ? void 0 : ZM.createdAt;
2741
2739
  return S.forEach((sM) => {
2742
- var OM, hM, WM, _M;
2743
- V ? (hM = sM.data) != null && hM.createdAt && KM((WM = sM.data) == null ? void 0 : WM.createdAt).valueOf() < KM(V).valueOf() && (V = (_M = sM.data) == null ? void 0 : _M.createdAt) : V = (OM = sM.data) == null ? void 0 : OM.createdAt;
2740
+ var YM, hM, WM, _M;
2741
+ V ? (hM = sM.data) != null && hM.createdAt && KM((WM = sM.data) == null ? void 0 : WM.createdAt).valueOf() < KM(V).valueOf() && (V = (_M = sM.data) == null ? void 0 : _M.createdAt) : V = (YM = sM.data) == null ? void 0 : YM.createdAt;
2744
2742
  }), V;
2745
- }, E = Se((S) => {
2743
+ }, x = Se((S) => {
2746
2744
  S.id && k((V) => [...V.map((sM) => {
2747
- var OM;
2748
- return ((OM = sM.data) == null ? void 0 : OM.id) === S.id && (sM.data = DM({}, S)), sM;
2749
- })].sort((sM, OM) => {
2745
+ var YM;
2746
+ return ((YM = sM.data) == null ? void 0 : YM.id) === S.id && (sM.data = DM({}, S)), sM;
2747
+ })].sort((sM, YM) => {
2750
2748
  var _M, iN;
2751
2749
  const hM = KM((_M = sM.data) == null ? void 0 : _M.createdAt).valueOf();
2752
- return KM((iN = OM.data) == null ? void 0 : iN.createdAt).valueOf() - hM;
2750
+ return KM((iN = YM.data) == null ? void 0 : iN.createdAt).valueOf() - hM;
2753
2751
  }));
2754
2752
  });
2755
2753
  U(() => {
@@ -2757,11 +2755,11 @@ const LD = Vi(void 0), bI = ({
2757
2755
  e === void 0 && !A && (j == null || j(null));
2758
2756
  return;
2759
2757
  }
2760
- v(!0), CM.current = void 0, RM.current = 0, L == null || L.getSessions({
2758
+ v(!0), lM.current = void 0, RM.current = 0, L == null || L.getSessions({
2761
2759
  pageSize: O
2762
2760
  }).then((S) => tM(void 0, null, function* () {
2763
2761
  var V;
2764
- if (k([...S]), RM.current = S.length, CM.current = BM(S), jM(S.length >= O), W(S.length < O), !((V = e == null ? void 0 : e.data) != null && V.id) && (S != null && S.length) && y === "inlay") {
2762
+ if (k([...S]), RM.current = S.length, lM.current = BM(S), jM(S.length >= O), W(S.length < O), !((V = e == null ? void 0 : e.data) != null && V.id) && (S != null && S.length) && y === "inlay") {
2765
2763
  const gM = S[0];
2766
2764
  A || j == null || j(gM);
2767
2765
  } else
@@ -2780,7 +2778,7 @@ const LD = Vi(void 0), bI = ({
2780
2778
  }
2781
2779
  w(t);
2782
2780
  }, [t]), U(() => {
2783
- e == null || e.addEventListener("data:updated", E);
2781
+ e == null || e.addEventListener("data:updated", x);
2784
2782
  }, [e]), XN(N, () => ({
2785
2783
  create(S) {
2786
2784
  return J(S).then((V) => (j == null || j(V), V));
@@ -2799,7 +2797,7 @@ const LD = Vi(void 0), bI = ({
2799
2797
  netOpen: (D == null ? void 0 : D.type) === 0 ? S != null && S.netOpen ? S.netOpen : V ? ZN.OPEN : ZN.CLOSE : void 0,
2800
2798
  knowledges: (hM = e == null ? void 0 : e.data) != null && hM.id ? S == null ? void 0 : S.knowledges : R,
2801
2799
  promptVariables: ZM
2802
- }), OM = (WM) => {
2800
+ }), YM = (WM) => {
2803
2801
  var _M;
2804
2802
  FM.config({
2805
2803
  getContainer: () => (f == null ? void 0 : f.current) || document.body,
@@ -2811,8 +2809,8 @@ const LD = Vi(void 0), bI = ({
2811
2809
  prefixCls: "gbot-notification"
2812
2810
  });
2813
2811
  };
2814
- sM == null || sM.addEventListener("error", OM), sM == null || sM.addEventListener("data:created", () => tM(void 0, null, function* () {
2815
- sM == null || sM.removeEventListener("error", OM), k([sM, ...m]), gM(sM);
2812
+ sM == null || sM.addEventListener("error", YM), sM == null || sM.addEventListener("data:created", () => tM(void 0, null, function* () {
2813
+ sM == null || sM.removeEventListener("error", YM), k([sM, ...m]), gM(sM);
2816
2814
  }));
2817
2815
  }));
2818
2816
  }, cM = () => {
@@ -2821,12 +2819,12 @@ const LD = Vi(void 0), bI = ({
2821
2819
  }).then((S) => {
2822
2820
  j == null || j(S);
2823
2821
  });
2824
- }, lM = (S) => {
2822
+ }, OM = (S) => {
2825
2823
  L == null || L.removeSession(S, !0).then(() => tM(void 0, null, function* () {
2826
2824
  var gM, ZM;
2827
2825
  const V = m.filter((sM) => {
2828
- var OM, hM;
2829
- return ((OM = sM.data) == null ? void 0 : OM.id) !== ((hM = S.data) == null ? void 0 : hM.id);
2826
+ var YM, hM;
2827
+ return ((YM = sM.data) == null ? void 0 : YM.id) !== ((hM = S.data) == null ? void 0 : hM.id);
2830
2828
  });
2831
2829
  ((gM = S.data) == null ? void 0 : gM.id) === ((ZM = e == null ? void 0 : e.data) == null ? void 0 : ZM.id) && (V != null && V.length ? j == null || j(V[0]) : j == null || j(null)), k([...V]);
2832
2830
  }));
@@ -2836,9 +2834,9 @@ const LD = Vi(void 0), bI = ({
2836
2834
  try {
2837
2835
  const S = yield L == null ? void 0 : L.getSessions({
2838
2836
  pageSize: O,
2839
- beforeTime: CM.current
2837
+ beforeTime: lM.current
2840
2838
  }), V = (S == null ? void 0 : S.length) || 0, gM = V - RM.current;
2841
- k([...S || []]), CM.current = BM(S || []), gM <= 0 ? (jM(!1), W(!0)) : gM < O ? (jM(!1), W(!0), RM.current = V) : (jM(!0), W(!1), RM.current = V);
2839
+ k([...S || []]), lM.current = BM(S || []), gM <= 0 ? (jM(!1), W(!0)) : gM < O ? (jM(!1), W(!0), RM.current = V) : (jM(!0), W(!1), RM.current = V);
2842
2840
  } finally {
2843
2841
  v(!1);
2844
2842
  }
@@ -2865,7 +2863,7 @@ const LD = Vi(void 0), bI = ({
2865
2863
  K(V);
2866
2864
  return;
2867
2865
  }
2868
- S.rename(g.trim()), S == null || S.addEventListener("data:updated", E), d();
2866
+ S.rename(g.trim()), S == null || S.addEventListener("data:updated", x), d();
2869
2867
  }, H = () => {
2870
2868
  d();
2871
2869
  }, d = () => {
@@ -2890,7 +2888,7 @@ const LD = Vi(void 0), bI = ({
2890
2888
  typeof (n == null ? void 0 : n.promptVariables) == "object" && ((ZM = n == null ? void 0 : n.promptVariables) != null && ZM.default) && (S.promptVariables = (sM = n == null ? void 0 : n.promptVariables) == null ? void 0 : sM.default), L == null || L.loadSession(e.id, S);
2891
2889
  }, [e]);
2892
2890
  const dM = Se((S) => {
2893
- const V = KM().endOf("day"), gM = V.subtract(1, "day"), ZM = V.subtract(7, "day"), sM = V.subtract(30, "day"), OM = [], hM = [], WM = [], _M = [], iN = {};
2891
+ const V = KM().endOf("day"), gM = V.subtract(1, "day"), ZM = V.subtract(7, "day"), sM = V.subtract(30, "day"), YM = [], hM = [], WM = [], _M = [], iN = {};
2894
2892
  return S.forEach((vM) => {
2895
2893
  var tN;
2896
2894
  const xM = KM((tN = vM.data) == null ? void 0 : tN.createdAt);
@@ -2904,21 +2902,21 @@ const LD = Vi(void 0), bI = ({
2904
2902
  const eN = xM.format("YYYY-MM");
2905
2903
  iN[eN] || (iN[eN] = []), iN[eN].push(vM);
2906
2904
  }
2907
- }), hM.length > 0 && OM.push({
2905
+ }), hM.length > 0 && YM.push({
2908
2906
  title: "今天",
2909
2907
  sessions: hM.sort((vM, xM) => {
2910
2908
  var tN, eN;
2911
2909
  return KM((tN = xM.data) == null ? void 0 : tN.createdAt).valueOf() - KM((eN = vM.data) == null ? void 0 : eN.createdAt).valueOf();
2912
2910
  }),
2913
2911
  key: "today"
2914
- }), WM.length > 0 && OM.push({
2912
+ }), WM.length > 0 && YM.push({
2915
2913
  title: "7天内",
2916
2914
  sessions: WM.sort((vM, xM) => {
2917
2915
  var tN, eN;
2918
2916
  return KM((tN = xM.data) == null ? void 0 : tN.createdAt).valueOf() - KM((eN = vM.data) == null ? void 0 : eN.createdAt).valueOf();
2919
2917
  }),
2920
2918
  key: "seven-days"
2921
- }), _M.length > 0 && OM.push({
2919
+ }), _M.length > 0 && YM.push({
2922
2920
  title: "30天内",
2923
2921
  sessions: _M.sort((vM, xM) => {
2924
2922
  var tN, eN;
@@ -2930,12 +2928,12 @@ const LD = Vi(void 0), bI = ({
2930
2928
  var Je, qN;
2931
2929
  return KM((Je = eN.data) == null ? void 0 : Je.createdAt).valueOf() - KM((qN = tN.data) == null ? void 0 : qN.createdAt).valueOf();
2932
2930
  });
2933
- OM.push({
2931
+ YM.push({
2934
2932
  title: KM(vM).format("YYYY年MM月"),
2935
2933
  sessions: xM,
2936
2934
  key: `month-${vM}`
2937
2935
  });
2938
- }), OM;
2936
+ }), YM;
2939
2937
  }), fM = Xi(() => dM(m), [m, dM]);
2940
2938
  return /* @__PURE__ */ i("div", {
2941
2939
  className: "bot-session-container",
@@ -2970,7 +2968,7 @@ const LD = Vi(void 0), bI = ({
2970
2968
  },
2971
2969
  children: S.title
2972
2970
  }), (V = S.sessions) == null ? void 0 : V.map((gM) => {
2973
- var ZM, sM, OM, hM, WM, _M, iN, KN, vM;
2971
+ var ZM, sM, YM, hM, WM, _M, iN, KN, vM;
2974
2972
  return /* @__PURE__ */ i("div", {
2975
2973
  className: yN({
2976
2974
  "session-item": !0,
@@ -2990,7 +2988,7 @@ const LD = Vi(void 0), bI = ({
2990
2988
  ellipsis: {
2991
2989
  rows: 1,
2992
2990
  tooltip: {
2993
- title: ((OM = gM.data) == null ? void 0 : OM.name) || "-",
2991
+ title: ((YM = gM.data) == null ? void 0 : YM.name) || "-",
2994
2992
  placement: "topLeft"
2995
2993
  }
2996
2994
  },
@@ -3037,7 +3035,7 @@ const LD = Vi(void 0), bI = ({
3037
3035
  })]
3038
3036
  }),
3039
3037
  onConfirm: () => {
3040
- lM(gM), b((xM) => xM + 1);
3038
+ OM(gM), b((xM) => xM + 1);
3041
3039
  },
3042
3040
  onCancel: () => {
3043
3041
  b((xM) => xM + 1);
@@ -3503,11 +3501,11 @@ ${t}` : t;
3503
3501
  sider: jM,
3504
3502
  mode: mM,
3505
3503
  silencedSeconds: W
3506
- } = VM(XM), [CM, RM] = r(!1), iM = bM(g), MN = bM(void 0), [BM, E] = r(0), [J, cM] = r([]), [lM, HM] = r([]), [C, B] = r(0), [H, d] = r(!1);
3504
+ } = VM(XM), [lM, RM] = r(!1), iM = bM(g), MN = bM(void 0), [BM, x] = r(0), [J, cM] = r([]), [OM, HM] = r([]), [C, B] = r(0), [H, d] = r(!1);
3507
3505
  U(() => {
3508
3506
  d(C > 0);
3509
3507
  }, [C]);
3510
- const _ = bM(null), [zM, nM] = r([]), [dM, fM] = r(!1), [S, V] = r(!1), [gM, ZM] = r(""), [sM, OM] = r(), [hM, WM] = r({}), _M = bM(null), iN = bM(null), KN = bM(null), [vM, xM] = r(!1), [tN, eN] = r([]), [Je, qN] = r(!0), [Iz, gz] = r(!0), [St, EN] = r(!1), [Sj, WN] = r(!1), [kt, Tz] = r(!1), [nN, le] = r(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [uz, sz] = r(() => {
3508
+ const _ = bM(null), [zM, nM] = r([]), [dM, fM] = r(!1), [S, V] = r(!1), [gM, ZM] = r(""), [sM, YM] = r(), [hM, WM] = r({}), _M = bM(null), iN = bM(null), KN = bM(null), [vM, xM] = r(!1), [tN, eN] = r([]), [Je, qN] = r(!0), [Iz, gz] = r(!0), [St, EN] = r(!1), [Sj, WN] = r(!1), [kt, Tz] = r(!1), [nN, le] = r(typeof (l == null ? void 0 : l.promptVariables) == "object" ? l.promptVariables.default || [] : []), [uz, sz] = r(() => {
3511
3509
  const s = typeof (l == null ? void 0 : l.knowledges) == "object" && l.knowledges.default || void 0;
3512
3510
  if (s) {
3513
3511
  if (Array.isArray(s) && s.some((G) => Array.isArray(G.fileIds) && G.fileIds.length === 0))
@@ -3542,12 +3540,12 @@ ${t}` : t;
3542
3540
  t.ready ? PN(!1) : PN(!0);
3543
3541
  }
3544
3542
  }, [t, t == null ? void 0 : t.ready, vt]), U(() => {
3545
- var x, G;
3543
+ var E, G;
3546
3544
  t && (iM.current = []), u([]);
3547
3545
  const s = Q.current;
3548
3546
  if (s && s.scrollTo({
3549
3547
  top: 0
3550
- }), !((x = t == null ? void 0 : t.data) != null && x.id))
3548
+ }), !((E = t == null ? void 0 : t.data) != null && E.id))
3551
3549
  return;
3552
3550
  if (WN(!1), EN(!1), (G = t.messages) != null && G.length) {
3553
3551
  const MM = [...t.messages.filter((F) => F == null ? void 0 : F.messageId)].reverse();
@@ -3567,7 +3565,7 @@ ${t}` : t;
3567
3565
  }, [t]), U(() => {
3568
3566
  const s = () => {
3569
3567
  var c;
3570
- (c = t == null ? void 0 : t.data) != null && c.id && (t.promptVariables && le(t.promptVariables.sort((x, G) => x.key.localeCompare(G.key))), t.knowledges && sz(t.knowledges), A(t.netOpen));
3568
+ (c = t == null ? void 0 : t.data) != null && c.id && (t.promptVariables && le(t.promptVariables.sort((E, G) => E.key.localeCompare(G.key))), t.knowledges && sz(t.knowledges), A(t.netOpen));
3571
3569
  };
3572
3570
  return t == null || t.addEventListener("data:updated", s), () => {
3573
3571
  t == null || t.removeEventListener("data:updated", s);
@@ -3576,13 +3574,13 @@ ${t}` : t;
3576
3574
  var c;
3577
3575
  if (!((c = t == null ? void 0 : t.data) != null && c.id))
3578
3576
  return;
3579
- const s = (x) => {
3577
+ const s = (E) => {
3580
3578
  var G;
3581
- console.error(x.message, x.cause, "e.case"), FM.config({
3579
+ console.error(E.message, E.cause, "e.case"), FM.config({
3582
3580
  getContainer: () => (v == null ? void 0 : v.current) || document.body,
3583
3581
  prefixCls: "gbot-notification"
3584
3582
  }), FM.error({
3585
- message: ((G = x.cause) == null ? void 0 : G.message) || x.message
3583
+ message: ((G = E.cause) == null ? void 0 : G.message) || E.message
3586
3584
  }), FM.config({
3587
3585
  getContainer: void 0,
3588
3586
  prefixCls: "gbot-notification"
@@ -3593,8 +3591,8 @@ ${t}` : t;
3593
3591
  };
3594
3592
  }, [t]);
3595
3593
  const az = () => {
3596
- var x;
3597
- if (!((x = t == null ? void 0 : t.data) != null && x.id) || !(e != null && e.id))
3594
+ var E;
3595
+ if (!((E = t == null ? void 0 : t.data) != null && E.id) || !(e != null && e.id))
3598
3596
  return;
3599
3597
  const s = t.data.id, c = g[g.length - 1];
3600
3598
  if (c && c.isContext) {
@@ -3632,7 +3630,7 @@ ${t}` : t;
3632
3630
  DN("error", "正在回复中");
3633
3631
  return;
3634
3632
  }
3635
- if (CM) {
3633
+ if (lM) {
3636
3634
  DN("error", "等待初始化");
3637
3635
  return;
3638
3636
  }
@@ -3652,8 +3650,8 @@ ${t}` : t;
3652
3650
  Ne(!0), D == null || D({
3653
3651
  netOpen: T ? ZN.OPEN : ZN.CLOSE
3654
3652
  }).then((PM) => {
3655
- var YM, xN;
3656
- Me(!0), A(!!((YM = PM.data) != null && YM.netOpen)), Ye(!!((xN = PM.data) != null && xN.enableNetOpen)), Uj(PM).then(() => {
3653
+ var CM, xN;
3654
+ Me(!0), A(!!((CM = PM.data) != null && CM.netOpen)), Ye(!!((xN = PM.data) != null && xN.enableNetOpen)), Uj(PM).then(() => {
3657
3655
  I == null || I(PM), Me(!1), f(c);
3658
3656
  });
3659
3657
  }).catch((PM) => {
@@ -3664,7 +3662,7 @@ ${t}` : t;
3664
3662
  if (He)
3665
3663
  return;
3666
3664
  Ne(!0), Be(!0);
3667
- const p = Wj(c, lM, hM[G], (e == null ? void 0 : e.type) || 0);
3665
+ const p = Wj(c, OM, hM[G], (e == null ? void 0 : e.type) || 0);
3668
3666
  let MM;
3669
3667
  try {
3670
3668
  Y ? MM = yield Y == null ? void 0 : Y({
@@ -3687,14 +3685,14 @@ ${t}` : t;
3687
3685
  let F = c;
3688
3686
  typeof MM == "object" && (F = MM.content || c);
3689
3687
  const NM = yield (() => new Promise((PM) => {
3690
- le((YM) => (PM(YM), YM));
3688
+ le((CM) => (PM(CM), CM));
3691
3689
  }))();
3692
3690
  if (!(yield t.setPromptVariables(NM))) {
3693
3691
  Ne(!1);
3694
3692
  return;
3695
3693
  }
3696
3694
  (($M = hM[G]) == null ? void 0 : $M.length) > 0 ? rz(F) : mj(F);
3697
- }), Uj = (s) => new Promise((c, x) => tM(void 0, null, function* () {
3695
+ }), Uj = (s) => new Promise((c, E) => tM(void 0, null, function* () {
3698
3696
  const MM = (s == null ? void 0 : s.promptVariables).filter((F) => F.type ? !((F.type === SM.User || F.type === void 0) && F.key === "query") && !((F.type === SM.System || F.type === void 0) && F.key === "datetime") : F.key !== "query").map((F) => {
3699
3697
  var NM;
3700
3698
  const QM = (NM = nN.find((GM) => GM.key === F.key && GM.type === F.type)) == null ? void 0 : NM.value;
@@ -3708,24 +3706,24 @@ ${t}` : t;
3708
3706
  if (qN(!1), !((p = t == null ? void 0 : t.data) != null && p.id) || !(e != null && e.id))
3709
3707
  return;
3710
3708
  const c = ((MM = t.data) == null ? void 0 : MM.id) || "";
3711
- let x = [], G = /* @__PURE__ */ new Set();
3709
+ let E = [], G = /* @__PURE__ */ new Set();
3712
3710
  (F = hM[c]) == null || F.forEach((QM) => {
3713
- G.has(QM.id) || (x.push(QM), G.add(QM.id));
3714
- }), qN(!0), mj(s, x);
3711
+ G.has(QM.id) || (E.push(QM), G.add(QM.id));
3712
+ }), qN(!0), mj(s, E);
3715
3713
  };
3716
3714
  U(() => {
3717
3715
  if (!n || !t)
3718
3716
  return;
3719
3717
  const s = n, c = () => tM(void 0, null, function* () {
3720
3718
  Be(!0);
3721
- const x = Wj(s, lM, hM[t.id], (e == null ? void 0 : e.type) || 0);
3719
+ const E = Wj(s, OM, hM[t.id], (e == null ? void 0 : e.type) || 0);
3722
3720
  let G;
3723
3721
  try {
3724
3722
  Y ? G = yield Y == null ? void 0 : Y({
3725
3723
  applicationId: e.id,
3726
3724
  sessionId: t.id,
3727
3725
  message: {
3728
- content: x,
3726
+ content: E,
3729
3727
  sessionId: t.id,
3730
3728
  role: Oi.User,
3731
3729
  files: hM[t.id]
@@ -3746,53 +3744,55 @@ ${t}` : t;
3746
3744
  }, [n, t]);
3747
3745
  const mj = (s, c) => tM(void 0, null, function* () {
3748
3746
  var TM, $M, PM;
3749
- const x = (TM = t == null ? void 0 : t.data) == null ? void 0 : TM.id;
3750
- if (!x)
3747
+ const E = (TM = t == null ? void 0 : t.data) == null ? void 0 : TM.id;
3748
+ if (!E)
3751
3749
  return;
3752
3750
  WN(!0), EN(!0);
3753
- const G = Wj(s, lM, c, (e == null ? void 0 : e.type) || 0);
3751
+ const G = Wj(s, OM, c, (e == null ? void 0 : e.type) || 0);
3754
3752
  let p;
3755
3753
  if (e.type === IN.Agent)
3756
3754
  p = void 0;
3757
3755
  else if (e.type === IN.Dialog && (($M = e.arrange) != null && $M.length) && e.arrange[0].visionOpen) {
3758
- const YM = lM && lM.length ? lM.filter(Boolean) : [];
3759
- p = YM.length ? YM : void 0;
3756
+ const CM = OM && OM.length ? OM.filter(Boolean) : [];
3757
+ p = CM.length ? CM : void 0;
3760
3758
  } else
3761
3759
  p = void 0;
3762
3760
  const MM = new we(
3763
3761
  G,
3764
- x,
3762
+ E,
3765
3763
  RN.User,
3766
3764
  c,
3767
3765
  p
3768
3766
  // 新增:传入图片内容
3769
3767
  );
3770
- y(void 0), OM(void 0), iM.current = [MM, ...g], u(iM.current), e.id && $ && $({
3768
+ y(void 0), YM(void 0), iM.current = [MM, ...g], u(iM.current), e.id && $ && $({
3771
3769
  applicationId: e.id,
3772
- sessionId: x,
3770
+ sessionId: E,
3773
3771
  message: MM
3774
3772
  });
3775
- const F = new we("", x, RN.System);
3773
+ const F = new we("", E, RN.System);
3776
3774
  F.isWaiting = !0, iM.current = [F, ...iM.current], u(iM.current);
3777
- const QM = (c == null ? void 0 : c.map((YM) => YM.id)) || [], NM = {
3775
+ const QM = (c == null ? void 0 : c.map((CM) => CM.id)) || [], NM = {
3778
3776
  stream: MD.stream,
3779
3777
  referenceFirst: !1
3780
3778
  };
3781
3779
  if (a != null && a.promptVariables) {
3782
- const YM = nN == null ? void 0 : nN.reduce((xN, se) => (xN[se.key] = se.value, xN), {});
3783
- NM.formatValues = YM;
3780
+ const CM = nN == null ? void 0 : nN.reduce((xN, se) => (xN[se.key] = se.value, xN), {});
3781
+ NM.formatValues = CM;
3784
3782
  }
3785
3783
  if (a != null && a.knowledges) {
3786
- const YM = uz;
3787
- NM.knowledges = YM;
3784
+ const CM = uz;
3785
+ NM.knowledges = CM;
3788
3786
  }
3789
3787
  const GM = {
3790
3788
  text: G,
3791
3789
  fileIds: QM,
3792
3790
  files: c
3793
3791
  };
3794
- p && p.length > 0 && (GM.imageContent = p), yield t.send(GM, NM), WM({
3795
- [x]: []
3792
+ p && p.length > 0 && (GM.imageContent = p), t.ready || (yield new Promise((CM) => {
3793
+ t.addEventListener("ready", () => CM(), !0);
3794
+ })), yield t.send(GM, NM), WM({
3795
+ [E]: []
3796
3796
  }), (PM = _M.current) == null || PM.update(), cM([]), HM([]), Ne(!1);
3797
3797
  });
3798
3798
  U(() => {
@@ -3800,11 +3800,11 @@ ${t}` : t;
3800
3800
  const s = (QM = t == null ? void 0 : t.data) == null ? void 0 : QM.id;
3801
3801
  if (!s)
3802
3802
  return;
3803
- let c = null, x = null;
3803
+ let c = null, E = null;
3804
3804
  const G = () => {
3805
- c = null, x && (u([x, ...iM.current]), x = null);
3805
+ c = null, E && (u([E, ...iM.current]), E = null);
3806
3806
  }, p = () => {
3807
- c !== null && (cancelAnimationFrame(c), c = null, x = null);
3807
+ c !== null && (cancelAnimationFrame(c), c = null, E = null);
3808
3808
  }, MM = (NM) => {
3809
3809
  if (!NM.sessionId || NM.sessionId && NM.sessionId !== MN.current || NM.role === RN.User)
3810
3810
  return;
@@ -3822,7 +3822,7 @@ ${t}` : t;
3822
3822
  }
3823
3823
  const GM = NM.actions || [], TM = new we(NM.content, s, RN.Robot);
3824
3824
  if (TM.messageId = NM.messageId || me(), TM.reasoningContent = NM.reasoningContent, TM.searchReference = NM.searchReference, TM.thinkingSecs = NM.thinkingSecs, TM.thinkingStatus = NM.thinkingStatus, TM.actions = GM, TM.isLoading = !0, TM.searchingStatus = NM.searchingStatus, iM.current = iM.current.filter(($M) => !$M.isWaiting).filter(($M) => !$M.isReplying), NM.index === void 0) {
3825
- x = TM, c === null && (c = requestAnimationFrame(G));
3825
+ E = TM, c === null && (c = requestAnimationFrame(G));
3826
3826
  return;
3827
3827
  }
3828
3828
  p(), (NM.code === 11915 || NM.code === 11916) && (EN(!1), WN(!1), TM.isLoading = !1, TM.content = NM.code === 11916 ? "尊敬的用户您好,让我们换个话题再聊聊吧。" : "请您换个问题问我吧~", TM.isSensitive = !0, u([TM, ...iM.current])), NM.index === -2 && (EN(!1), WN(!1), TM.isLoading = !1, TM.content = "回答已中止~", TM.isSuspend = !0, u([TM, ...iM.current])), NM.index === -1 && (EN(!1), WN(!1), TM.isLoading = !1, TM.reference = NM.reference, u([TM, ...iM.current]), e.id && $ && $({
@@ -3851,21 +3851,21 @@ ${t}` : t;
3851
3851
  if (!w)
3852
3852
  return;
3853
3853
  const s = w.questionContextMaxLength || 4e3;
3854
- E(s);
3854
+ x(s);
3855
3855
  }, [w, R]), U(() => {
3856
- b && OM(b.text);
3856
+ b && YM(b.text);
3857
3857
  }, [b]);
3858
- const DN = (s, c, x) => {
3858
+ const DN = (s, c, E) => {
3859
3859
  sN(v, () => {
3860
3860
  gN.open({
3861
3861
  type: s,
3862
3862
  content: c,
3863
- key: x
3863
+ key: E
3864
3864
  });
3865
3865
  });
3866
3866
  }, Wt = (s) => {
3867
3867
  const c = s.size;
3868
- return c <= 0 ? (DN("error", "该文件为空,请重新上传"), !1) : c > Gj * Ij ? (DN("error", `图片须小于${Gj}M`), !1) : (cM((x) => x.length >= je ? (DN("warning", `图片最多上传${je}张`), x) : [...x, s]), !1);
3868
+ return c <= 0 ? (DN("error", "该文件为空,请重新上传"), !1) : c > Gj * Ij ? (DN("error", `图片须小于${Gj}M`), !1) : (cM((E) => E.length >= je ? (DN("warning", `图片最多上传${je}张`), E) : [...E, s]), !1);
3869
3869
  }, oz = () => {
3870
3870
  var s;
3871
3871
  return (e.type === IN.Agent && (a == null ? void 0 : a.imageUpload) || e.type === IN.Dialog && ((s = e.arrange) == null ? void 0 : s.length) && !!e.arrange[0].visionOpen && (a == null ? void 0 : a.imageUpload)) && !O;
@@ -3874,69 +3874,69 @@ ${t}` : t;
3874
3874
  const c = Array.from(s || []).filter(Boolean);
3875
3875
  if (!c.length)
3876
3876
  return;
3877
- const x = oz(), G = Cz(), p = [], MM = [];
3877
+ const E = oz(), G = Cz(), p = [], MM = [];
3878
3878
  let F = 0, QM = 0, NM = 0;
3879
- c.forEach((YM) => {
3879
+ c.forEach((CM) => {
3880
3880
  var Ti, ui, si;
3881
- if (((Ti = YM.type) == null ? void 0 : Ti.startsWith("image/")) || !!xi(YM.name)) {
3882
- x ? p.push(YM) : F++;
3881
+ if (((Ti = CM.type) == null ? void 0 : Ti.startsWith("image/")) || !!xi(CM.name)) {
3882
+ E ? p.push(CM) : F++;
3883
3883
  return;
3884
3884
  }
3885
- const se = (si = (ui = YM.name) == null ? void 0 : ui.split(".").pop()) == null ? void 0 : si.toLowerCase();
3886
- if (zD.includes(YM.type) || ["pdf", "doc", "docx"].includes(se || "")) {
3887
- G ? MM.push(YM) : QM++;
3885
+ const se = (si = (ui = CM.name) == null ? void 0 : ui.split(".").pop()) == null ? void 0 : si.toLowerCase();
3886
+ if (zD.includes(CM.type) || ["pdf", "doc", "docx"].includes(se || "")) {
3887
+ G ? MM.push(CM) : QM++;
3888
3888
  return;
3889
3889
  }
3890
3890
  NM++;
3891
3891
  });
3892
3892
  const GM = [], TM = F + QM + NM;
3893
- if (!G && !x)
3893
+ if (!G && !E)
3894
3894
  TM && GM.push(`当前不支持上传文件/图片,已忽略${TM}个文件`);
3895
- else if (G && !x) {
3896
- const YM = F + NM;
3897
- YM && GM.push(`仅支持上传 .doc/.docx/.pdf 文件,已忽略${YM}个其他类型文件`);
3898
- } else if (!G && x) {
3899
- const YM = QM + NM;
3900
- YM && GM.push(`仅支持上传图片(.jpg/.jpeg/.png/.bmp),已忽略${YM}个其他类型文件`);
3895
+ else if (G && !E) {
3896
+ const CM = F + NM;
3897
+ CM && GM.push(`仅支持上传 .doc/.docx/.pdf 文件,已忽略${CM}个其他类型文件`);
3898
+ } else if (!G && E) {
3899
+ const CM = QM + NM;
3900
+ CM && GM.push(`仅支持上传图片(.jpg/.jpeg/.png/.bmp),已忽略${CM}个其他类型文件`);
3901
3901
  } else
3902
3902
  NM && GM.push(`存在不支持的文件类型,已忽略${NM}个文件`);
3903
3903
  if (GM.length && DN("warning", GM.join(";"), "precheck-warn"), p.length) {
3904
- const YM = Math.max(0, je - J.length), xN = p.slice(0, YM);
3904
+ const CM = Math.max(0, je - J.length), xN = p.slice(0, CM);
3905
3905
  xN.forEach((se) => Wt(se)), p.length > xN.length && DN("warning", `最多上传${je}张图片`);
3906
3906
  }
3907
3907
  MM.length && ((PM = ($M = _M.current) == null ? void 0 : $M.appendFiles) == null || PM.call($M, MM));
3908
3908
  }, Rt = (s) => {
3909
- var x;
3910
- const c = (x = s.clipboardData) == null ? void 0 : x.files;
3909
+ var E;
3910
+ const c = (E = s.clipboardData) == null ? void 0 : E.files;
3911
3911
  c && c.length && (s.preventDefault(), s.stopPropagation(), Pt(c));
3912
3912
  }, Zt = (s) => {
3913
3913
  s.preventDefault();
3914
3914
  }, _t = (s) => {
3915
- var x;
3915
+ var E;
3916
3916
  s.preventDefault(), s.stopPropagation();
3917
- const c = (x = s.dataTransfer) == null ? void 0 : x.files;
3917
+ const c = (E = s.dataTransfer) == null ? void 0 : E.files;
3918
3918
  c && c.length && Pt(c);
3919
3919
  }, Jt = () => tM(void 0, null, function* () {
3920
3920
  var s;
3921
- return (s = t == null ? void 0 : t.data) != null && s.id ? t : (ue.current || (ue.current = new Promise((c, x) => {
3921
+ return (s = t == null ? void 0 : t.data) != null && s.id ? t : (ue.current || (ue.current = new Promise((c, E) => {
3922
3922
  Me(!0), D == null || D({
3923
3923
  netOpen: T ? ZN.OPEN : ZN.CLOSE
3924
3924
  }).then((G) => {
3925
3925
  var p, MM;
3926
3926
  I == null || I(G), Me(!1), A(!!((p = G.data) != null && p.netOpen)), Ye(!!((MM = G.data) != null && MM.enableNetOpen)), Uj(G), c(G);
3927
3927
  }).catch((G) => {
3928
- ue.current = null, x(G);
3928
+ ue.current = null, E(G);
3929
3929
  });
3930
3930
  })), ue.current);
3931
3931
  }), lz = (s) => tM(void 0, null, function* () {
3932
3932
  const c = yield Jt();
3933
3933
  return Oz(c, s);
3934
3934
  }), Oz = (s, c) => {
3935
- const x = xi(c.name);
3935
+ const E = xi(c.name);
3936
3936
  return new Promise((G) => {
3937
3937
  var MM;
3938
3938
  const p = {
3939
- files: [`${me()}.${x}`],
3939
+ files: [`${me()}.${E}`],
3940
3940
  isv: "minio",
3941
3941
  knowledgeId: ((MM = s.data) == null ? void 0 : MM.id) || "",
3942
3942
  type: 1
@@ -3958,15 +3958,15 @@ ${t}` : t;
3958
3958
  top: s.scrollHeight
3959
3959
  });
3960
3960
  }, [g]);
3961
- const Bt = (s, c) => new Promise((x) => {
3961
+ const Bt = (s, c) => new Promise((E) => {
3962
3962
  if (!c.file.url || !(e != null && e.id))
3963
- return x();
3963
+ return E();
3964
3964
  const G = NN(DM({}, c.file), {
3965
3965
  type: 1
3966
3966
  });
3967
3967
  R == null || R.postApplicationIdSessionKnowledgeSessionFile(e == null ? void 0 : e.id, s, G).finally(() => {
3968
3968
  var p;
3969
- (p = _M.current) == null || p.update().finally(x);
3969
+ (p = _M.current) == null || p.update().finally(E);
3970
3970
  });
3971
3971
  }), Yz = () => {
3972
3972
  var s;
@@ -3985,8 +3985,8 @@ ${t}` : t;
3985
3985
  const s = Q.current.scrollTop <= -80;
3986
3986
  Tz(s);
3987
3987
  }, Ez = Se((s) => {
3988
- var c, x;
3989
- (c = _.current) == null || c.update(s), (x = _.current) == null || x.focus();
3988
+ var c, E;
3989
+ (c = _.current) == null || c.update(s), (E = _.current) == null || E.focus();
3990
3990
  }), xz = Se((s) => {
3991
3991
  Gt(s);
3992
3992
  }), Qz = Se(() => {
@@ -4002,8 +4002,8 @@ ${t}` : t;
4002
4002
  MN.current = (s = t == null ? void 0 : t.data) == null ? void 0 : s.id, !Ut && ((c = KN.current) == null || c.clear());
4003
4003
  }, [t]);
4004
4004
  const hz = () => {
4005
- var x;
4006
- if (!((x = t == null ? void 0 : t.data) != null && x.id))
4005
+ var E;
4006
+ if (!((E = t == null ? void 0 : t.data) != null && E.id))
4007
4007
  return;
4008
4008
  const c = g[g.length - 1].messageTime;
4009
4009
  t.fetchMessages({
@@ -4018,11 +4018,11 @@ ${t}` : t;
4018
4018
  p.length < 10 ? Oe(!1) : Oe(!0), u([...g, ...p.reverse()]);
4019
4019
  });
4020
4020
  }, Sz = (s) => tM(void 0, null, function* () {
4021
- var c, x;
4021
+ var c, E;
4022
4022
  if (!((c = t == null ? void 0 : t.data) != null && c.id))
4023
4023
  A(s);
4024
4024
  else {
4025
- if (yield t.setNetOpen(s), !((x = t.data) != null && x.id))
4025
+ if (yield t.setNetOpen(s), !((E = t.data) != null && E.id))
4026
4026
  return;
4027
4027
  A(s);
4028
4028
  }
@@ -4036,7 +4036,7 @@ ${t}` : t;
4036
4036
  fj();
4037
4037
  }, [t]), U(() => {
4038
4038
  let s = null, c = null;
4039
- const x = () => {
4039
+ const E = () => {
4040
4040
  var GM, TM;
4041
4041
  if (!Q.current)
4042
4042
  return;
@@ -4059,11 +4059,11 @@ ${t}` : t;
4059
4059
  return;
4060
4060
  const p = document.getElementById("chat-main"), MM = (F = Q.current) == null ? void 0 : F.querySelector(".infinite-scroll-component");
4061
4061
  !MM || !p || (c = new ResizeObserver(() => {
4062
- x();
4062
+ E();
4063
4063
  }), c.observe(MM), c.observe(p));
4064
4064
  };
4065
4065
  return s = requestAnimationFrame(() => {
4066
- x(), G();
4066
+ E(), G();
4067
4067
  }), () => {
4068
4068
  s !== null && cancelAnimationFrame(s), c == null || c.disconnect();
4069
4069
  };
@@ -4091,8 +4091,8 @@ ${t}` : t;
4091
4091
  const Ht = () => D == null ? void 0 : D({
4092
4092
  netOpen: T ? ZN.OPEN : ZN.CLOSE
4093
4093
  }).then((s) => {
4094
- var c, x;
4095
- return I == null || I(s), Me(!1), A(!!((c = s.data) != null && c.netOpen)), Ye(!!((x = s.data) != null && x.enableNetOpen)), Uj(s), s;
4094
+ var c, E;
4095
+ return I == null || I(s), Me(!1), A(!!((c = s.data) != null && c.netOpen)), Ye(!!((E = s.data) != null && E.enableNetOpen)), Uj(s), s;
4096
4096
  }), Ft = !!g.length, Vt = Xi(() => {
4097
4097
  var s;
4098
4098
  return e.arrange && ((s = e.arrange[0]) != null && s.openingContent) ? /* @__PURE__ */ i(ID, {
@@ -4121,7 +4121,7 @@ ${t}` : t;
4121
4121
  })), U(() => {
4122
4122
  var c;
4123
4123
  const s = (c = t == null ? void 0 : t.data) == null ? void 0 : c.id;
4124
- s && WM((x) => NN(DM({}, x), {
4124
+ s && WM((E) => NN(DM({}, E), {
4125
4125
  [s]: []
4126
4126
  }));
4127
4127
  }, [(Xt = t == null ? void 0 : t.data) == null ? void 0 : Xt.id]), /* @__PURE__ */ o("div", {
@@ -4208,11 +4208,11 @@ ${t}` : t;
4208
4208
  data: zM,
4209
4209
  layoutBreakpoints: typeof (l == null ? void 0 : l.greeting) == "object" ? l.greeting.layoutBreakpoints : void 0,
4210
4210
  onItemClick: (s) => {
4211
- var x, G, p;
4212
- if (y(s == null ? void 0 : s.question), OM(s == null ? void 0 : s.question), dM)
4211
+ var E, G, p;
4212
+ if (y(s == null ? void 0 : s.question), YM(s == null ? void 0 : s.question), dM)
4213
4213
  return;
4214
4214
  s != null && s.id && fM(!0);
4215
- const c = (x = t == null ? void 0 : t.data) == null ? void 0 : x.id;
4215
+ const c = (E = t == null ? void 0 : t.data) == null ? void 0 : E.id;
4216
4216
  a != null && a.fileUpload ? (p = (G = _M.current) == null ? void 0 : G.clear()) == null || p.then(() => {
4217
4217
  var MM, F;
4218
4218
  s != null && s.id && (c ? (MM = Bt(c, s)) == null || MM.finally(() => {
@@ -4272,22 +4272,22 @@ ${t}` : t;
4272
4272
  className: "thumb-40",
4273
4273
  file: s,
4274
4274
  actions: {
4275
- upload: (x) => tM(void 0, null, function* () {
4275
+ upload: (E) => tM(void 0, null, function* () {
4276
4276
  B((G) => G + 1);
4277
4277
  try {
4278
- return yield lz(x);
4278
+ return yield lz(E);
4279
4279
  } finally {
4280
4280
  B((G) => Math.max(0, G - 1));
4281
4281
  }
4282
4282
  }),
4283
4283
  remove: () => {
4284
- cM((x) => x.filter((G, p) => p !== c)), HM((x) => x.filter((G, p) => p !== c));
4284
+ cM((E) => E.filter((G, p) => p !== c)), HM((E) => E.filter((G, p) => p !== c));
4285
4285
  }
4286
4286
  },
4287
- onUrlChange: (x) => {
4287
+ onUrlChange: (E) => {
4288
4288
  HM((G) => {
4289
4289
  const p = [...G];
4290
- return p[c] = x, p;
4290
+ return p[c] = E, p;
4291
4291
  });
4292
4292
  }
4293
4293
  }, c))
@@ -4354,22 +4354,22 @@ ${t}` : t;
4354
4354
  s !== "process" ? (qN(!0), fj()) : qN(!1);
4355
4355
  }),
4356
4356
  createSession: () => Jt().then((s) => {
4357
- var x;
4358
- return ((x = s.data) == null ? void 0 : x.id) || "";
4357
+ var E;
4358
+ return ((E = s.data) == null ? void 0 : E.id) || "";
4359
4359
  }),
4360
4360
  sid: (ii = t == null ? void 0 : t.data) == null ? void 0 : ii.id,
4361
4361
  disabled: Sj || O,
4362
4362
  afterFileAdd: (s, c) => {
4363
- c && WM((x) => {
4364
- const G = x[c] || [];
4363
+ c && WM((E) => {
4364
+ const G = E[c] || [];
4365
4365
  return {
4366
4366
  [c]: [...G, s]
4367
4367
  };
4368
4368
  });
4369
4369
  },
4370
4370
  afterFileDelete: (s) => {
4371
- var x;
4372
- const c = (x = t == null ? void 0 : t.data) == null ? void 0 : x.id;
4371
+ var E;
4372
+ const c = (E = t == null ? void 0 : t.data) == null ? void 0 : E.id;
4373
4373
  c && WM((G) => {
4374
4374
  const p = G[c] || [];
4375
4375
  return {
@@ -4393,7 +4393,7 @@ ${t}` : t;
4393
4393
  list: [],
4394
4394
  search: S ? gM : "",
4395
4395
  onPromptSelect: (s) => {
4396
- OM(s.context), y(s.context);
4396
+ YM(s.context), y(s.context);
4397
4397
  },
4398
4398
  disabled: O
4399
4399
  })]
@@ -4409,7 +4409,7 @@ ${t}` : t;
4409
4409
  }), (a == null ? void 0 : a.sessionList) && /* @__PURE__ */ i(pI, {
4410
4410
  currentSessionId: (Ii = t == null ? void 0 : t.data) == null ? void 0 : Ii.id,
4411
4411
  onSessionChange: (s, c) => {
4412
- OM(void 0), Fe(!0), I == null || I(c);
4412
+ YM(void 0), Fe(!0), I == null || I(c);
4413
4413
  },
4414
4414
  disabled: O
4415
4415
  }), jM && mM === "float" && /* @__PURE__ */ i("div", {
@@ -4465,12 +4465,12 @@ ${t}` : t;
4465
4465
  text: sM,
4466
4466
  networkStatus: !1,
4467
4467
  loading: ft || He,
4468
- disabled: CM || H || O || ft || He,
4468
+ disabled: lM || H || O || ft || He,
4469
4469
  onTextSend: Gt,
4470
4470
  onChange: (s, c) => {
4471
- OM(s);
4472
- const x = c.getText().replace(/[\n\s]+$/, "");
4473
- y(x), ZM(x), S || V(!0);
4471
+ YM(s);
4472
+ const E = c.getText().replace(/[\n\s]+$/, "");
4473
+ y(E), ZM(E), S || V(!0);
4474
4474
  },
4475
4475
  clearAction: /* @__PURE__ */ i(wM, {
4476
4476
  size: 0,
@@ -4815,7 +4815,7 @@ const $I = bN((M, N) => {
4815
4815
  stream: eM,
4816
4816
  agentClient: O,
4817
4817
  application: l
4818
- } = M, v = bM(null), [q, jM] = r(!1), [mM, W] = r(), [CM, RM] = r(t), [iM, MN] = r(M.open), BM = bM(null);
4818
+ } = M, v = bM(null), [q, jM] = r(!1), [mM, W] = r(), [lM, RM] = r(t), [iM, MN] = r(M.open), BM = bM(null);
4819
4819
  U(() => {
4820
4820
  l && (console.log("[AgentClientUI] token", O, l), W(l.id));
4821
4821
  }, [l]), Ue.config({
@@ -4823,13 +4823,13 @@ const $I = bN((M, N) => {
4823
4823
  }), U(() => {
4824
4824
  t && RM(t);
4825
4825
  }, [t]);
4826
- const E = (J, {
4826
+ const x = (J, {
4827
4827
  element: cM,
4828
- size: lM
4828
+ size: OM
4829
4829
  }) => {
4830
4830
  RM({
4831
- width: Number(lM.width),
4832
- height: lM.height
4831
+ width: Number(OM.width),
4832
+ height: OM.height
4833
4833
  });
4834
4834
  };
4835
4835
  return XN(N, () => ({
@@ -4865,11 +4865,11 @@ const $I = bN((M, N) => {
4865
4865
  features: Y
4866
4866
  }),
4867
4867
  children: [/* @__PURE__ */ i(fz, {
4868
- height: (CM == null ? void 0 : CM.height) || "100%",
4869
- width: (CM == null ? void 0 : CM.width) || "100%",
4868
+ height: (lM == null ? void 0 : lM.height) || "100%",
4869
+ width: (lM == null ? void 0 : lM.width) || "100%",
4870
4870
  maxConstraints: [document.body.clientWidth - 45],
4871
4871
  minConstraints: [Number(t == null ? void 0 : t.minWidth)],
4872
- onResize: E,
4872
+ onResize: x,
4873
4873
  handle: /* @__PURE__ */ i("span", {
4874
4874
  className: "resize-handle-ew"
4875
4875
  }),
@@ -4878,8 +4878,8 @@ const $I = bN((M, N) => {
4878
4878
  id: "dialog-modal",
4879
4879
  className: `gbot-dialog-modal ${e} ${iM ? "opened" : "closed"}`,
4880
4880
  style: NN(DM({}, t), {
4881
- width: e == "float" ? CM == null ? void 0 : CM.width : t == null ? void 0 : t.width,
4882
- height: e === "float" ? CM == null ? void 0 : CM.height : t == null ? void 0 : t.height,
4881
+ width: e == "float" ? lM == null ? void 0 : lM.width : t == null ? void 0 : t.width,
4882
+ height: e === "float" ? lM == null ? void 0 : lM.height : t == null ? void 0 : t.height,
4883
4883
  maxHeight: "100vh"
4884
4884
  }),
4885
4885
  ref: v,
@@ -4912,7 +4912,7 @@ const $I = bN((M, N) => {
4912
4912
  })]
4913
4913
  })
4914
4914
  });
4915
- }), qI = "@glodon-aiot/agent-cli-ui", Mg = "3.20.0-alpha.5", Ng = "./dist/es/index.mjs", eg = "./dist/lib/index.js", jg = "./dist/src/index.d.ts", tg = {
4915
+ }), qI = "@glodon-aiot/agent-cli-ui", Mg = "3.21.0-alpha.1", Ng = "./dist/es/index.mjs", eg = "./dist/lib/index.js", jg = "./dist/src/index.d.ts", tg = {
4916
4916
  import: "./dist/es/index.mjs",
4917
4917
  require: "./dist/lib/index.js",
4918
4918
  types: "./dist/src/index.d.ts"
@@ -4934,9 +4934,9 @@ const $I = bN((M, N) => {
4934
4934
  commit: "cz"
4935
4935
  }, gg = {
4936
4936
  "@ant-design/icons": "^5.3.4",
4937
- "@glodon-aiot/apis": "^3.20.0-alpha.5",
4938
- "@glodon-aiot/bot-client-sdk": "^3.20.0-alpha.5",
4939
- "@glodon-aiot/react-components": "^3.20.0-alpha.5",
4937
+ "@glodon-aiot/apis": "^3.21.0-alpha.1",
4938
+ "@glodon-aiot/bot-client-sdk": "^3.21.0-alpha.1",
4939
+ "@glodon-aiot/react-components": "^3.21.0-alpha.1",
4940
4940
  "@matejmazur/react-mathjax": "^0.1.10",
4941
4941
  "@react-pdf-viewer/core": "^3.12.0",
4942
4942
  "@react-pdf-viewer/default-layout": "^3.12.0",
@@ -7509,7 +7509,7 @@ const {
7509
7509
  agentClient: jM,
7510
7510
  popupContainer: mM,
7511
7511
  token: W,
7512
- apiUrl: CM
7512
+ apiUrl: lM
7513
7513
  } = VM(XM), RM = (C, B, H, d) => {
7514
7514
  const _ = {
7515
7515
  messageId: me(),
@@ -7523,7 +7523,7 @@ const {
7523
7523
  }, zM = NN(DM({}, H), {
7524
7524
  stream: !0
7525
7525
  });
7526
- ls(`${CM}/chat/v2/chat?applicationId=${C}&sessionId=${B}`, {
7526
+ ls(`${lM}/chat/v2/chat?applicationId=${C}&sessionId=${B}`, {
7527
7527
  method: "POST",
7528
7528
  headers: {
7529
7529
  Authorization: `Bearer ${W}`,
@@ -7661,7 +7661,7 @@ const {
7661
7661
  }));
7662
7662
  }), BM = (C) => {
7663
7663
  D(C.target.value);
7664
- }, E = () => tM(void 0, null, function* () {
7664
+ }, x = () => tM(void 0, null, function* () {
7665
7665
  if (!j || !q || !jM)
7666
7666
  return;
7667
7667
  u(!0);
@@ -7726,7 +7726,7 @@ const {
7726
7726
  a && (a.map((H) => {
7727
7727
  H.id === C && (H.value = B.target.value);
7728
7728
  }), b([...a]));
7729
- }, lM = (a == null ? void 0 : a.filter((C) => C.type === SM.System)) || [], HM = (a == null ? void 0 : a.filter((C) => C.type === SM.User)) || [];
7729
+ }, OM = (a == null ? void 0 : a.filter((C) => C.type === SM.System)) || [], HM = (a == null ? void 0 : a.filter((C) => C.type === SM.User)) || [];
7730
7730
  return /* @__PURE__ */ o("div", {
7731
7731
  className: "text-main",
7732
7732
  children: [/* @__PURE__ */ o("div", {
@@ -7747,9 +7747,9 @@ const {
7747
7747
  ghost: !0,
7748
7748
  className: "prompt-variables-collapse",
7749
7749
  defaultActiveKey: [SM.System, SM.User],
7750
- children: [lM.length && /* @__PURE__ */ i(_i, {
7750
+ children: [OM.length && /* @__PURE__ */ i(_i, {
7751
7751
  header: "角色设定变量",
7752
- children: lM.map((C) => /* @__PURE__ */ i(_N.Item, {
7752
+ children: OM.map((C) => /* @__PURE__ */ i(_N.Item, {
7753
7753
  label: C.name,
7754
7754
  name: ["systemPrompts", C.key],
7755
7755
  style: {
@@ -7816,7 +7816,7 @@ const {
7816
7816
  }), /* @__PURE__ */ i(LM, {
7817
7817
  type: "primary",
7818
7818
  disabled: !t || g,
7819
- onClick: E,
7819
+ onClick: x,
7820
7820
  className: "sider-btn",
7821
7821
  loading: g,
7822
7822
  children: g ? "生成中" : "确认生成"