@inupedia/spotlight-vue 0.5.17 → 0.5.19
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/assets/spotlight-vue.css +1 -1
- package/dist/components/SpotlightThinking.vue.d.ts.map +1 -1
- package/dist/components/SpotlightThinking.vue.js +1 -1
- package/dist/components/SpotlightThinking2.vue.js +352 -343
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -56
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +161 -147
- package/dist/store/pipeline/displayText.d.ts +16 -0
- package/dist/store/pipeline/displayText.d.ts.map +1 -1
- package/dist/store/pipeline/displayText.js +87 -48
- package/package.json +3 -3
|
@@ -1,96 +1,135 @@
|
|
|
1
|
-
const
|
|
1
|
+
const S = {
|
|
2
2
|
call_tools: "调用工具",
|
|
3
3
|
respond: "生成回答",
|
|
4
4
|
fallback: "兜底回复"
|
|
5
|
-
},
|
|
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
|
|
|
9
9
|
`;
|
|
10
|
-
function
|
|
10
|
+
function o(t) {
|
|
11
11
|
if (!t.trim()) return t;
|
|
12
12
|
let n = t;
|
|
13
|
-
for (const [e, i] of Object.entries(
|
|
13
|
+
for (const [e, i] of Object.entries(S))
|
|
14
14
|
n = n.replace(new RegExp(`\\b${e}\\b`, "g"), i);
|
|
15
15
|
return n;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
17
|
+
const f = /(?:\n\n+|^)(【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】[\s\S]*?)(?=\n\n(?:第 \d+ 轮:|【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】)|$)/gu, O = /【(?:Skill 已(?:加|预加)载|会话 Skill 已恢复)】/u;
|
|
18
|
+
function A(t) {
|
|
19
19
|
const n = [
|
|
20
20
|
...t.matchAll(/(?:^|\n\n)(第 \d+ 轮:[^\n]+\n原因:[^\n]+)/gu)
|
|
21
|
-
].map((
|
|
21
|
+
].map((s) => s[1]?.trim() ?? "").filter(Boolean), e = [...t.matchAll(f)].map((s) => s[1]?.trim() ?? "").filter(Boolean);
|
|
22
22
|
if (n.length === 0 && e.length === 0)
|
|
23
23
|
return { planning: "", answer: t };
|
|
24
24
|
let i = t;
|
|
25
|
-
for (const
|
|
26
|
-
i = i.replace(
|
|
25
|
+
for (const s of [...n, ...e])
|
|
26
|
+
i = i.replace(s, "");
|
|
27
27
|
return i = i.replace(/\n{3,}/g, `
|
|
28
28
|
|
|
29
29
|
`).trim(), { planning: [...n, ...e].join(`
|
|
30
30
|
|
|
31
31
|
`).trim(), answer: i };
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const n =
|
|
33
|
+
function P(t) {
|
|
34
|
+
const n = o(t).trim();
|
|
35
35
|
if (!n) return { planning: "", answer: "" };
|
|
36
|
-
const e = n.indexOf(
|
|
36
|
+
const e = n.indexOf(a);
|
|
37
37
|
return e >= 0 ? {
|
|
38
38
|
planning: n.slice(0, e).trim(),
|
|
39
|
-
answer: n.slice(e +
|
|
40
|
-
} :
|
|
39
|
+
answer: n.slice(e + a.length).trim()
|
|
40
|
+
} : A(n);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function B(t, n) {
|
|
43
43
|
const e = t.trim(), i = n.trim();
|
|
44
|
-
return e && i ? `${e}${
|
|
44
|
+
return e && i ? `${e}${a}${i}` : e || i;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const n =
|
|
46
|
+
function C(t) {
|
|
47
|
+
const n = o(t).trim();
|
|
48
48
|
if (!n) return "";
|
|
49
|
-
const { planning: e, answer: i } =
|
|
50
|
-
if (e.trim() && !n.includes(
|
|
49
|
+
const { planning: e, answer: i } = P(n);
|
|
50
|
+
if (e.trim() && !n.includes(a))
|
|
51
51
|
return "";
|
|
52
|
-
const
|
|
53
|
-
return !
|
|
52
|
+
const r = (i || (e.trim() ? "" : n)).trim();
|
|
53
|
+
return !r || O.test(r) ? "" : w(r).replace(f, "").replace(/\n{3,}/g, `
|
|
54
54
|
|
|
55
55
|
`).trim();
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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() : "";
|
|
62
68
|
}
|
|
69
|
+
const u = "正在依据资料组织回答。", p = /^\s*\d+[.、]\s+(.+)$/u, I = /^(.*?命中\s+\d+\s+条资料)/u;
|
|
63
70
|
function N(t) {
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
const n = t.trim();
|
|
72
|
+
if (!n) return null;
|
|
73
|
+
let e = "", i = n;
|
|
74
|
+
i.includes(u) && (e = u, i = i.replace(u, "").trim());
|
|
75
|
+
const r = i.split(/\n/u).map((c) => c.match(p)?.[1]?.trim() ?? "").filter(Boolean);
|
|
76
|
+
if (r.length > 0)
|
|
77
|
+
return { headline: i.split(/\n/u).map((l) => l.trim()).find((l) => l && !p.test(l))?.replace(/[::]\s*$/u, "") ?? "", items: r, note: e };
|
|
78
|
+
const s = i.match(I);
|
|
79
|
+
if (s) {
|
|
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);
|
|
81
|
+
return { headline: c, items: d, note: e };
|
|
82
|
+
}
|
|
83
|
+
return { headline: i, items: [], note: e };
|
|
84
|
+
}
|
|
85
|
+
function $(t) {
|
|
86
|
+
const n = N(t);
|
|
87
|
+
if (!n) return "";
|
|
88
|
+
const e = [n.headline];
|
|
89
|
+
return n.items.length > 0 && e.push(n.items.map((i, r) => `${r + 1}. ${i}`).join(`
|
|
90
|
+
`)), n.note && e.push(n.note), e.filter(Boolean).join(`
|
|
91
|
+
`);
|
|
92
|
+
}
|
|
93
|
+
function b(t) {
|
|
94
|
+
return t === _ || t === h || t === T;
|
|
95
|
+
}
|
|
96
|
+
function x(t) {
|
|
97
|
+
return t === E;
|
|
98
|
+
}
|
|
99
|
+
function D(t) {
|
|
100
|
+
return m.test(
|
|
101
|
+
o(t).trimStart()
|
|
66
102
|
);
|
|
67
103
|
}
|
|
68
|
-
function
|
|
69
|
-
const n =
|
|
104
|
+
function k(t) {
|
|
105
|
+
const n = o(t).trim();
|
|
70
106
|
if (!n) return { intent: "", misplacedPlanning: "" };
|
|
71
107
|
const e = n.search(/\n\n第 \d+ 轮:/u);
|
|
72
108
|
return e >= 0 ? {
|
|
73
109
|
intent: n.slice(0, e).trim(),
|
|
74
110
|
misplacedPlanning: n.slice(e).trim()
|
|
75
|
-
} :
|
|
111
|
+
} : m.test(n) ? { intent: "", misplacedPlanning: n } : { intent: n, misplacedPlanning: "" };
|
|
76
112
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
113
|
+
function G(t) {
|
|
114
|
+
return k(t).intent;
|
|
79
115
|
}
|
|
80
|
-
function
|
|
81
|
-
const n =
|
|
82
|
-
return n ? n.replace(
|
|
116
|
+
function w(t) {
|
|
117
|
+
const n = o(t).trim();
|
|
118
|
+
return n ? n.replace(L, "").trim() : "";
|
|
83
119
|
}
|
|
84
120
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
121
|
+
a as TOOL_STEP_ANSWER_DELIMITER,
|
|
122
|
+
B as composeToolStepContent,
|
|
123
|
+
$ as formatGatherProcessText,
|
|
124
|
+
G as getIntentStepDisplayContent,
|
|
125
|
+
o as humanizeSpotlightStepContent,
|
|
126
|
+
x as isAnswerStep,
|
|
127
|
+
D as isLoopPlanningChunk,
|
|
128
|
+
b as isToolExecutionStep,
|
|
129
|
+
N as parseGatherProcessDisplay,
|
|
130
|
+
C as sanitizeToolStepAnswerText,
|
|
131
|
+
k as splitIntentStepContent,
|
|
132
|
+
P as splitToolStepContent,
|
|
133
|
+
R as stripInternalEvidenceAnswer,
|
|
134
|
+
w as stripLoopPlanningBlocks
|
|
96
135
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inupedia/spotlight-vue",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.19",
|
|
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-
|
|
95
|
-
"@inupedia/spotlight-
|
|
94
|
+
"@inupedia/spotlight-protocol": "0.5.19",
|
|
95
|
+
"@inupedia/spotlight-client": "0.5.19"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@inspira-ui/plugins": "^0.0.2",
|