vome-core 0.1.42 → 0.1.45

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.
Files changed (40) hide show
  1. package/dist/admin/api/client.js +13 -1
  2. package/dist/admin/config/plugin-dev.js +1 -1
  3. package/dist/admin/crud/components/vm-richtext-extensions.js +1 -1
  4. package/dist/admin/crud/config.js +1 -1
  5. package/dist/admin/crud/confirm.js +1 -1
  6. package/dist/admin/crud/dict.js +1 -1
  7. package/dist/admin/crud/key.js +1 -1
  8. package/dist/admin/crud/mitt.js +1 -1
  9. package/dist/admin/crud/plugins.js +1 -1
  10. package/dist/admin/crud/span.js +1 -1
  11. package/dist/admin/crud/style.js +1 -1
  12. package/dist/admin/crud/validate.js +1 -1
  13. package/dist/admin/crud/vm-toolbar.vue +11 -2
  14. package/dist/admin/directives/perm.js +1 -1
  15. package/dist/admin/hooks/useUpload.js +1 -1
  16. package/dist/admin/lib/browser.js +1 -1
  17. package/dist/admin/lib/cn.js +1 -1
  18. package/dist/admin/lib/dialog-float.js +1 -1
  19. package/dist/admin/lib/export-excel.js +1 -1
  20. package/dist/admin/lib/import-excel.js +1 -1
  21. package/dist/admin/lib/json.js +1 -1
  22. package/dist/admin/lib/menu.js +1 -1
  23. package/dist/admin/lib/tree.js +1 -1
  24. package/dist/admin/lib/upload.js +1 -1
  25. package/dist/admin/lib/video-frame.js +1 -1
  26. package/dist/admin/router/index.js +8 -3
  27. package/dist/agent/index.js +16 -18
  28. package/dist/ai/index.js +79 -42
  29. package/dist/config/index.js +9 -11
  30. package/dist/index.js +1 -1
  31. package/dist/orm/service.d.ts +1 -0
  32. package/dist/server/index.js +1 -1
  33. package/dist/shared/datetime-picker.js +1 -1
  34. package/dist/shared/excel.js +1 -1
  35. package/dist/shared/index.js +1 -1
  36. package/dist/shared/locale-json.js +1 -1
  37. package/dist/shared/tree.js +1 -1
  38. package/package.json +1 -1
  39. package/typings/admin/comm/crud.d.ts +2 -0
  40. package/typings/admin/comm/crud.ts +2 -0
package/dist/ai/index.js CHANGED
@@ -19,14 +19,12 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- if (mod && typeof mod === "object" || typeof mod === "function") {
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
29
- }
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
30
28
  if (canCache)
31
29
  cache.set(mod, to);
32
30
  return to;
@@ -28476,11 +28474,44 @@ async function* chatStream(input, ctx) {
28476
28474
  let full = "";
28477
28475
  let reasoningFull = "";
28478
28476
  let lastUsage;
28477
+ const toolCallAcc = new Map;
28479
28478
  function finalizeUsage() {
28480
28479
  if (lastUsage)
28481
28480
  return lastUsage;
28482
28481
  return estimateUsageFromChat(messages, `${reasoningFull}${full}`);
28483
28482
  }
28483
+ function mergeToolCallDeltas(raw) {
28484
+ if (!Array.isArray(raw))
28485
+ return;
28486
+ for (const item of raw) {
28487
+ if (!item || typeof item !== "object")
28488
+ continue;
28489
+ const d = item;
28490
+ const index = Number(d.index ?? 0);
28491
+ const prev = toolCallAcc.get(index) || {};
28492
+ const nextFn = {
28493
+ name: d.function?.name ?? prev.function?.name,
28494
+ arguments: `${prev.function?.arguments || ""}${d.function?.arguments || ""}`
28495
+ };
28496
+ toolCallAcc.set(index, {
28497
+ id: d.id || prev.id,
28498
+ type: d.type || prev.type || "function",
28499
+ function: nextFn
28500
+ });
28501
+ }
28502
+ }
28503
+ function finalizedToolCalls() {
28504
+ if (!toolCallAcc.size)
28505
+ return;
28506
+ return [...toolCallAcc.entries()].sort((a, b) => a[0] - b[0]).map(([, v]) => ({
28507
+ id: v.id,
28508
+ type: v.type || "function",
28509
+ function: {
28510
+ name: v.function?.name || "",
28511
+ arguments: v.function?.arguments || ""
28512
+ }
28513
+ }));
28514
+ }
28484
28515
  while (true) {
28485
28516
  const { done, value } = await reader.read();
28486
28517
  if (done)
@@ -28496,6 +28527,7 @@ async function* chatStream(input, ctx) {
28496
28527
  const data = s.slice(5).trim();
28497
28528
  if (data === "[DONE]") {
28498
28529
  const usage = finalizeUsage();
28530
+ const tool_calls = finalizedToolCalls();
28499
28531
  yield {
28500
28532
  type: "done",
28501
28533
  text: full,
@@ -28503,6 +28535,7 @@ async function* chatStream(input, ctx) {
28503
28535
  data: {
28504
28536
  text: full,
28505
28537
  ...reasoningFull ? { reasoning: reasoningFull } : {},
28538
+ ...tool_calls ? { tool_calls } : {},
28506
28539
  usageEstimated: !lastUsage
28507
28540
  },
28508
28541
  usage
@@ -28519,6 +28552,8 @@ async function* chatStream(input, ctx) {
28519
28552
  full += piece;
28520
28553
  if (think)
28521
28554
  reasoningFull += think;
28555
+ if (delta.tool_calls)
28556
+ mergeToolCallDeltas(delta.tool_calls);
28522
28557
  const usage = usageFromUpstream(j.usage);
28523
28558
  if (usage)
28524
28559
  lastUsage = usage;
@@ -28539,6 +28574,7 @@ async function* chatStream(input, ctx) {
28539
28574
  }
28540
28575
  {
28541
28576
  const usage = finalizeUsage();
28577
+ const tool_calls = finalizedToolCalls();
28542
28578
  yield {
28543
28579
  type: "done",
28544
28580
  text: full,
@@ -28546,6 +28582,7 @@ async function* chatStream(input, ctx) {
28546
28582
  data: {
28547
28583
  text: full,
28548
28584
  ...reasoningFull ? { reasoning: reasoningFull } : {},
28585
+ ...tool_calls ? { tool_calls } : {},
28549
28586
  usageEstimated: !lastUsage
28550
28587
  },
28551
28588
  usage
@@ -28839,39 +28876,39 @@ function buildAiCallLogResult(payload) {
28839
28876
  return out;
28840
28877
  }
28841
28878
  export {
28842
- AI_TIMEOUT_DEFAULT_MS,
28843
- AI_TIMEOUT_SYNC_MS,
28844
- INTERNAL_BODY_KEYS,
28845
- appendFormFields,
28846
- buildAiCallLogRequest,
28847
- buildAiCallLogResult,
28848
- buildBinarySyncData,
28849
- buildSyncResult,
28850
- defaultResponseSpec,
28851
- getAiAdapter,
28852
- getJsonPath,
28853
- httpMethod,
28854
- inferAiMode,
28855
- isAiCapability,
28856
- joinUrl,
28857
- listAiProtocols,
28858
- mapUpstreamTaskStatus,
28859
- mergeAbortSignal,
28860
- mergeInput,
28861
- normalizeAiContentType,
28862
- normalizeSyncData,
28863
- pickUpstreamTaskId,
28864
- postUpstream,
28865
- postUpstreamJson,
28866
- postUpstreamMultipart,
28867
- readUpstreamError,
28868
- requireAsyncSpec,
28869
- requirePath,
28870
- resolveAiCapability,
28871
- resolveAiTimeoutMs,
28872
- resolvePath,
28873
- resolvePollUrl,
28874
- sseResponse,
28879
+ toUpstreamJson,
28875
28880
  stripAiDefaultMeta,
28876
- toUpstreamJson
28881
+ sseResponse,
28882
+ resolvePollUrl,
28883
+ resolvePath,
28884
+ resolveAiTimeoutMs,
28885
+ resolveAiCapability,
28886
+ requirePath,
28887
+ requireAsyncSpec,
28888
+ readUpstreamError,
28889
+ postUpstreamMultipart,
28890
+ postUpstreamJson,
28891
+ postUpstream,
28892
+ pickUpstreamTaskId,
28893
+ normalizeSyncData,
28894
+ normalizeAiContentType,
28895
+ mergeInput,
28896
+ mergeAbortSignal,
28897
+ mapUpstreamTaskStatus,
28898
+ listAiProtocols,
28899
+ joinUrl,
28900
+ isAiCapability,
28901
+ inferAiMode,
28902
+ httpMethod,
28903
+ getJsonPath,
28904
+ getAiAdapter,
28905
+ defaultResponseSpec,
28906
+ buildSyncResult,
28907
+ buildBinarySyncData,
28908
+ buildAiCallLogResult,
28909
+ buildAiCallLogRequest,
28910
+ appendFormFields,
28911
+ INTERNAL_BODY_KEYS,
28912
+ AI_TIMEOUT_SYNC_MS,
28913
+ AI_TIMEOUT_DEFAULT_MS
28877
28914
  };
@@ -19,14 +19,12 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- if (mod && typeof mod === "object" || typeof mod === "function") {
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
29
- }
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
30
28
  if (canCache)
31
29
  cache.set(mod, to);
32
30
  return to;
@@ -111,8 +109,8 @@ function merge(base, override) {
111
109
  return result;
112
110
  }
113
111
  export {
114
- getEnv,
115
- hasHostConfig,
112
+ provideHostConfig,
116
113
  merge,
117
- provideHostConfig
114
+ hasHostConfig,
115
+ getEnv
118
116
  };