@inupedia/spotlight-vue 0.5.18 → 0.6.0

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.
@@ -2,7 +2,7 @@ const S = {
2
2
  call_tools: "调用工具",
3
3
  respond: "生成回答",
4
4
  fallback: "兜底回复"
5
- }, _ = "3", T = "gather", h = "act", E = "answer", m = /^第 \d+ 轮:/u, L = /(?:\n\n+)?第 \d+ 轮:[\s\S]*?(?=\n\n第 \d+ 轮:|$)/gu, a = `
5
+ }, T = "3", _ = "gather", h = "act", E = "answer", m = /^第 \d+ 轮:/u, L = /(?:\n\n+)?第 \d+ 轮:[\s\S]*?(?=\n\n第 \d+ 轮:|$)/gu, a = `
6
6
 
7
7
  --- spotlight-answer ---
8
8
 
@@ -15,7 +15,7 @@ function o(t) {
15
15
  return n;
16
16
  }
17
17
  const f = /(?:\n\n+|^)(【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】[\s\S]*?)(?=\n\n(?:第 \d+ 轮:|【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】)|$)/gu, O = /【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】/u;
18
- function P(t) {
18
+ function A(t) {
19
19
  const n = [
20
20
  ...t.matchAll(/(?:^|\n\n)(第 \d+ 轮:[^\n]+\n原因:[^\n]+)/gu)
21
21
  ].map((s) => s[1]?.trim() ?? "").filter(Boolean), e = [...t.matchAll(f)].map((s) => s[1]?.trim() ?? "").filter(Boolean);
@@ -30,32 +30,44 @@ function P(t) {
30
30
 
31
31
  `).trim(), answer: i };
32
32
  }
33
- function A(t) {
33
+ function P(t) {
34
34
  const n = o(t).trim();
35
35
  if (!n) return { planning: "", answer: "" };
36
36
  const e = n.indexOf(a);
37
37
  return e >= 0 ? {
38
38
  planning: n.slice(0, e).trim(),
39
39
  answer: n.slice(e + a.length).trim()
40
- } : P(n);
40
+ } : A(n);
41
41
  }
42
- function C(t, n) {
42
+ function B(t, n) {
43
43
  const e = t.trim(), i = n.trim();
44
44
  return e && i ? `${e}${a}${i}` : e || i;
45
45
  }
46
- function R(t) {
46
+ function C(t) {
47
47
  const n = o(t).trim();
48
48
  if (!n) return "";
49
- const { planning: e, answer: i } = A(n);
49
+ const { planning: e, answer: i } = P(n);
50
50
  if (e.trim() && !n.includes(a))
51
51
  return "";
52
52
  const r = (i || (e.trim() ? "" : n)).trim();
53
- return !r || O.test(r) ? "" : B(r).replace(f, "").replace(/\n{3,}/g, `
53
+ return !r || O.test(r) ? "" : w(r).replace(f, "").replace(/\n{3,}/g, `
54
54
 
55
55
  `).trim();
56
56
  }
57
- const u = "正在依据资料组织回答。", p = /^\s*\d+[.、]\s+(.+)$/u, N = /^(.*?命中\s+\d+\s+条资料)/u;
58
- function I(t) {
57
+ function R(t) {
58
+ const n = t.trim();
59
+ return n ? n.replace(/^联网检索证据:\s*/u, "").split(/\n/u).map(
60
+ (e) => e.replace(
61
+ /(?:^[-*]\s*)?(?:Tavily answer|Hikari answer|Yuxi project knowledge|Spotlight knowledge)\s*[::]\s*/giu,
62
+ ""
63
+ )
64
+ ).join(`
65
+ `).replace(/\n{3,}/g, `
66
+
67
+ `).trim() : "";
68
+ }
69
+ const u = "正在依据资料组织回答。", p = /^\s*\d+[.、]\s+(.+)$/u, I = /^(.*?命中\s+\d+\s+条资料)/u;
70
+ function N(t) {
59
71
  const n = t.trim();
60
72
  if (!n) return null;
61
73
  let e = "", i = n;
@@ -63,7 +75,7 @@ function I(t) {
63
75
  const r = i.split(/\n/u).map((c) => c.match(p)?.[1]?.trim() ?? "").filter(Boolean);
64
76
  if (r.length > 0)
65
77
  return { headline: i.split(/\n/u).map((l) => l.trim()).find((l) => l && !p.test(l))?.replace(/[::]\s*$/u, "") ?? "", items: r, note: e };
66
- const s = i.match(N);
78
+ const s = i.match(I);
67
79
  if (s) {
68
80
  const c = s[1].trim(), d = i.slice(s[0].length).replace(/^[::]\s*/u, "").trim().replace(/[。..]\s*$/u, "").split(/[;;]\s*/u).map((g) => g.trim()).filter(Boolean);
69
81
  return { headline: c, items: d, note: e };
@@ -71,17 +83,17 @@ function I(t) {
71
83
  return { headline: i, items: [], note: e };
72
84
  }
73
85
  function $(t) {
74
- const n = I(t);
86
+ const n = N(t);
75
87
  if (!n) return "";
76
88
  const e = [n.headline];
77
89
  return n.items.length > 0 && e.push(n.items.map((i, r) => `${r + 1}. ${i}`).join(`
78
90
  `)), n.note && e.push(n.note), e.filter(Boolean).join(`
79
91
  `);
80
92
  }
81
- function w(t) {
82
- return t === T || t === h || t === _;
83
- }
84
93
  function b(t) {
94
+ return t === _ || t === h || t === T;
95
+ }
96
+ function x(t) {
85
97
  return t === E;
86
98
  }
87
99
  function D(t) {
@@ -98,25 +110,26 @@ function k(t) {
98
110
  misplacedPlanning: n.slice(e).trim()
99
111
  } : m.test(n) ? { intent: "", misplacedPlanning: n } : { intent: n, misplacedPlanning: "" };
100
112
  }
101
- function x(t) {
113
+ function G(t) {
102
114
  return k(t).intent;
103
115
  }
104
- function B(t) {
116
+ function w(t) {
105
117
  const n = o(t).trim();
106
118
  return n ? n.replace(L, "").trim() : "";
107
119
  }
108
120
  export {
109
121
  a as TOOL_STEP_ANSWER_DELIMITER,
110
- C as composeToolStepContent,
122
+ B as composeToolStepContent,
111
123
  $ as formatGatherProcessText,
112
- x as getIntentStepDisplayContent,
124
+ G as getIntentStepDisplayContent,
113
125
  o as humanizeSpotlightStepContent,
114
- b as isAnswerStep,
126
+ x as isAnswerStep,
115
127
  D as isLoopPlanningChunk,
116
- w as isToolExecutionStep,
117
- I as parseGatherProcessDisplay,
118
- R as sanitizeToolStepAnswerText,
128
+ b as isToolExecutionStep,
129
+ N as parseGatherProcessDisplay,
130
+ C as sanitizeToolStepAnswerText,
119
131
  k as splitIntentStepContent,
120
- A as splitToolStepContent,
121
- B as stripLoopPlanningBlocks
132
+ P as splitToolStepContent,
133
+ R as stripInternalEvidenceAnswer,
134
+ w as stripLoopPlanningBlocks
122
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inupedia/spotlight-vue",
3
- "version": "0.5.18",
3
+ "version": "0.6.0",
4
4
  "description": "Thin Vue runtime for Inupedia Spotlight Client Tools",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -91,8 +91,8 @@
91
91
  "dependencies": {
92
92
  "prettier": "^3.8.1",
93
93
  "yaml": "^2.8.4",
94
- "@inupedia/spotlight-client": "0.5.18",
95
- "@inupedia/spotlight-protocol": "0.5.18"
94
+ "@inupedia/spotlight-protocol": "0.6.0",
95
+ "@inupedia/spotlight-client": "0.6.0"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@inspira-ui/plugins": "^0.0.2",