qidian-vue-ui 1.0.82 → 1.0.83

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.
@@ -1351,6 +1351,8 @@ const isPromise = (val) => {
1351
1351
  const identifyType = (val) => {
1352
1352
  return toTypeStr(val).replace("[object ", "").replace("]", "").toLowerCase();
1353
1353
  };
1354
+ function noop() {
1355
+ }
1354
1356
  function isEmpty(val) {
1355
1357
  if (val == null) return true;
1356
1358
  if (typeof val === "string" && val.trim() === "") return true;
@@ -12606,7 +12608,42 @@ function useServicePagination({
12606
12608
  };
12607
12609
  }
12608
12610
  const __vite_import_meta_env__ = {};
12609
- __vite_import_meta_env__1?.NODE_ENV !== "production" || __vite_import_meta_env__ && false;
12611
+ const cslType = ["log", "warn", "error"];
12612
+ const isDev = __vite_import_meta_env__1?.NODE_ENV !== "production" || __vite_import_meta_env__ && false;
12613
+ function useCsl(module2) {
12614
+ const toStr = (data) => {
12615
+ if (typeof data === "object") return data.join(".");
12616
+ if (typeof data === "number") return data.toString();
12617
+ return data;
12618
+ };
12619
+ module2 = toStr(module2);
12620
+ const getModule = (childModule) => {
12621
+ if (isEmpty(childModule)) return `[${module2}]`;
12622
+ childModule = toStr(childModule);
12623
+ if (childModule) childModule = "." + childModule;
12624
+ return `[${module2}${childModule}]`;
12625
+ };
12626
+ const core2 = (type = "log", childModule, ...rest) => {
12627
+ if (isEmpty(rest)) {
12628
+ console[type](getModule(), childModule);
12629
+ return;
12630
+ }
12631
+ console[type](getModule(childModule), ...rest);
12632
+ };
12633
+ const csl2 = {
12634
+ useNext(childModule) {
12635
+ return useCsl(getModule(childModule).replace(/\[|\]/g, ""));
12636
+ }
12637
+ };
12638
+ cslType.forEach((item) => {
12639
+ const temp = (childModule, ...rest) => {
12640
+ core2(item, childModule, ...rest);
12641
+ };
12642
+ temp.dev = isDev ? temp : noop;
12643
+ csl2[item] = temp;
12644
+ });
12645
+ return csl2;
12646
+ }
12610
12647
  function useTimer(type = "timeout") {
12611
12648
  const timer = vue.ref(null);
12612
12649
  const clearTimer = () => {
@@ -12691,8 +12728,8 @@ const QdConfigProvider = vue.defineComponent({
12691
12728
  vue.watchEffect(async () => {
12692
12729
  const localeMap = {
12693
12730
  "zh-CN": () => Promise.resolve().then(() => zhCN$1),
12694
- "zh-TW": () => Promise.resolve().then(() => require("./zh-TW-OiGfhtFy.js")),
12695
- "en-US": () => Promise.resolve().then(() => require("./en-US-DPSYm20A.js"))
12731
+ "zh-TW": () => Promise.resolve().then(() => require("./zh-TW-1dtDvCc9.js")),
12732
+ "en-US": () => Promise.resolve().then(() => require("./en-US-_vWm0Hkp.js"))
12696
12733
  };
12697
12734
  const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
12698
12735
  const [err, res] = await to(
@@ -17354,6 +17391,7 @@ function defaultOnOpen(response) {
17354
17391
  throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
17355
17392
  }
17356
17393
  }
17394
+ const csl = useCsl("useAgentChat");
17357
17395
  function useAgentChat(options) {
17358
17396
  const globalOpt = window.__QIDIAN_AGENT_CHAT__ || {};
17359
17397
  const mergeOpt = { ...globalOpt, ...options };
@@ -17389,10 +17427,11 @@ function useAgentChat(options) {
17389
17427
  const getUrl = mergeOpt.getUrl;
17390
17428
  if (!getUrl) {
17391
17429
  loading.value = false;
17392
- console.error("[useAgentChat] 必须配置 getUrl 函数");
17430
+ console.error("[useAgentChat.getUrl] 必须配置 getUrl 函数");
17393
17431
  return allData;
17394
17432
  }
17395
17433
  abortController = new AbortController();
17434
+ csl.log.dev("send", { ...agInfo, sessionId: sId });
17396
17435
  return new Promise((resolve, reject) => {
17397
17436
  fetchEventSource(getUrl(agInfo.agentId, sId), {
17398
17437
  method: "POST",
@@ -17411,6 +17450,7 @@ function useAgentChat(options) {
17411
17450
  ...extParams
17412
17451
  }),
17413
17452
  onopen: async (res) => {
17453
+ csl.log.dev("onOpen", res);
17414
17454
  await onOpen?.(res);
17415
17455
  },
17416
17456
  onmessage: (res) => {
@@ -17421,16 +17461,19 @@ function useAgentChat(options) {
17421
17461
  if (reData.content) allData.content += reData.content;
17422
17462
  if (reData.reasoning) allData.reasoning += reData.reasoning;
17423
17463
  } catch (err) {
17424
- console.warn("[useAgentChat.send.onmessage]", err);
17464
+ console.warn("[useAgentChat.send.onMessage]", err);
17425
17465
  }
17466
+ csl.log.dev("onMessage", reData);
17426
17467
  onMessage?.({ data: reData, allData });
17427
17468
  },
17428
17469
  onclose: () => {
17470
+ csl.log.dev("onClose", allData);
17429
17471
  loading.value = false;
17430
17472
  onClose?.(allData);
17431
17473
  resolve(allData);
17432
17474
  },
17433
17475
  onerror: (err) => {
17476
+ csl.log.dev("onError", err);
17434
17477
  loading.value = false;
17435
17478
  onError?.(err);
17436
17479
  reject(err);
@@ -17472,6 +17515,7 @@ function useAgentChat(options) {
17472
17515
  }
17473
17516
  const [err, res] = await suspectedWrapperPromise(getFn(agentId2, apiKey2));
17474
17517
  if (err) return;
17518
+ sessionId.value = res;
17475
17519
  return res;
17476
17520
  }
17477
17521
  return {
@@ -19988,4 +20032,4 @@ exports.useDictDynamic = useDictDynamic;
19988
20032
  exports.useDisabled = useDisabled;
19989
20033
  exports.useModal = useModal;
19990
20034
  exports.useReadonly = useReadonly;
19991
- //# sourceMappingURL=index-BdtBNVcI.js.map
20035
+ //# sourceMappingURL=index-LWHwXGdo.js.map