agent-tool-chat 0.1.1 → 1.0.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.
- package/README.md +126 -7
- package/dist/agent-core/agent.d.ts +29 -0
- package/dist/agent-core/index.d.ts +7 -0
- package/dist/agent-core/provider.d.ts +12 -0
- package/dist/agent-core/storage.d.ts +6 -0
- package/dist/agent-core/tool-registry.d.ts +12 -0
- package/dist/agent-core/types.d.ts +72 -0
- package/dist/agent-tool-chat.css +1 -0
- package/dist/api/deepseek.d.ts +2 -0
- package/dist/api/proxy.d.ts +2 -0
- package/dist/components/ChatInput.vue.d.ts +14 -0
- package/dist/components/ChatMessage.vue.d.ts +15 -0
- package/dist/components/ChatPanel.vue.d.ts +28 -0
- package/dist/components/ChatSettings.vue.d.ts +14 -0
- package/dist/components/RenderBlock.vue.d.ts +12 -0
- package/dist/components/SuggestedNext.vue.d.ts +9 -0
- package/dist/composables/useAgentChat.d.ts +120 -0
- package/dist/config.d.ts +4 -0
- package/dist/core/context-builder.d.ts +2 -0
- package/dist/core/event-bus.d.ts +14 -0
- package/dist/core/event-engine.d.ts +20 -0
- package/dist/core/render-resolver.d.ts +9 -0
- package/dist/index.cjs +22 -21
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1377 -896
- package/dist/types.d.ts +121 -0
- package/dist/utils/parseUtils.d.ts +6 -0
- package/package.json +13 -7
- package/dist/style.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as W, computed as
|
|
5
|
-
import {
|
|
6
|
-
class
|
|
1
|
+
var Pe = Object.defineProperty;
|
|
2
|
+
var Te = (t, e, s) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var K = (t, e, s) => Te(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { ref as W, onUnmounted as ze, computed as te, onMounted as Be, watch as le, defineComponent as F, openBlock as u, createElementBlock as x, createElementVNode as y, resolveComponent as P, toDisplayString as L, createCommentVNode as R, createBlock as D, resolveDynamicComponent as He, Fragment as G, renderList as X, createVNode as p, unref as S, withCtx as v, createTextVNode as O, normalizeClass as ie, withKeys as Ne, withDirectives as Ee, Transition as De, vShow as Fe, nextTick as je } from "vue";
|
|
5
|
+
import { ElTable as Oe, ElTableColumn as _e, ElMessageBox as Ue } from "element-plus";
|
|
6
|
+
class Re {
|
|
7
7
|
constructor(e) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.config = { ...e, maxToolRounds: (s = e.maxToolRounds) != null ? s : 6 };
|
|
8
|
+
K(this, "messages", []);
|
|
9
|
+
K(this, "config");
|
|
10
|
+
K(this, "listeners", /* @__PURE__ */ new Set());
|
|
11
|
+
K(this, "abortController", null);
|
|
12
|
+
K(this, "_loading", !1);
|
|
13
|
+
this.config = { ...e, maxToolRounds: e.maxToolRounds ?? 6 };
|
|
15
14
|
}
|
|
16
15
|
get loading() {
|
|
17
16
|
return this._loading;
|
|
@@ -33,55 +32,54 @@ class he {
|
|
|
33
32
|
this.listeners.forEach((s) => s(e));
|
|
34
33
|
}
|
|
35
34
|
async sendMessage(e) {
|
|
36
|
-
var
|
|
35
|
+
var o;
|
|
37
36
|
const s = e.trim();
|
|
38
|
-
if (!s || this._loading)
|
|
39
|
-
return;
|
|
37
|
+
if (!s || this._loading) return;
|
|
40
38
|
this._loading = !0, this.abortController = new AbortController(), this.emit({ type: "status", loading: !0 });
|
|
41
|
-
const
|
|
42
|
-
this.messages.push(
|
|
39
|
+
const i = { role: "user", content: s };
|
|
40
|
+
this.messages.push(i), this.emit({ type: "message", message: i });
|
|
43
41
|
try {
|
|
44
42
|
let l = 0;
|
|
45
|
-
const
|
|
46
|
-
for (; l <
|
|
43
|
+
const _ = this.config.maxToolRounds;
|
|
44
|
+
for (; l < _; ) {
|
|
47
45
|
l++;
|
|
48
|
-
const
|
|
49
|
-
this.messages.push(
|
|
50
|
-
const
|
|
46
|
+
const b = { role: "assistant", content: "" };
|
|
47
|
+
this.messages.push(b), this.emit({ type: "message", message: b });
|
|
48
|
+
const a = this.buildApiMessages(), r = await this.config.provider.streamChat({
|
|
51
49
|
config: this.config.providerConfig,
|
|
52
|
-
messages:
|
|
50
|
+
messages: a,
|
|
53
51
|
tools: this.config.tools.getDefinitions(),
|
|
54
52
|
signal: this.abortController.signal,
|
|
55
|
-
onContent: (
|
|
56
|
-
|
|
53
|
+
onContent: (h) => {
|
|
54
|
+
b.content += h, this.emit({ type: "stream:delta", delta: { content: h } });
|
|
57
55
|
},
|
|
58
|
-
onReasoning: (
|
|
59
|
-
this.emit({ type: "stream:delta", delta: { reasoning:
|
|
56
|
+
onReasoning: (h) => {
|
|
57
|
+
this.emit({ type: "stream:delta", delta: { reasoning: h } });
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
for (const
|
|
65
|
-
this.emit({ type: "tool:start", call:
|
|
66
|
-
const
|
|
67
|
-
this.emit({ type: "tool:end", call:
|
|
60
|
+
if (b.content = r.content, this.emit({ type: "stream:end", content: r.content, reasoning: r.reasoning }), r.tool_calls.length > 0) {
|
|
61
|
+
b.tool_calls = r.tool_calls;
|
|
62
|
+
for (const h of r.tool_calls) {
|
|
63
|
+
this.emit({ type: "tool:start", call: h });
|
|
64
|
+
const m = await this.config.tools.execute(h.function.name, h.function.arguments);
|
|
65
|
+
this.emit({ type: "tool:end", call: h, output: m }), this.messages.push({
|
|
68
66
|
role: "tool",
|
|
69
|
-
tool_call_id:
|
|
70
|
-
content:
|
|
71
|
-
name:
|
|
67
|
+
tool_call_id: h.id,
|
|
68
|
+
content: m.result,
|
|
69
|
+
name: h.function.name
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
72
|
continue;
|
|
75
73
|
}
|
|
76
74
|
break;
|
|
77
75
|
}
|
|
78
|
-
await ((
|
|
76
|
+
await ((o = this.config.storage) == null ? void 0 : o.save(this.messages));
|
|
79
77
|
} catch (l) {
|
|
80
78
|
if ((l == null ? void 0 : l.name) !== "AbortError")
|
|
81
|
-
this.emit({ type: "error", error: (l == null ? void 0 : l.message) || "
|
|
79
|
+
this.emit({ type: "error", error: (l == null ? void 0 : l.message) || "请求出错" });
|
|
82
80
|
else {
|
|
83
|
-
const
|
|
84
|
-
(
|
|
81
|
+
const _ = this.messages[this.messages.length - 1];
|
|
82
|
+
(_ == null ? void 0 : _.role) === "assistant" && !_.content && (_.content = "(已停止生成)");
|
|
85
83
|
}
|
|
86
84
|
} finally {
|
|
87
85
|
this._loading = !1, this.abortController = null, this.emit({ type: "status", loading: !1 });
|
|
@@ -92,152 +90,351 @@ class he {
|
|
|
92
90
|
(e = this.abortController) == null || e.abort();
|
|
93
91
|
}
|
|
94
92
|
buildApiMessages() {
|
|
95
|
-
const e = this.messages,
|
|
96
|
-
return this.config.systemPrompt ? [{ role: "system", content: this.config.systemPrompt }, ...
|
|
93
|
+
const e = this.messages, i = e.length > 0 && e[e.length - 1].role === "assistant" && e[e.length - 1].content === "" && !e[e.length - 1].tool_calls ? e.slice(0, -1) : e;
|
|
94
|
+
return this.config.systemPrompt ? [{ role: "system", content: this.config.systemPrompt }, ...i] : [...i];
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
class
|
|
97
|
+
class Ke {
|
|
100
98
|
constructor() {
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
K(this, "_definitions", []);
|
|
100
|
+
K(this, "_handlers", /* @__PURE__ */ new Map());
|
|
103
101
|
}
|
|
104
102
|
register(e, s) {
|
|
105
103
|
return this._definitions.push(e), this._handlers.set(e.function.name, s), this;
|
|
106
104
|
}
|
|
107
105
|
registerBatch(e) {
|
|
108
|
-
for (const s of e)
|
|
109
|
-
this.register(s.definition, s.handler);
|
|
106
|
+
for (const s of e) this.register(s.definition, s.handler);
|
|
110
107
|
return this;
|
|
111
108
|
}
|
|
112
109
|
getDefinitions() {
|
|
113
110
|
return [...this._definitions];
|
|
114
111
|
}
|
|
115
112
|
async execute(e, s) {
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
118
|
-
return { success: !1, result: `\u672A\u77E5\u5DE5\u5177\uFF1A${e}` };
|
|
113
|
+
const i = this._handlers.get(e);
|
|
114
|
+
if (!i) return { success: !1, result: `未知工具:${e}` };
|
|
119
115
|
try {
|
|
120
|
-
const
|
|
121
|
-
return await
|
|
122
|
-
} catch (
|
|
123
|
-
return { success: !1, result:
|
|
116
|
+
const o = s ? JSON.parse(s) : {};
|
|
117
|
+
return await i(o);
|
|
118
|
+
} catch (o) {
|
|
119
|
+
return { success: !1, result: `工具执行异常:${(o == null ? void 0 : o.message) || String(o)}` };
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
|
-
function
|
|
123
|
+
function Le(t) {
|
|
128
124
|
let e = t.trim().replace(/\/+$/, "");
|
|
129
125
|
return e = e.replace(/\/v1$/, ""), e;
|
|
130
126
|
}
|
|
131
|
-
function
|
|
127
|
+
function Je() {
|
|
132
128
|
return {
|
|
133
129
|
async streamChat(t) {
|
|
134
|
-
var
|
|
130
|
+
var g;
|
|
135
131
|
const {
|
|
136
|
-
config: { baseUrl: e, apiKey: s, model:
|
|
132
|
+
config: { baseUrl: e, apiKey: s, model: i, temperature: o },
|
|
137
133
|
messages: l,
|
|
138
|
-
tools:
|
|
139
|
-
signal:
|
|
140
|
-
onContent:
|
|
141
|
-
onReasoning:
|
|
134
|
+
tools: _,
|
|
135
|
+
signal: b,
|
|
136
|
+
onContent: a,
|
|
137
|
+
onReasoning: r
|
|
142
138
|
} = t;
|
|
143
|
-
if (!s)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const C = await fetch(g, {
|
|
139
|
+
if (!s) throw new Error("未配置 API Key");
|
|
140
|
+
const h = `${Le(e)}/chat/completions`, m = { model: i, messages: l, stream: !0 };
|
|
141
|
+
typeof o == "number" && (m.temperature = o), _ != null && _.length && (m.tools = _, m.tool_choice = "auto");
|
|
142
|
+
const $ = await fetch(h, {
|
|
148
143
|
method: "POST",
|
|
149
144
|
headers: {
|
|
150
145
|
"Content-Type": "application/json",
|
|
151
146
|
Authorization: `Bearer ${s}`
|
|
152
147
|
},
|
|
153
|
-
body: JSON.stringify(
|
|
154
|
-
signal:
|
|
148
|
+
body: JSON.stringify(m),
|
|
149
|
+
signal: b
|
|
150
|
+
});
|
|
151
|
+
if (!$.ok || !$.body) {
|
|
152
|
+
let f = `请求失败(HTTP ${$.status})`;
|
|
153
|
+
try {
|
|
154
|
+
const d = await $.json();
|
|
155
|
+
(g = d == null ? void 0 : d.error) != null && g.message && (f = d.error.message);
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
throw new Error(f);
|
|
159
|
+
}
|
|
160
|
+
const H = $.body.getReader(), I = new TextDecoder("utf-8");
|
|
161
|
+
let A = "", w = "", T = "", z = "stop";
|
|
162
|
+
const j = /* @__PURE__ */ new Map(), J = (f) => {
|
|
163
|
+
if (!f) return;
|
|
164
|
+
const d = f.index ?? 0;
|
|
165
|
+
j.has(d) || j.set(d, { id: "", type: "function", function: { name: "", arguments: "" } });
|
|
166
|
+
const V = j.get(d);
|
|
167
|
+
f.id && (V.id = f.id), f.type && (V.type = f.type), f.function && (f.function.name && (V.function.name += f.function.name), f.function.arguments && (V.function.arguments += f.function.arguments));
|
|
168
|
+
}, U = (f) => {
|
|
169
|
+
var E;
|
|
170
|
+
const d = (E = f == null ? void 0 : f.choices) == null ? void 0 : E[0];
|
|
171
|
+
if (!d) return;
|
|
172
|
+
const V = d.delta || {};
|
|
173
|
+
typeof V.content == "string" && V.content && (w += V.content, a == null || a(V.content)), typeof V.reasoning_content == "string" && V.reasoning_content && (T += V.reasoning_content, r == null || r(V.reasoning_content)), Array.isArray(V.tool_calls) && V.tool_calls.forEach((Y) => J(Y)), d.finish_reason && (z = d.finish_reason);
|
|
174
|
+
};
|
|
175
|
+
for (; ; ) {
|
|
176
|
+
const { done: f, value: d } = await H.read();
|
|
177
|
+
if (f) break;
|
|
178
|
+
A += I.decode(d, { stream: !0 });
|
|
179
|
+
let V;
|
|
180
|
+
for (; (V = A.indexOf(`
|
|
181
|
+
`)) !== -1; ) {
|
|
182
|
+
const E = A.slice(0, V).replace(/\r$/, "").trim();
|
|
183
|
+
if (A = A.slice(V + 1), !E || E.startsWith(":") || !E.startsWith("data:")) continue;
|
|
184
|
+
const Y = E.slice(5).trim();
|
|
185
|
+
if (Y === "[DONE]") return N();
|
|
186
|
+
try {
|
|
187
|
+
U(JSON.parse(Y));
|
|
188
|
+
} catch {
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return N();
|
|
193
|
+
function N() {
|
|
194
|
+
const f = Array.from(j.values()).filter((d) => d.function.name);
|
|
195
|
+
return { content: w, reasoning: T, tool_calls: f, finish_reason: z };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function We() {
|
|
201
|
+
return {
|
|
202
|
+
async streamChat(t) {
|
|
203
|
+
var N;
|
|
204
|
+
const {
|
|
205
|
+
config: { baseUrl: e, model: s, temperature: i },
|
|
206
|
+
messages: o,
|
|
207
|
+
tools: l,
|
|
208
|
+
signal: _,
|
|
209
|
+
onContent: b,
|
|
210
|
+
onReasoning: a
|
|
211
|
+
} = t, r = `${e.trim().replace(/\/+$/, "")}`, h = { model: s, messages: o, stream: !0 };
|
|
212
|
+
typeof i == "number" && (h.temperature = i), l != null && l.length && (h.tools = l, h.tool_choice = "auto");
|
|
213
|
+
const m = await fetch(r, {
|
|
214
|
+
method: "POST",
|
|
215
|
+
headers: { "Content-Type": "application/json" },
|
|
216
|
+
body: JSON.stringify(h),
|
|
217
|
+
signal: _
|
|
155
218
|
});
|
|
156
|
-
if (!
|
|
157
|
-
let
|
|
219
|
+
if (!m.ok || !m.body) {
|
|
220
|
+
let g = `请求失败(HTTP ${m.status})`;
|
|
158
221
|
try {
|
|
159
|
-
const
|
|
160
|
-
(
|
|
222
|
+
const f = await m.json();
|
|
223
|
+
(N = f == null ? void 0 : f.error) != null && N.message && (g = f.error.message);
|
|
161
224
|
} catch {
|
|
162
225
|
}
|
|
163
|
-
throw new Error(
|
|
226
|
+
throw new Error(g);
|
|
164
227
|
}
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
return;
|
|
180
|
-
const D = I.delta || {};
|
|
181
|
-
typeof D.content == "string" && D.content && (h += D.content, u == null || u(D.content)), typeof D.reasoning_content == "string" && D.reasoning_content && (w += D.reasoning_content, n == null || n(D.reasoning_content)), Array.isArray(D.tool_calls) && D.tool_calls.forEach((X) => H(X)), I.finish_reason && (F = I.finish_reason);
|
|
228
|
+
const $ = m.body.getReader(), H = new TextDecoder("utf-8");
|
|
229
|
+
let I = "", A = "", w = "", T = "stop";
|
|
230
|
+
const z = /* @__PURE__ */ new Map(), j = (g) => {
|
|
231
|
+
if (!g) return;
|
|
232
|
+
const f = g.index ?? 0;
|
|
233
|
+
z.has(f) || z.set(f, { id: "", type: "function", function: { name: "", arguments: "" } });
|
|
234
|
+
const d = z.get(f);
|
|
235
|
+
g.id && (d.id = g.id), g.type && (d.type = g.type), g.function && (g.function.name && (d.function.name += g.function.name), g.function.arguments && (d.function.arguments += g.function.arguments));
|
|
236
|
+
}, J = (g) => {
|
|
237
|
+
var V;
|
|
238
|
+
const f = (V = g == null ? void 0 : g.choices) == null ? void 0 : V[0];
|
|
239
|
+
if (!f) return;
|
|
240
|
+
const d = f.delta || {};
|
|
241
|
+
typeof d.content == "string" && d.content && (A += d.content, b == null || b(d.content)), typeof d.reasoning_content == "string" && d.reasoning_content && (w += d.reasoning_content, a == null || a(d.reasoning_content)), Array.isArray(d.tool_calls) && d.tool_calls.forEach((E) => j(E)), f.finish_reason && (T = f.finish_reason);
|
|
182
242
|
};
|
|
183
243
|
for (; ; ) {
|
|
184
|
-
const { done:
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
for (; (D = T.indexOf(`
|
|
244
|
+
const { done: g, value: f } = await $.read();
|
|
245
|
+
if (g) break;
|
|
246
|
+
I += H.decode(f, { stream: !0 });
|
|
247
|
+
let d;
|
|
248
|
+
for (; (d = I.indexOf(`
|
|
190
249
|
`)) !== -1; ) {
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (X === "[DONE]")
|
|
196
|
-
return q();
|
|
250
|
+
const V = I.slice(0, d).replace(/\r$/, "").trim();
|
|
251
|
+
if (I = I.slice(d + 1), !V || V.startsWith(":") || !V.startsWith("data:")) continue;
|
|
252
|
+
const E = V.slice(5).trim();
|
|
253
|
+
if (E === "[DONE]") return U();
|
|
197
254
|
try {
|
|
198
|
-
J(JSON.parse(
|
|
255
|
+
J(JSON.parse(E));
|
|
199
256
|
} catch {
|
|
200
257
|
}
|
|
201
258
|
}
|
|
202
259
|
}
|
|
203
|
-
return
|
|
204
|
-
function
|
|
205
|
-
const
|
|
206
|
-
return { content:
|
|
260
|
+
return U();
|
|
261
|
+
function U() {
|
|
262
|
+
const g = Array.from(z.values()).filter((f) => f.function.name);
|
|
263
|
+
return { content: A, reasoning: w, tool_calls: g, finish_reason: T };
|
|
207
264
|
}
|
|
208
265
|
}
|
|
209
266
|
};
|
|
210
267
|
}
|
|
211
|
-
function
|
|
212
|
-
var s,
|
|
268
|
+
function qe(t) {
|
|
269
|
+
var s, i, o, l, _;
|
|
213
270
|
const e = [];
|
|
214
|
-
return (s = t.displayHints) != null && s.suggestComponent && e.push(
|
|
271
|
+
return (s = t.displayHints) != null && s.suggestComponent && e.push(`展示建议: 使用 ${t.displayHints.suggestComponent} 组件`), (i = t.displayHints) != null && i.resultFormat && e.push(`格式: ${t.displayHints.resultFormat}`), (l = (o = t.displayHints) == null ? void 0 : o.previewFields) != null && l.length && e.push(`预览字段: ${t.displayHints.previewFields.join(", ")}`), (_ = t.displayHints) != null && _.summaryTemplate && e.push(`概要模板: ${t.displayHints.summaryTemplate}`), e.length ? e.join(" | ") : "";
|
|
215
272
|
}
|
|
216
|
-
function
|
|
273
|
+
function Ge(t) {
|
|
217
274
|
const e = [
|
|
218
|
-
"
|
|
275
|
+
"你是一个 AI 助手,可以帮助用户完成各种操作。",
|
|
219
276
|
"",
|
|
220
|
-
"
|
|
277
|
+
"你可以使用以下工具包:",
|
|
221
278
|
""
|
|
222
279
|
];
|
|
223
280
|
for (const s of t) {
|
|
224
|
-
e.push(
|
|
225
|
-
for (const
|
|
226
|
-
const
|
|
227
|
-
e.push(` - ${
|
|
281
|
+
e.push(`【${s.name}】${s.description}`);
|
|
282
|
+
for (const i of s.tools) {
|
|
283
|
+
const o = qe(i);
|
|
284
|
+
e.push(` - ${i.name}: ${i.description}`), o && e.push(` ${o}`);
|
|
228
285
|
}
|
|
229
286
|
e.push("");
|
|
230
287
|
}
|
|
231
|
-
return e.push("
|
|
288
|
+
return e.push("注意:"), e.push("1. 当你需要查询或操作数据时,调用对应工具包中的函数。"), e.push("2. 工具函数由宿主系统执行,你只需要传递正确的参数。"), e.push("3. 获取到工具结果后,回复用户并告知结果。"), e.push("4. 如果工具返回了结构化数据(如订单信息、系统状态等),在回复中清晰地展示给用户。"), e.push("5. 根据结果动态建议用户接下来可以做什么。"), e.push("6. 如果用户上传了文件,文件格式为(.txt、.json、.geojson等格式),你必须调用 open_mapview_file 工具在地图上展示,不要只回复文字。"), e.push(""), e.push("--- 文件上传规则 ---"), e.push("用户可能上传文件,文件以如下格式出现在消息中:"), e.push("[Uploaded file: fileId] 文件名 (类型, 大小KB)"), e.push("你无法查看文件内容,只能看到文件名和类型。"), e.push("你必须根据文件名、扩展名和用户的文字指令,调用对应的工具来处理文件。"), e.push("如果某个工具需要处理该文件,在工具参数中传入 fileId。"), e.push('不要回复假性成功消息(如"已在地图上显示"),如果不调用工具,文件不会被实际处理。'), e.push("不要编造文件内容,不要假装你看到了文件数据。"), e.join(`
|
|
289
|
+
`);
|
|
290
|
+
}
|
|
291
|
+
function zs(t, e, s) {
|
|
292
|
+
var l;
|
|
293
|
+
let i = null;
|
|
294
|
+
if (t.type === "component" && t.componentName) {
|
|
295
|
+
let _;
|
|
296
|
+
t.packageId && (_ = e.find((b) => b.id === t.packageId)), !_ && s && (_ = e.find((b) => b.id === s)), (l = _ == null ? void 0 : _.components) != null && l[t.componentName] && (i = _.components[t.componentName]);
|
|
297
|
+
}
|
|
298
|
+
const o = Ye(t);
|
|
299
|
+
return { component: i, block: t, fallbackText: o };
|
|
300
|
+
}
|
|
301
|
+
function Ye(t) {
|
|
302
|
+
switch (t.type) {
|
|
303
|
+
case "table":
|
|
304
|
+
return Xe(t);
|
|
305
|
+
case "card":
|
|
306
|
+
return Qe(t);
|
|
307
|
+
case "list":
|
|
308
|
+
return Ze(t);
|
|
309
|
+
default:
|
|
310
|
+
return JSON.stringify(t.data, null, 2);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function re(t) {
|
|
314
|
+
return t == null ? null : Array.isArray(t) ? t : typeof t != "object" ? null : Array.isArray(t.data) ? t.data : Array.isArray(t.list) ? t.list : Array.isArray(t.items) ? t.items : [t];
|
|
315
|
+
}
|
|
316
|
+
function Xe(t) {
|
|
317
|
+
const e = re(t.data);
|
|
318
|
+
if (!(e != null && e.length)) return "(无数据)";
|
|
319
|
+
const s = t.title ? `**${t.title}**
|
|
320
|
+
|
|
321
|
+
` : "", i = Object.keys(e[0]), o = `| ${i.join(" | ")} |`, l = `| ${i.map(() => "---").join(" | ")} |`, _ = e.map((b) => `| ${i.map((a) => String(b[a] ?? "")).join(" | ")} |`).join(`
|
|
322
|
+
`);
|
|
323
|
+
return `${s}${o}
|
|
324
|
+
${l}
|
|
325
|
+
${_}`;
|
|
326
|
+
}
|
|
327
|
+
function Qe(t) {
|
|
328
|
+
const e = re(t.data);
|
|
329
|
+
if (!(e != null && e.length)) return "(无数据)";
|
|
330
|
+
const s = t.title ? `**${t.title}**
|
|
331
|
+
|
|
332
|
+
` : "", i = e.map((o) => Object.entries(o).map(([_, b]) => `- **${_}**: ${b}`).join(`
|
|
333
|
+
`)).join(`
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
232
337
|
`);
|
|
338
|
+
return `${s}${i}`;
|
|
339
|
+
}
|
|
340
|
+
function Ze(t) {
|
|
341
|
+
const e = re(t.data);
|
|
342
|
+
if (!(e != null && e.length)) return "(无数据)";
|
|
343
|
+
const s = t.title ? `**${t.title}**
|
|
344
|
+
|
|
345
|
+
` : "", i = e.map((o) => `- ${typeof o == "string" ? o : Object.values(o).join(" - ")}`).join(`
|
|
346
|
+
`);
|
|
347
|
+
return `${s}${i}`;
|
|
348
|
+
}
|
|
349
|
+
class et {
|
|
350
|
+
constructor() {
|
|
351
|
+
K(this, "exactHandlers", /* @__PURE__ */ new Map());
|
|
352
|
+
K(this, "regexHandlers", []);
|
|
353
|
+
K(this, "isChatOpen", () => !0);
|
|
354
|
+
}
|
|
355
|
+
setChatOpenGetter(e) {
|
|
356
|
+
this.isChatOpen = e;
|
|
357
|
+
}
|
|
358
|
+
on(e, s) {
|
|
359
|
+
return typeof e == "string" ? (this.exactHandlers.has(e) || this.exactHandlers.set(e, /* @__PURE__ */ new Set()), this.exactHandlers.get(e).add(s), () => this.off(e, s)) : (this.regexHandlers.push({ pattern: e, handler: s }), () => this.off(e, s));
|
|
360
|
+
}
|
|
361
|
+
off(e, s) {
|
|
362
|
+
var i;
|
|
363
|
+
if (typeof e == "string") {
|
|
364
|
+
(i = this.exactHandlers.get(e)) == null || i.delete(s);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
this.regexHandlers = this.regexHandlers.filter(
|
|
368
|
+
(o) => o.pattern !== e || o.handler !== s
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
dispatch(e, s = !1) {
|
|
372
|
+
var i;
|
|
373
|
+
if (!(s && !this.isChatOpen())) {
|
|
374
|
+
(i = this.exactHandlers.get(e.type)) == null || i.forEach((o) => o(e));
|
|
375
|
+
for (const { pattern: o, handler: l } of this.regexHandlers)
|
|
376
|
+
o.test(e.type) && l(e);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
clear() {
|
|
380
|
+
this.exactHandlers.clear(), this.regexHandlers = [];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function tt() {
|
|
384
|
+
return new et();
|
|
233
385
|
}
|
|
234
|
-
|
|
386
|
+
class st {
|
|
387
|
+
constructor(e, s) {
|
|
388
|
+
K(this, "bus");
|
|
389
|
+
K(this, "rules");
|
|
390
|
+
K(this, "cooldowns", /* @__PURE__ */ new Map());
|
|
391
|
+
K(this, "unsubscribers", []);
|
|
392
|
+
this.bus = e, this.rules = s;
|
|
393
|
+
}
|
|
394
|
+
start(e) {
|
|
395
|
+
for (const s of this.rules) {
|
|
396
|
+
const i = this.bus.on(s.event, (o) => {
|
|
397
|
+
if (this.isOnCooldown(s) || (this.setCooldown(s), s.autoPopup && e.onAutoPopup(), s.action === "silent")) return;
|
|
398
|
+
const l = this.buildPrompt(s, o);
|
|
399
|
+
l && e.onRespond(l);
|
|
400
|
+
});
|
|
401
|
+
this.unsubscribers.push(i);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
stop() {
|
|
405
|
+
for (const e of this.unsubscribers)
|
|
406
|
+
e();
|
|
407
|
+
this.unsubscribers = [], this.cooldowns.clear();
|
|
408
|
+
}
|
|
409
|
+
getBus() {
|
|
410
|
+
return this.bus;
|
|
411
|
+
}
|
|
412
|
+
isOnCooldown(e) {
|
|
413
|
+
if (!e.cooldown) return !1;
|
|
414
|
+
const s = typeof e.event == "string" ? e.event : e.event.source, i = this.cooldowns.get(s);
|
|
415
|
+
return i ? Date.now() < i : !1;
|
|
416
|
+
}
|
|
417
|
+
setCooldown(e) {
|
|
418
|
+
if (!e.cooldown) return;
|
|
419
|
+
const s = typeof e.event == "string" ? e.event : e.event.source;
|
|
420
|
+
this.cooldowns.set(s, Date.now() + e.cooldown);
|
|
421
|
+
}
|
|
422
|
+
buildPrompt(e, s) {
|
|
423
|
+
return e.prompt ? e.prompt.replace(/\{\{payload\.([^}]+)\}\}/g, (i, o) => {
|
|
424
|
+
const l = s.payload[o];
|
|
425
|
+
return l !== void 0 ? String(l) : `{{payload.${o}}}`;
|
|
426
|
+
}) : "";
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const ve = {
|
|
235
430
|
apiKey: "",
|
|
236
431
|
baseUrl: "https://api.deepseek.com",
|
|
237
432
|
model: "deepseek-chat",
|
|
238
|
-
temperature: 0
|
|
433
|
+
temperature: 0,
|
|
434
|
+
providerMode: "direct",
|
|
435
|
+
proxyUrl: "http://localhost:3001/api/chat"
|
|
239
436
|
};
|
|
240
|
-
function
|
|
437
|
+
function nt(t) {
|
|
241
438
|
return {
|
|
242
439
|
type: "function",
|
|
243
440
|
function: {
|
|
@@ -247,614 +444,752 @@ function xe(t) {
|
|
|
247
444
|
}
|
|
248
445
|
};
|
|
249
446
|
}
|
|
250
|
-
function
|
|
447
|
+
function ue() {
|
|
251
448
|
return `m_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
252
449
|
}
|
|
253
|
-
function
|
|
450
|
+
function ot() {
|
|
451
|
+
let t = [], e = "0123456789abcdef";
|
|
452
|
+
for (let i = 0; i < 36; i++)
|
|
453
|
+
t[i] = e.substr(Math.floor(Math.random() * 16), 1);
|
|
454
|
+
return t[14] = "4", t[19] = e.substr(t[19] & 3 | 8, 1), t[8] = t[13] = t[18] = t[23] = "-", t.join("");
|
|
455
|
+
}
|
|
456
|
+
const ye = "agent_chat_device_id";
|
|
457
|
+
function ae() {
|
|
458
|
+
let t = localStorage.getItem(ye);
|
|
459
|
+
return t || (t = ot(), localStorage.setItem(ye, t)), t;
|
|
460
|
+
}
|
|
461
|
+
function de(t) {
|
|
462
|
+
try {
|
|
463
|
+
return new URL(t).origin;
|
|
464
|
+
} catch {
|
|
465
|
+
return "";
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
function pe(t) {
|
|
254
469
|
const e = [];
|
|
255
470
|
for (const s of t)
|
|
256
471
|
if (s.role === "user")
|
|
257
472
|
e.push({ role: "user", content: s.content });
|
|
258
473
|
else if (s.role === "assistant" && (e.push({ role: "assistant", content: s.content, tool_calls: s.tool_calls }), s.toolResults))
|
|
259
|
-
for (const
|
|
260
|
-
e.push({ role: "tool", tool_call_id:
|
|
474
|
+
for (const i of s.toolResults)
|
|
475
|
+
e.push({ role: "tool", tool_call_id: i.callId, content: i.result, name: i.name });
|
|
261
476
|
return e;
|
|
262
477
|
}
|
|
263
|
-
function
|
|
478
|
+
function Bs(t) {
|
|
479
|
+
var fe, ge;
|
|
264
480
|
const {
|
|
265
481
|
toolPackages: e,
|
|
266
482
|
onToolCall: s,
|
|
267
|
-
provider:
|
|
268
|
-
providerConfig:
|
|
483
|
+
provider: i,
|
|
484
|
+
providerConfig: o,
|
|
269
485
|
systemPrompt: l,
|
|
270
|
-
storagePrefix:
|
|
271
|
-
sendFileToLLM:
|
|
272
|
-
} = t,
|
|
273
|
-
messages: `${
|
|
274
|
-
settings: `${
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
486
|
+
storagePrefix: _ = "agent_chat_",
|
|
487
|
+
sendFileToLLM: b = !1
|
|
488
|
+
} = t, a = {
|
|
489
|
+
messages: `${_}messages`,
|
|
490
|
+
settings: `${_}settings`
|
|
491
|
+
}, r = W([]), h = W({ ...ve }), m = W(!1), $ = W(""), H = /* @__PURE__ */ new Map(), I = W(!1);
|
|
492
|
+
let A = null;
|
|
493
|
+
const w = ((fe = t.businessEvents) == null ? void 0 : fe.bus) || tt();
|
|
494
|
+
w.setChatOpenGetter(() => I.value), (ge = t.businessEvents) != null && ge.rules.length && (A = new st(w, t.businessEvents.rules), A.start({
|
|
495
|
+
onAutoPopup: () => {
|
|
496
|
+
I.value = !0;
|
|
497
|
+
},
|
|
498
|
+
onRespond: (n) => {
|
|
499
|
+
$.value = "", !(!h.value.apiKey && h.value.providerMode !== "proxy") && me(n);
|
|
500
|
+
}
|
|
501
|
+
})), ze(() => {
|
|
502
|
+
A == null || A.stop(), Y();
|
|
503
|
+
});
|
|
504
|
+
const T = new Ke();
|
|
505
|
+
for (const n of e)
|
|
506
|
+
for (const C of n.tools) {
|
|
507
|
+
const M = nt(C);
|
|
508
|
+
T.register(M, async (c) => {
|
|
509
|
+
const k = { packageId: n.id, toolName: C.name, args: c };
|
|
510
|
+
return await d(k, n, C);
|
|
282
511
|
});
|
|
283
512
|
}
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
513
|
+
const z = Je(), j = We(), J = i || {
|
|
514
|
+
streamChat(n) {
|
|
515
|
+
return (h.value.providerMode === "proxy" ? j : z).streamChat(n);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
function U() {
|
|
519
|
+
const n = { ...o };
|
|
520
|
+
return h.value.providerMode === "proxy" ? {
|
|
521
|
+
...n,
|
|
522
|
+
baseUrl: h.value.proxyUrl,
|
|
523
|
+
apiKey: "",
|
|
524
|
+
model: h.value.model,
|
|
525
|
+
temperature: h.value.temperature
|
|
526
|
+
} : {
|
|
527
|
+
...n,
|
|
528
|
+
baseUrl: h.value.baseUrl,
|
|
529
|
+
apiKey: h.value.apiKey,
|
|
530
|
+
model: h.value.model,
|
|
531
|
+
temperature: h.value.temperature
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
const N = new Re({
|
|
535
|
+
provider: J,
|
|
536
|
+
providerConfig: U(),
|
|
537
|
+
tools: T,
|
|
538
|
+
systemPrompt: l || Ge(e)
|
|
295
539
|
});
|
|
296
|
-
let
|
|
297
|
-
|
|
298
|
-
|
|
540
|
+
let g = null;
|
|
541
|
+
const f = [];
|
|
542
|
+
async function d(n, C, M) {
|
|
543
|
+
const c = {
|
|
299
544
|
toolCallId: `${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
|
|
300
|
-
packageId:
|
|
301
|
-
toolName:
|
|
302
|
-
args:
|
|
545
|
+
packageId: n.packageId,
|
|
546
|
+
toolName: n.toolName,
|
|
547
|
+
args: n.args
|
|
303
548
|
};
|
|
304
549
|
try {
|
|
305
|
-
const
|
|
306
|
-
return
|
|
307
|
-
} catch (
|
|
308
|
-
return { success: !1, result: (
|
|
550
|
+
const k = await s(c);
|
|
551
|
+
return g = { pkg: C, toolDef: M, data: k, args: n.args }, { success: !0, result: typeof k == "string" ? k : JSON.stringify(k) };
|
|
552
|
+
} catch (k) {
|
|
553
|
+
return { success: !1, result: (k == null ? void 0 : k.message) || "工具执行失败" };
|
|
309
554
|
}
|
|
310
555
|
}
|
|
311
|
-
function
|
|
312
|
-
var
|
|
313
|
-
if (!
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return;
|
|
318
|
-
const B = n.value[n.value.length - 1];
|
|
556
|
+
function V() {
|
|
557
|
+
var he;
|
|
558
|
+
if (!g) return;
|
|
559
|
+
const { pkg: n, toolDef: C, data: M, args: c } = g, k = C.displayHints;
|
|
560
|
+
if (!k) return;
|
|
561
|
+
const B = r.value[r.value.length - 1];
|
|
319
562
|
if (!(!B || B.role !== "assistant")) {
|
|
320
|
-
if (
|
|
321
|
-
let
|
|
322
|
-
if ((
|
|
323
|
-
const
|
|
324
|
-
|
|
563
|
+
if (k.suggestComponent) {
|
|
564
|
+
let q = M;
|
|
565
|
+
if ((he = M == null ? void 0 : M.data) != null && he.fileId) {
|
|
566
|
+
const ne = H.get(M.data.fileId);
|
|
567
|
+
ne && (q = ne.name.endsWith(".geojson") || ne.name.endsWith(".json") ? { data: { wkt: "", geojson: ne.data } } : { data: { wkt: ne.data, geojson: "" } });
|
|
325
568
|
}
|
|
326
569
|
B.renderBlocks = [{
|
|
327
570
|
type: "component",
|
|
328
|
-
packageId:
|
|
329
|
-
componentName:
|
|
330
|
-
data:
|
|
331
|
-
}], console.log("resolvedData===",
|
|
571
|
+
packageId: n.id,
|
|
572
|
+
componentName: k.suggestComponent,
|
|
573
|
+
data: q
|
|
574
|
+
}], console.log("resolvedData===", q);
|
|
575
|
+
} else if (k.resultFormat === "table" || k.resultFormat === "card" || k.resultFormat === "list") {
|
|
576
|
+
const q = re(M);
|
|
577
|
+
q != null && q.length && (B.renderBlocks = [{
|
|
578
|
+
type: k.resultFormat,
|
|
579
|
+
title: ee(k.summaryTemplate, c),
|
|
580
|
+
data: q,
|
|
581
|
+
fields: k.previewFields,
|
|
582
|
+
labelField: k.labelField,
|
|
583
|
+
selectable: k.selectable
|
|
584
|
+
}]);
|
|
332
585
|
}
|
|
333
|
-
|
|
586
|
+
if (k.suggestedNext)
|
|
587
|
+
if (k.suggestedNextEvent) {
|
|
588
|
+
const q = k.suggestedNextEvent, ne = w.on(q, () => E(q));
|
|
589
|
+
f.push({ event: q, text: k.suggestedNext, unsub: ne });
|
|
590
|
+
} else
|
|
591
|
+
B.suggestedNext = k.suggestedNext;
|
|
334
592
|
}
|
|
335
593
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
594
|
+
function E(n) {
|
|
595
|
+
const C = f.findIndex((c) => c.event === n);
|
|
596
|
+
if (C === -1) return;
|
|
597
|
+
const M = f[C];
|
|
598
|
+
M.unsub(), f.splice(C, 1);
|
|
599
|
+
for (let c = r.value.length - 1; c >= 0; c--) {
|
|
600
|
+
const k = r.value[c];
|
|
601
|
+
if (k.role === "assistant") {
|
|
602
|
+
k.suggestedNext = M.text;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
function Y() {
|
|
608
|
+
for (const n of f)
|
|
609
|
+
n.unsub();
|
|
610
|
+
f.length = 0;
|
|
611
|
+
}
|
|
612
|
+
function ee(n, C) {
|
|
613
|
+
if (n)
|
|
614
|
+
return n.replace(/\{(\w+)\}/g, (M, c) => C[c] !== void 0 ? String(C[c]) : M);
|
|
615
|
+
}
|
|
616
|
+
const Q = /* @__PURE__ */ new Map();
|
|
617
|
+
N.on((n) => {
|
|
618
|
+
var C, M;
|
|
619
|
+
switch (n.type) {
|
|
340
620
|
case "message": {
|
|
341
|
-
if (
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
content: i.message.content,
|
|
621
|
+
if (n.message.role === "tool") break;
|
|
622
|
+
const c = {
|
|
623
|
+
id: ue(),
|
|
624
|
+
role: n.message.role,
|
|
625
|
+
content: n.message.content,
|
|
347
626
|
reasoning: "",
|
|
348
|
-
status:
|
|
627
|
+
status: n.message.role === "assistant" ? "streaming" : "done",
|
|
349
628
|
timestamp: Date.now(),
|
|
350
|
-
tool_calls:
|
|
629
|
+
tool_calls: n.message.tool_calls
|
|
351
630
|
};
|
|
352
|
-
|
|
631
|
+
r.value.push(c);
|
|
353
632
|
break;
|
|
354
633
|
}
|
|
355
634
|
case "stream:delta": {
|
|
356
|
-
const
|
|
357
|
-
(
|
|
635
|
+
const c = r.value[r.value.length - 1];
|
|
636
|
+
(c == null ? void 0 : c.role) === "assistant" && c.status === "streaming" && (n.delta.content && (c.content += n.delta.content), n.delta.reasoning && (c.reasoning = (c.reasoning || "") + n.delta.reasoning));
|
|
358
637
|
break;
|
|
359
638
|
}
|
|
360
639
|
case "stream:end": {
|
|
361
|
-
const
|
|
362
|
-
(
|
|
640
|
+
const c = r.value[r.value.length - 1];
|
|
641
|
+
(c == null ? void 0 : c.role) === "assistant" && (c.content = n.content, n.reasoning && (c.reasoning = n.reasoning));
|
|
363
642
|
break;
|
|
364
643
|
}
|
|
365
644
|
case "tool:start": {
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
arguments: i.call.function.arguments,
|
|
645
|
+
const c = r.value[r.value.length - 1];
|
|
646
|
+
if (!c || c.role !== "assistant") break;
|
|
647
|
+
c.tool_calls || (c.tool_calls = []), c.toolResults || (c.toolResults = []);
|
|
648
|
+
const k = c.toolResults.length;
|
|
649
|
+
c.toolResults.push({
|
|
650
|
+
callId: n.call.id,
|
|
651
|
+
name: n.call.function.name,
|
|
652
|
+
arguments: n.call.function.arguments,
|
|
375
653
|
result: "",
|
|
376
654
|
success: !1,
|
|
377
655
|
status: "running"
|
|
378
|
-
}),
|
|
379
|
-
id:
|
|
656
|
+
}), Q.set(n.call.id, { msgIndex: r.value.length - 1, toolIndex: k }), c.tool_calls.find((B) => B.id === n.call.id) || c.tool_calls.push({
|
|
657
|
+
id: n.call.id,
|
|
380
658
|
type: "function",
|
|
381
659
|
function: {
|
|
382
|
-
name:
|
|
383
|
-
arguments:
|
|
660
|
+
name: n.call.function.name,
|
|
661
|
+
arguments: n.call.function.arguments
|
|
384
662
|
}
|
|
385
663
|
});
|
|
386
664
|
break;
|
|
387
665
|
}
|
|
388
666
|
case "tool:end": {
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
B && (B.result = i.output.result, B.success = i.output.success, B.status = i.output.success ? "success" : "error"), H.delete(i.call.id);
|
|
667
|
+
const c = Q.get(n.call.id);
|
|
668
|
+
if (!c) break;
|
|
669
|
+
const k = (M = (C = r.value[c.msgIndex]) == null ? void 0 : C.toolResults) == null ? void 0 : M[c.toolIndex];
|
|
670
|
+
k && (k.result = n.output.result, k.success = n.output.success, k.status = n.output.success ? "success" : "error"), Q.delete(n.call.id);
|
|
394
671
|
break;
|
|
395
672
|
}
|
|
396
673
|
case "error": {
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
(
|
|
674
|
+
$.value = n.error;
|
|
675
|
+
const c = r.value[r.value.length - 1];
|
|
676
|
+
(c == null ? void 0 : c.role) === "assistant" && (c.status = "error", c.error = n.error);
|
|
400
677
|
break;
|
|
401
678
|
}
|
|
402
679
|
case "status": {
|
|
403
|
-
if (
|
|
404
|
-
const
|
|
405
|
-
(
|
|
680
|
+
if (m.value = n.loading, !n.loading) {
|
|
681
|
+
const c = r.value[r.value.length - 1];
|
|
682
|
+
(c == null ? void 0 : c.role) === "assistant" && c.status === "streaming" && (c.status = "done", c.content || (c.content = "(已停止生成)")), V();
|
|
406
683
|
}
|
|
407
684
|
break;
|
|
408
685
|
}
|
|
409
686
|
}
|
|
410
687
|
});
|
|
411
|
-
function
|
|
688
|
+
function ce() {
|
|
412
689
|
try {
|
|
413
|
-
const
|
|
414
|
-
|
|
690
|
+
const n = localStorage.getItem(a.settings);
|
|
691
|
+
n && (h.value = { ...ve, ...JSON.parse(n) });
|
|
415
692
|
} catch {
|
|
416
693
|
}
|
|
417
694
|
}
|
|
418
|
-
function
|
|
695
|
+
function Z(n) {
|
|
696
|
+
for (const C of n)
|
|
697
|
+
if (C.files)
|
|
698
|
+
for (const M of C.files)
|
|
699
|
+
M.id && H.set(M.id, M);
|
|
700
|
+
}
|
|
701
|
+
async function we() {
|
|
702
|
+
if (h.value.providerMode === "proxy") {
|
|
703
|
+
try {
|
|
704
|
+
const n = de(h.value.proxyUrl);
|
|
705
|
+
if (!n) return;
|
|
706
|
+
const C = await fetch(`${n}/api/messages?device_id=${encodeURIComponent(ae())}`);
|
|
707
|
+
if (!C.ok) return;
|
|
708
|
+
const M = await C.json(), c = M == null ? void 0 : M.messages;
|
|
709
|
+
Array.isArray(c) && (r.value = c, Z(c), N.initialize(pe(c)));
|
|
710
|
+
} catch {
|
|
711
|
+
}
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
419
714
|
try {
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
n.value = k;
|
|
425
|
-
for (const b of k)
|
|
426
|
-
if (b.files)
|
|
427
|
-
for (const o of b.files)
|
|
428
|
-
o.id && M.set(o.id, o);
|
|
429
|
-
h.initialize(ae(k));
|
|
430
|
-
}
|
|
715
|
+
const n = localStorage.getItem(a.messages);
|
|
716
|
+
if (n) {
|
|
717
|
+
const C = JSON.parse(n);
|
|
718
|
+
Array.isArray(C) && (r.value = C, Z(C), N.initialize(pe(C)));
|
|
431
719
|
}
|
|
432
720
|
} catch {
|
|
433
721
|
}
|
|
434
722
|
}
|
|
435
|
-
function
|
|
436
|
-
|
|
437
|
-
baseUrl:
|
|
438
|
-
apiKey:
|
|
439
|
-
model:
|
|
440
|
-
temperature:
|
|
723
|
+
function ke(n) {
|
|
724
|
+
h.value = { ...n }, localStorage.setItem(a.settings, JSON.stringify(n)), n.providerMode === "proxy" ? N.updateProviderConfig({
|
|
725
|
+
baseUrl: n.proxyUrl,
|
|
726
|
+
apiKey: "",
|
|
727
|
+
model: n.model,
|
|
728
|
+
temperature: n.temperature
|
|
729
|
+
}) : N.updateProviderConfig({
|
|
730
|
+
baseUrl: n.baseUrl,
|
|
731
|
+
apiKey: n.apiKey,
|
|
732
|
+
model: n.model,
|
|
733
|
+
temperature: n.temperature
|
|
441
734
|
});
|
|
442
735
|
}
|
|
443
|
-
function
|
|
736
|
+
async function Ce() {
|
|
737
|
+
if (h.value.providerMode === "proxy") {
|
|
738
|
+
try {
|
|
739
|
+
const n = de(h.value.proxyUrl);
|
|
740
|
+
if (!n) return;
|
|
741
|
+
await fetch(`${n}/api/messages`, {
|
|
742
|
+
method: "POST",
|
|
743
|
+
headers: { "Content-Type": "application/json" },
|
|
744
|
+
body: JSON.stringify({ device_id: ae(), messages: r.value })
|
|
745
|
+
});
|
|
746
|
+
} catch {
|
|
747
|
+
}
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
444
750
|
try {
|
|
445
|
-
localStorage.setItem(
|
|
751
|
+
localStorage.setItem(a.messages, JSON.stringify(r.value));
|
|
446
752
|
} catch {
|
|
447
753
|
}
|
|
448
754
|
}
|
|
449
|
-
function
|
|
450
|
-
return
|
|
755
|
+
function $e(n) {
|
|
756
|
+
return n.startsWith("data:");
|
|
451
757
|
}
|
|
452
|
-
async function
|
|
453
|
-
const
|
|
454
|
-
if (!
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
C.value = "\u8BF7\u5148\u914D\u7F6E API Key\u3002";
|
|
758
|
+
async function me(n, C) {
|
|
759
|
+
const M = n.trim();
|
|
760
|
+
if (!M && (!C || C.length === 0)) return;
|
|
761
|
+
if ($.value = "", h.value.providerMode === "direct" && !h.value.apiKey) {
|
|
762
|
+
$.value = "请先配置 API Key。";
|
|
458
763
|
return;
|
|
459
764
|
}
|
|
460
|
-
if (
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}), w = null, H.clear(), k && k.length > 0) {
|
|
466
|
-
for (const $ of k)
|
|
467
|
-
$.id = se(), M.set($.id, { ...$ });
|
|
468
|
-
const B = {
|
|
469
|
-
id: se(),
|
|
765
|
+
if (N.updateProviderConfig(U()), g = null, Q.clear(), C && C.length > 0) {
|
|
766
|
+
for (const B of C)
|
|
767
|
+
B.id = ue(), H.set(B.id, { ...B });
|
|
768
|
+
const k = {
|
|
769
|
+
id: ue(),
|
|
470
770
|
role: "user",
|
|
471
|
-
content:
|
|
771
|
+
content: M,
|
|
472
772
|
status: "done",
|
|
473
773
|
timestamp: Date.now(),
|
|
474
|
-
files:
|
|
774
|
+
files: C
|
|
475
775
|
};
|
|
476
|
-
|
|
776
|
+
r.value.push(k), N.initialize(pe(r.value));
|
|
477
777
|
}
|
|
478
|
-
let
|
|
479
|
-
|
|
480
|
-
${
|
|
778
|
+
let c = M;
|
|
779
|
+
C && C.length > 0 && (b ? c = C.map((B) => $e(B.data) ? `[File: ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)]
|
|
780
|
+
${B.data}` : `[File: ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)]
|
|
481
781
|
\`\`\`
|
|
482
|
-
${
|
|
782
|
+
${B.data}
|
|
483
783
|
\`\`\``).join(`
|
|
484
784
|
|
|
485
|
-
`) + (
|
|
785
|
+
`) + (M ? `
|
|
486
786
|
|
|
487
|
-
${
|
|
488
|
-
(
|
|
787
|
+
${M}` : "") : c = C.map(
|
|
788
|
+
(B) => `[Uploaded file: ${B.id}] ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)`
|
|
489
789
|
).join(`
|
|
490
|
-
`) + (
|
|
790
|
+
`) + (M ? `
|
|
491
791
|
|
|
492
|
-
${
|
|
493
|
-
}
|
|
494
|
-
function L() {
|
|
495
|
-
h.stop();
|
|
496
|
-
}
|
|
497
|
-
function X() {
|
|
498
|
-
h.clear(), n.value = [], C.value = "", w = null, M.clear(), localStorage.removeItem(u.messages);
|
|
499
|
-
}
|
|
500
|
-
const ie = Y(() => !!g.value.apiKey);
|
|
501
|
-
return de(() => {
|
|
502
|
-
J(), q();
|
|
503
|
-
}), ee(n, () => x(), { deep: !0 }), {
|
|
504
|
-
messages: n,
|
|
505
|
-
settings: g,
|
|
506
|
-
loading: y,
|
|
507
|
-
errorMsg: C,
|
|
508
|
-
hasApiKey: ie,
|
|
509
|
-
toolPackages: e,
|
|
510
|
-
fileStore: M,
|
|
511
|
-
sendMessage: D,
|
|
512
|
-
stopGeneration: L,
|
|
513
|
-
clearMessages: X,
|
|
514
|
-
saveSettings: P
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
function Gt(t, e, s) {
|
|
518
|
-
var l;
|
|
519
|
-
let d = null;
|
|
520
|
-
if (t.type === "component" && t.componentName) {
|
|
521
|
-
let p;
|
|
522
|
-
t.packageId && (p = e.find((E) => E.id === t.packageId)), !p && s && (p = e.find((E) => E.id === s)), (l = p == null ? void 0 : p.components) != null && l[t.componentName] && (d = p.components[t.componentName]);
|
|
792
|
+
${M}` : "")), await N.sendMessage(c);
|
|
523
793
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
function De(t) {
|
|
528
|
-
switch (t.type) {
|
|
529
|
-
case "table":
|
|
530
|
-
return ke(t);
|
|
531
|
-
case "card":
|
|
532
|
-
return Be(t);
|
|
533
|
-
case "list":
|
|
534
|
-
return we(t);
|
|
535
|
-
default:
|
|
536
|
-
return JSON.stringify(t.data, null, 2);
|
|
794
|
+
function Se() {
|
|
795
|
+
N.stop();
|
|
537
796
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
return "";
|
|
578
|
-
const s = Array.isArray(e) ? e : e.list || e.items || [e];
|
|
579
|
-
if (!s.length)
|
|
580
|
-
return "\uFF08\u65E0\u6570\u636E\uFF09";
|
|
581
|
-
const d = t.title ? `**${t.title}**
|
|
582
|
-
|
|
583
|
-
` : "", r = s.map((l) => `- ${typeof l == "string" ? l : Object.values(l).join(" - ")}`).join(`
|
|
584
|
-
`);
|
|
585
|
-
return `${d}${r}`;
|
|
797
|
+
async function Me() {
|
|
798
|
+
if (Ve(), N.clear(), r.value = [], $.value = "", g = null, Y(), H.clear(), h.value.providerMode === "proxy")
|
|
799
|
+
try {
|
|
800
|
+
const n = de(h.value.proxyUrl);
|
|
801
|
+
n && await fetch(`${n}/api/messages?device_id=${encodeURIComponent(ae())}`, { method: "DELETE" });
|
|
802
|
+
} catch {
|
|
803
|
+
}
|
|
804
|
+
else
|
|
805
|
+
localStorage.removeItem(a.messages);
|
|
806
|
+
}
|
|
807
|
+
const Ie = te(() => h.value.providerMode === "proxy" || !!h.value.apiKey);
|
|
808
|
+
Be(() => {
|
|
809
|
+
ce(), we();
|
|
810
|
+
});
|
|
811
|
+
let se = null;
|
|
812
|
+
function Ae() {
|
|
813
|
+
se && clearTimeout(se), se = setTimeout(() => {
|
|
814
|
+
se = null, Ce();
|
|
815
|
+
}, 400);
|
|
816
|
+
}
|
|
817
|
+
function Ve() {
|
|
818
|
+
se && (clearTimeout(se), se = null);
|
|
819
|
+
}
|
|
820
|
+
return le(r, () => Ae(), { deep: !0 }), {
|
|
821
|
+
messages: r,
|
|
822
|
+
settings: h,
|
|
823
|
+
loading: m,
|
|
824
|
+
errorMsg: $,
|
|
825
|
+
hasApiKey: Ie,
|
|
826
|
+
toolPackages: e,
|
|
827
|
+
fileStore: H,
|
|
828
|
+
visible: I,
|
|
829
|
+
eventBus: w,
|
|
830
|
+
deviceId: ae(),
|
|
831
|
+
sendMessage: me,
|
|
832
|
+
stopGeneration: Se,
|
|
833
|
+
clearMessages: Me,
|
|
834
|
+
saveSettings: ke
|
|
835
|
+
};
|
|
586
836
|
}
|
|
587
837
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
588
|
-
var
|
|
838
|
+
var at = /* @__PURE__ */ F({
|
|
589
839
|
name: "ChatDotRound",
|
|
590
840
|
__name: "chat-dot-round",
|
|
591
841
|
setup(t) {
|
|
592
|
-
return (e, s) => (
|
|
842
|
+
return (e, s) => (u(), x("svg", {
|
|
593
843
|
xmlns: "http://www.w3.org/2000/svg",
|
|
594
844
|
viewBox: "0 0 1024 1024"
|
|
595
845
|
}, [
|
|
596
|
-
|
|
846
|
+
y("path", {
|
|
597
847
|
fill: "currentColor",
|
|
598
848
|
d: "m174.72 855.68 135.296-45.12 23.68 11.84C388.096 849.536 448.576 864 512 864c211.84 0 384-166.784 384-352S723.84 160 512 160 128 326.784 128 512c0 69.12 24.96 139.264 70.848 199.232l22.08 28.8-46.272 115.584zm-45.248 82.56A32 32 0 0 1 89.6 896l58.368-145.92C94.72 680.32 64 596.864 64 512 64 299.904 256 96 512 96s448 203.904 448 416-192 416-448 416a461.06 461.06 0 0 1-206.912-48.384l-175.616 58.56z"
|
|
599
849
|
}),
|
|
600
|
-
|
|
850
|
+
y("path", {
|
|
601
851
|
fill: "currentColor",
|
|
602
852
|
d: "M512 563.2a51.2 51.2 0 1 1 0-102.4 51.2 51.2 0 0 1 0 102.4m192 0a51.2 51.2 0 1 1 0-102.4 51.2 51.2 0 0 1 0 102.4m-384 0a51.2 51.2 0 1 1 0-102.4 51.2 51.2 0 0 1 0 102.4"
|
|
603
853
|
})
|
|
604
854
|
]));
|
|
605
855
|
}
|
|
606
|
-
}),
|
|
856
|
+
}), lt = at, it = /* @__PURE__ */ F({
|
|
857
|
+
name: "Close",
|
|
858
|
+
__name: "close",
|
|
859
|
+
setup(t) {
|
|
860
|
+
return (e, s) => (u(), x("svg", {
|
|
861
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
862
|
+
viewBox: "0 0 1024 1024"
|
|
863
|
+
}, [
|
|
864
|
+
y("path", {
|
|
865
|
+
fill: "currentColor",
|
|
866
|
+
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
867
|
+
})
|
|
868
|
+
]));
|
|
869
|
+
}
|
|
870
|
+
}), rt = it, ct = /* @__PURE__ */ F({
|
|
607
871
|
name: "Delete",
|
|
608
872
|
__name: "delete",
|
|
609
873
|
setup(t) {
|
|
610
|
-
return (e, s) => (
|
|
874
|
+
return (e, s) => (u(), x("svg", {
|
|
611
875
|
xmlns: "http://www.w3.org/2000/svg",
|
|
612
876
|
viewBox: "0 0 1024 1024"
|
|
613
877
|
}, [
|
|
614
|
-
|
|
878
|
+
y("path", {
|
|
615
879
|
fill: "currentColor",
|
|
616
880
|
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
|
|
617
881
|
})
|
|
618
882
|
]));
|
|
619
883
|
}
|
|
620
|
-
}),
|
|
884
|
+
}), ut = ct, dt = /* @__PURE__ */ F({
|
|
621
885
|
name: "Document",
|
|
622
886
|
__name: "document",
|
|
623
887
|
setup(t) {
|
|
624
|
-
return (e, s) => (
|
|
888
|
+
return (e, s) => (u(), x("svg", {
|
|
625
889
|
xmlns: "http://www.w3.org/2000/svg",
|
|
626
890
|
viewBox: "0 0 1024 1024"
|
|
627
891
|
}, [
|
|
628
|
-
|
|
892
|
+
y("path", {
|
|
629
893
|
fill: "currentColor",
|
|
630
894
|
d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
|
|
631
895
|
})
|
|
632
896
|
]));
|
|
633
897
|
}
|
|
634
|
-
}),
|
|
898
|
+
}), be = dt, pt = /* @__PURE__ */ F({
|
|
899
|
+
name: "FullScreen",
|
|
900
|
+
__name: "full-screen",
|
|
901
|
+
setup(t) {
|
|
902
|
+
return (e, s) => (u(), x("svg", {
|
|
903
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
904
|
+
viewBox: "0 0 1024 1024"
|
|
905
|
+
}, [
|
|
906
|
+
y("path", {
|
|
907
|
+
fill: "currentColor",
|
|
908
|
+
d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
|
|
909
|
+
})
|
|
910
|
+
]));
|
|
911
|
+
}
|
|
912
|
+
}), mt = pt, ft = /* @__PURE__ */ F({
|
|
913
|
+
name: "InfoFilled",
|
|
914
|
+
__name: "info-filled",
|
|
915
|
+
setup(t) {
|
|
916
|
+
return (e, s) => (u(), x("svg", {
|
|
917
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
918
|
+
viewBox: "0 0 1024 1024"
|
|
919
|
+
}, [
|
|
920
|
+
y("path", {
|
|
921
|
+
fill: "currentColor",
|
|
922
|
+
d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
|
|
923
|
+
})
|
|
924
|
+
]));
|
|
925
|
+
}
|
|
926
|
+
}), gt = ft, ht = /* @__PURE__ */ F({
|
|
635
927
|
name: "Paperclip",
|
|
636
928
|
__name: "paperclip",
|
|
637
929
|
setup(t) {
|
|
638
|
-
return (e, s) => (
|
|
930
|
+
return (e, s) => (u(), x("svg", {
|
|
639
931
|
xmlns: "http://www.w3.org/2000/svg",
|
|
640
932
|
viewBox: "0 0 1024 1024"
|
|
641
933
|
}, [
|
|
642
|
-
|
|
934
|
+
y("path", {
|
|
643
935
|
fill: "currentColor",
|
|
644
936
|
d: "M602.496 240.448A192 192 0 1 1 874.048 512l-316.8 316.8A256 256 0 0 1 195.2 466.752L602.496 59.456l45.248 45.248L240.448 512A192 192 0 0 0 512 783.552l316.8-316.8a128 128 0 1 0-181.056-181.056L353.6 579.904a32 32 0 1 0 45.248 45.248l294.144-294.144 45.312 45.248L444.096 670.4a96 96 0 1 1-135.744-135.744z"
|
|
645
937
|
})
|
|
646
938
|
]));
|
|
647
939
|
}
|
|
648
|
-
}),
|
|
940
|
+
}), _t = ht, vt = /* @__PURE__ */ F({
|
|
649
941
|
name: "Picture",
|
|
650
942
|
__name: "picture",
|
|
651
943
|
setup(t) {
|
|
652
|
-
return (e, s) => (
|
|
944
|
+
return (e, s) => (u(), x("svg", {
|
|
653
945
|
xmlns: "http://www.w3.org/2000/svg",
|
|
654
946
|
viewBox: "0 0 1024 1024"
|
|
655
947
|
}, [
|
|
656
|
-
|
|
948
|
+
y("path", {
|
|
657
949
|
fill: "currentColor",
|
|
658
950
|
d: "M160 160v704h704V160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32"
|
|
659
951
|
}),
|
|
660
|
-
|
|
952
|
+
y("path", {
|
|
661
953
|
fill: "currentColor",
|
|
662
954
|
d: "M384 288q64 0 64 64t-64 64-64-64 64-64M185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952z"
|
|
663
955
|
})
|
|
664
956
|
]));
|
|
665
957
|
}
|
|
666
|
-
}),
|
|
958
|
+
}), yt = vt, xt = /* @__PURE__ */ F({
|
|
667
959
|
name: "Promotion",
|
|
668
960
|
__name: "promotion",
|
|
669
961
|
setup(t) {
|
|
670
|
-
return (e, s) => (
|
|
962
|
+
return (e, s) => (u(), x("svg", {
|
|
671
963
|
xmlns: "http://www.w3.org/2000/svg",
|
|
672
964
|
viewBox: "0 0 1024 1024"
|
|
673
965
|
}, [
|
|
674
|
-
|
|
966
|
+
y("path", {
|
|
675
967
|
fill: "currentColor",
|
|
676
968
|
d: "m64 448 832-320-128 704-446.08-243.328L832 192 242.816 545.472zm256 512V657.024L512 768z"
|
|
677
969
|
})
|
|
678
970
|
]));
|
|
679
971
|
}
|
|
680
|
-
}),
|
|
972
|
+
}), bt = xt, wt = /* @__PURE__ */ F({
|
|
681
973
|
name: "Setting",
|
|
682
974
|
__name: "setting",
|
|
683
975
|
setup(t) {
|
|
684
|
-
return (e, s) => (
|
|
976
|
+
return (e, s) => (u(), x("svg", {
|
|
685
977
|
xmlns: "http://www.w3.org/2000/svg",
|
|
686
978
|
viewBox: "0 0 1024 1024"
|
|
687
979
|
}, [
|
|
688
|
-
|
|
980
|
+
y("path", {
|
|
689
981
|
fill: "currentColor",
|
|
690
982
|
d: "M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"
|
|
691
983
|
})
|
|
692
984
|
]));
|
|
693
985
|
}
|
|
694
|
-
}),
|
|
986
|
+
}), xe = wt, kt = /* @__PURE__ */ F({
|
|
695
987
|
name: "UserFilled",
|
|
696
988
|
__name: "user-filled",
|
|
697
989
|
setup(t) {
|
|
698
|
-
return (e, s) => (
|
|
990
|
+
return (e, s) => (u(), x("svg", {
|
|
699
991
|
xmlns: "http://www.w3.org/2000/svg",
|
|
700
992
|
viewBox: "0 0 1024 1024"
|
|
701
993
|
}, [
|
|
702
|
-
|
|
994
|
+
y("path", {
|
|
703
995
|
fill: "currentColor",
|
|
704
996
|
d: "M288 320a224 224 0 1 0 448 0 224 224 0 1 0-448 0m544 608H160a32 32 0 0 1-32-32v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 0 1-32 32z"
|
|
705
997
|
})
|
|
706
998
|
]));
|
|
707
999
|
}
|
|
708
|
-
}),
|
|
1000
|
+
}), Ct = kt, $t = /* @__PURE__ */ F({
|
|
709
1001
|
name: "VideoPause",
|
|
710
1002
|
__name: "video-pause",
|
|
711
1003
|
setup(t) {
|
|
712
|
-
return (e, s) => (
|
|
1004
|
+
return (e, s) => (u(), x("svg", {
|
|
713
1005
|
xmlns: "http://www.w3.org/2000/svg",
|
|
714
1006
|
viewBox: "0 0 1024 1024"
|
|
715
1007
|
}, [
|
|
716
|
-
|
|
1008
|
+
y("path", {
|
|
717
1009
|
fill: "currentColor",
|
|
718
1010
|
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m-96-544q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32m192 0q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32"
|
|
719
1011
|
})
|
|
720
1012
|
]));
|
|
721
1013
|
}
|
|
722
|
-
}),
|
|
723
|
-
const
|
|
1014
|
+
}), St = $t;
|
|
1015
|
+
const Mt = { class: "render-block" }, It = {
|
|
724
1016
|
key: 0,
|
|
725
1017
|
class: "render-block__title"
|
|
726
|
-
},
|
|
1018
|
+
}, At = {
|
|
727
1019
|
key: 2,
|
|
728
1020
|
class: "render-block__cards"
|
|
729
|
-
},
|
|
1021
|
+
}, Vt = { class: "card-item" }, Pt = { class: "card-label" }, Tt = { class: "card-value" }, zt = {
|
|
730
1022
|
key: 3,
|
|
731
1023
|
class: "render-block__table"
|
|
732
|
-
},
|
|
1024
|
+
}, Bt = {
|
|
733
1025
|
key: 4,
|
|
734
1026
|
class: "render-block__cards"
|
|
735
|
-
},
|
|
1027
|
+
}, Ht = { class: "card-label" }, Nt = { class: "card-value" }, Et = {
|
|
736
1028
|
key: 5,
|
|
737
1029
|
class: "render-block__list"
|
|
738
|
-
},
|
|
1030
|
+
}, Dt = 400, Ft = /* @__PURE__ */ F({
|
|
739
1031
|
__name: "RenderBlock",
|
|
740
1032
|
props: {
|
|
741
1033
|
block: {},
|
|
742
1034
|
resolvedComponent: {}
|
|
743
1035
|
},
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
1036
|
+
emits: ["select"],
|
|
1037
|
+
setup(t, { emit: e }) {
|
|
1038
|
+
const s = t, i = e, o = te(() => s.block.data || {}), l = te(
|
|
1039
|
+
() => s.block.selectable && _.value.length > 1
|
|
1040
|
+
), _ = te(() => Array.isArray(o.value) ? o.value : o.value.list ? Array.isArray(o.value.list) ? o.value.list : [] : o.value.items ? Array.isArray(o.value.items) ? o.value.items : [] : [o.value]), b = te(() => {
|
|
1041
|
+
var m;
|
|
1042
|
+
return _.value.length ? (m = s.block.fields) != null && m.length ? s.block.fields : Object.keys(_.value[0]) : [];
|
|
1043
|
+
}), a = te(
|
|
1044
|
+
() => 100
|
|
1045
|
+
// headers.value.length ? Math.floor(100 / headers.value.length) + '%' : undefined,
|
|
1046
|
+
);
|
|
1047
|
+
function r(m) {
|
|
1048
|
+
return typeof m == "string" ? m : Object.values(m).join(" - ");
|
|
748
1049
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
(
|
|
770
|
-
])
|
|
771
|
-
])) : z("", !0),
|
|
772
|
-
f("tbody", null, [
|
|
773
|
-
(a(!0), m(K, null, U(d.value, (u, n) => (a(), m("tr", { key: n }, [
|
|
774
|
-
(a(!0), m(K, null, U(r.value, (g) => {
|
|
775
|
-
var y;
|
|
776
|
-
return a(), m("td", { key: g }, V((y = u[g]) != null ? y : ""), 1);
|
|
777
|
-
}), 128))
|
|
1050
|
+
function h(m) {
|
|
1051
|
+
var H;
|
|
1052
|
+
const $ = (s.block.labelField && (m == null ? void 0 : m[s.block.labelField]) != null ? m[s.block.labelField] : (H = s.block.fields) != null && H.length ? m == null ? void 0 : m[s.block.fields[0]] : (m == null ? void 0 : m.name) ?? (m == null ? void 0 : m.title) ?? (m == null ? void 0 : m.id) ?? Object.values(m ?? {})[0]) ?? "";
|
|
1053
|
+
i("select", `我选择 ${$}`);
|
|
1054
|
+
}
|
|
1055
|
+
return (m, $) => {
|
|
1056
|
+
const H = P("el-button");
|
|
1057
|
+
return u(), x("div", Mt, [
|
|
1058
|
+
t.block.title ? (u(), x("div", It, L(t.block.title), 1)) : R("", !0),
|
|
1059
|
+
t.resolvedComponent ? (u(), D(He(t.resolvedComponent), {
|
|
1060
|
+
key: 1,
|
|
1061
|
+
class: "render-block__component",
|
|
1062
|
+
data: t.block.data
|
|
1063
|
+
}, null, 8, ["data"])) : t.block.type === "component" ? (u(), x("div", At, [
|
|
1064
|
+
y("div", Vt, [
|
|
1065
|
+
(u(!0), x(G, null, X(_.value[0], (I, A) => (u(), x("div", {
|
|
1066
|
+
key: A,
|
|
1067
|
+
class: "card-field"
|
|
1068
|
+
}, [
|
|
1069
|
+
y("span", Pt, L(A) + ":", 1),
|
|
1070
|
+
y("span", Tt, L(I), 1)
|
|
778
1071
|
]))), 128))
|
|
779
1072
|
])
|
|
780
|
-
])
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
1073
|
+
])) : t.block.type === "table" ? (u(), x("div", zt, [
|
|
1074
|
+
p(S(Oe), {
|
|
1075
|
+
data: _.value,
|
|
1076
|
+
"max-height": Dt,
|
|
1077
|
+
border: "",
|
|
1078
|
+
stripe: "",
|
|
1079
|
+
size: "small",
|
|
1080
|
+
"table-layout": "fixed",
|
|
1081
|
+
style: { width: "100%" }
|
|
1082
|
+
}, {
|
|
1083
|
+
default: v(() => [
|
|
1084
|
+
(u(!0), x(G, null, X(b.value, (I) => (u(), D(S(_e), {
|
|
1085
|
+
key: I,
|
|
1086
|
+
prop: I,
|
|
1087
|
+
label: I,
|
|
1088
|
+
width: a.value,
|
|
1089
|
+
align: "center",
|
|
1090
|
+
"show-overflow-tooltip": ""
|
|
1091
|
+
}, null, 8, ["prop", "label", "width"]))), 128)),
|
|
1092
|
+
l.value ? (u(), D(S(_e), {
|
|
1093
|
+
key: 0,
|
|
1094
|
+
label: "操作",
|
|
1095
|
+
width: 80,
|
|
1096
|
+
align: "center",
|
|
1097
|
+
fixed: "right"
|
|
1098
|
+
}, {
|
|
1099
|
+
default: v(({ row: I }) => [
|
|
1100
|
+
p(H, {
|
|
1101
|
+
size: "small",
|
|
1102
|
+
type: "primary",
|
|
1103
|
+
plain: "",
|
|
1104
|
+
onClick: (A) => h(I)
|
|
1105
|
+
}, {
|
|
1106
|
+
default: v(() => [...$[0] || ($[0] = [
|
|
1107
|
+
O(" 选择 ", -1)
|
|
1108
|
+
])]),
|
|
1109
|
+
_: 1
|
|
1110
|
+
}, 8, ["onClick"])
|
|
1111
|
+
]),
|
|
1112
|
+
_: 1
|
|
1113
|
+
})) : R("", !0)
|
|
1114
|
+
]),
|
|
1115
|
+
_: 1
|
|
1116
|
+
}, 8, ["data"])
|
|
1117
|
+
])) : t.block.type === "card" ? (u(), x("div", Bt, [
|
|
1118
|
+
(u(!0), x(G, null, X(_.value, (I, A) => (u(), x("div", {
|
|
1119
|
+
key: A,
|
|
1120
|
+
class: "card-item"
|
|
789
1121
|
}, [
|
|
790
|
-
|
|
791
|
-
|
|
1122
|
+
(u(!0), x(G, null, X(I, (w, T) => (u(), x("div", {
|
|
1123
|
+
key: T,
|
|
1124
|
+
class: "card-field"
|
|
1125
|
+
}, [
|
|
1126
|
+
y("span", Ht, L(T) + ":", 1),
|
|
1127
|
+
y("span", Nt, L(w), 1)
|
|
1128
|
+
]))), 128))
|
|
792
1129
|
]))), 128))
|
|
793
|
-
]))),
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
])
|
|
800
|
-
|
|
1130
|
+
])) : t.block.type === "list" ? (u(), x("div", Et, [
|
|
1131
|
+
(u(!0), x(G, null, X(_.value, (I, A) => (u(), x("div", {
|
|
1132
|
+
key: A,
|
|
1133
|
+
class: "list-item"
|
|
1134
|
+
}, L(r(I)), 1))), 128))
|
|
1135
|
+
])) : R("", !0)
|
|
1136
|
+
]);
|
|
1137
|
+
};
|
|
801
1138
|
}
|
|
802
|
-
})
|
|
803
|
-
const Q = (t, e) => {
|
|
1139
|
+
}), oe = (t, e) => {
|
|
804
1140
|
const s = t.__vccOpts || t;
|
|
805
|
-
for (const [
|
|
806
|
-
s[
|
|
1141
|
+
for (const [i, o] of e)
|
|
1142
|
+
s[i] = o;
|
|
807
1143
|
return s;
|
|
808
|
-
},
|
|
1144
|
+
}, jt = /* @__PURE__ */ oe(Ft, [["__scopeId", "data-v-0cb2fd61"]]), Ot = {
|
|
809
1145
|
key: 0,
|
|
810
1146
|
class: "suggested-next"
|
|
811
|
-
},
|
|
1147
|
+
}, Ut = { class: "suggested-next__text" }, Rt = /* @__PURE__ */ F({
|
|
812
1148
|
__name: "SuggestedNext",
|
|
813
1149
|
props: {
|
|
814
1150
|
text: {}
|
|
815
1151
|
},
|
|
816
1152
|
emits: ["execute"],
|
|
817
1153
|
setup(t, { emit: e }) {
|
|
818
|
-
const s = t,
|
|
819
|
-
function
|
|
820
|
-
|
|
1154
|
+
const s = t, i = e;
|
|
1155
|
+
function o() {
|
|
1156
|
+
i("execute", s.text);
|
|
821
1157
|
}
|
|
822
|
-
return (l,
|
|
823
|
-
const
|
|
824
|
-
return t.text ? (
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1158
|
+
return (l, _) => {
|
|
1159
|
+
const b = P("el-button");
|
|
1160
|
+
return t.text ? (u(), x("div", Ot, [
|
|
1161
|
+
_[1] || (_[1] = y("span", { class: "suggested-next__icon" }, "💡", -1)),
|
|
1162
|
+
y("span", Ut, L(t.text), 1),
|
|
1163
|
+
p(b, {
|
|
828
1164
|
size: "small",
|
|
829
1165
|
type: "primary",
|
|
830
1166
|
plain: "",
|
|
831
|
-
onClick:
|
|
1167
|
+
onClick: o
|
|
832
1168
|
}, {
|
|
833
|
-
default: v(() => [...
|
|
834
|
-
|
|
1169
|
+
default: v(() => [..._[0] || (_[0] = [
|
|
1170
|
+
O("去执行", -1)
|
|
835
1171
|
])]),
|
|
836
1172
|
_: 1
|
|
837
1173
|
})
|
|
838
|
-
])) :
|
|
1174
|
+
])) : R("", !0);
|
|
839
1175
|
};
|
|
840
1176
|
}
|
|
841
|
-
})
|
|
842
|
-
const lt = /* @__PURE__ */ Q(ot, [["__scopeId", "data-v-0e0e9b65"]]), it = { class: "message-avatar" }, rt = { class: "message-body" }, ct = {
|
|
1177
|
+
}), Kt = /* @__PURE__ */ oe(Rt, [["__scopeId", "data-v-0e0e9b65"]]), Lt = { class: "message-avatar" }, Jt = { class: "message-body" }, Wt = {
|
|
843
1178
|
key: 0,
|
|
844
1179
|
class: "message-files"
|
|
845
|
-
},
|
|
1180
|
+
}, qt = ["src", "alt"], Gt = { class: "file-info" }, Yt = { class: "file-name" }, Xt = { class: "file-size" }, Qt = {
|
|
846
1181
|
key: 1,
|
|
847
1182
|
class: "message-user-text"
|
|
848
|
-
},
|
|
1183
|
+
}, Zt = {
|
|
849
1184
|
key: 0,
|
|
850
1185
|
class: "message-reasoning"
|
|
851
|
-
},
|
|
1186
|
+
}, es = ["innerHTML"], ts = {
|
|
852
1187
|
key: 3,
|
|
853
1188
|
class: "message-cursor"
|
|
854
|
-
},
|
|
1189
|
+
}, ss = {
|
|
855
1190
|
key: 4,
|
|
856
1191
|
class: "message-error"
|
|
857
|
-
},
|
|
1192
|
+
}, ns = /* @__PURE__ */ F({
|
|
858
1193
|
__name: "ChatMessage",
|
|
859
1194
|
props: {
|
|
860
1195
|
message: {},
|
|
@@ -862,102 +1197,100 @@ const lt = /* @__PURE__ */ Q(ot, [["__scopeId", "data-v-0e0e9b65"]]), it = { cla
|
|
|
862
1197
|
},
|
|
863
1198
|
emits: ["execute"],
|
|
864
1199
|
setup(t, { emit: e }) {
|
|
865
|
-
const s = t,
|
|
866
|
-
function
|
|
867
|
-
if (!
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
return n = n.replace(/`([^`]+)`/g, "<code>$1</code>"), n = n.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), n = n.replace(/\*([^*]+)\*/g, "<em>$1</em>"), n = n.replace(/\n/g, "<br>"), n;
|
|
1200
|
+
const s = t, i = e;
|
|
1201
|
+
function o(a) {
|
|
1202
|
+
if (!a) return "";
|
|
1203
|
+
let r = a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1204
|
+
return r = r.replace(/`([^`]+)`/g, "<code>$1</code>"), r = r.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), r = r.replace(/\*([^*]+)\*/g, "<em>$1</em>"), r = r.replace(/\n/g, "<br>"), r;
|
|
871
1205
|
}
|
|
872
|
-
const l =
|
|
873
|
-
function
|
|
874
|
-
var
|
|
875
|
-
if (
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
)), n || (n = s.toolPackages[s.toolPackages.length - 1]), n && ((g = n.components) == null ? void 0 : g[u.componentName]) || null;
|
|
1206
|
+
const l = te(() => o(s.message.content));
|
|
1207
|
+
function _(a) {
|
|
1208
|
+
var h;
|
|
1209
|
+
if (a.type !== "component" || !a.componentName) return null;
|
|
1210
|
+
let r = a.packageId ? s.toolPackages.find((m) => m.id === a.packageId) : null;
|
|
1211
|
+
return r || (r = s.toolPackages.find(
|
|
1212
|
+
(m) => m.components && a.componentName in m.components
|
|
1213
|
+
)), r || (r = s.toolPackages[s.toolPackages.length - 1]), r && ((h = r.components) == null ? void 0 : h[a.componentName]) || null;
|
|
881
1214
|
}
|
|
882
|
-
function
|
|
883
|
-
|
|
1215
|
+
function b(a) {
|
|
1216
|
+
i("execute", a);
|
|
884
1217
|
}
|
|
885
|
-
return (
|
|
886
|
-
var
|
|
887
|
-
const
|
|
888
|
-
return
|
|
889
|
-
class:
|
|
1218
|
+
return (a, r) => {
|
|
1219
|
+
var m;
|
|
1220
|
+
const h = P("el-icon");
|
|
1221
|
+
return u(), x("div", {
|
|
1222
|
+
class: ie(["chat-message", [`role-${t.message.role}`, { "is-streaming": t.message.status === "streaming" }]])
|
|
890
1223
|
}, [
|
|
891
|
-
|
|
892
|
-
t.message.role === "user" ? (
|
|
1224
|
+
y("div", Lt, [
|
|
1225
|
+
t.message.role === "user" ? (u(), D(h, { key: 0 }, {
|
|
893
1226
|
default: v(() => [
|
|
894
|
-
|
|
1227
|
+
p(S(Ct))
|
|
895
1228
|
]),
|
|
896
1229
|
_: 1
|
|
897
|
-
})) : (
|
|
1230
|
+
})) : (u(), D(h, { key: 1 }, {
|
|
898
1231
|
default: v(() => [
|
|
899
|
-
|
|
1232
|
+
p(S(lt))
|
|
900
1233
|
]),
|
|
901
1234
|
_: 1
|
|
902
1235
|
}))
|
|
903
1236
|
]),
|
|
904
|
-
|
|
905
|
-
(
|
|
906
|
-
(
|
|
907
|
-
key:
|
|
908
|
-
class:
|
|
1237
|
+
y("div", Jt, [
|
|
1238
|
+
(m = t.message.files) != null && m.length ? (u(), x("div", Wt, [
|
|
1239
|
+
(u(!0), x(G, null, X(t.message.files, ($, H) => (u(), x("div", {
|
|
1240
|
+
key: H,
|
|
1241
|
+
class: ie(["message-file", { "is-image": $.type.startsWith("image/") }])
|
|
909
1242
|
}, [
|
|
910
|
-
|
|
1243
|
+
$.type.startsWith("image/") ? (u(), x("img", {
|
|
911
1244
|
key: 0,
|
|
912
|
-
src:
|
|
913
|
-
alt:
|
|
1245
|
+
src: $.data,
|
|
1246
|
+
alt: $.name,
|
|
914
1247
|
class: "file-image"
|
|
915
|
-
}, null, 8,
|
|
1248
|
+
}, null, 8, qt)) : (u(), D(h, { key: 1 }, {
|
|
916
1249
|
default: v(() => [
|
|
917
|
-
|
|
1250
|
+
p(S(be))
|
|
918
1251
|
]),
|
|
919
1252
|
_: 1
|
|
920
1253
|
})),
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1254
|
+
y("div", Gt, [
|
|
1255
|
+
y("span", Yt, L($.name), 1),
|
|
1256
|
+
y("span", Xt, L(($.size / 1024).toFixed(1)) + " KB", 1)
|
|
924
1257
|
])
|
|
925
1258
|
], 2))), 128))
|
|
926
|
-
])) :
|
|
927
|
-
t.message.role === "user" ? (
|
|
928
|
-
t.message.role === "assistant" ? (
|
|
929
|
-
t.message.reasoning ? (
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1259
|
+
])) : R("", !0),
|
|
1260
|
+
t.message.role === "user" ? (u(), x("div", Qt, L(t.message.content), 1)) : R("", !0),
|
|
1261
|
+
t.message.role === "assistant" ? (u(), x(G, { key: 2 }, [
|
|
1262
|
+
t.message.reasoning ? (u(), x("div", Zt, [
|
|
1263
|
+
y("details", null, [
|
|
1264
|
+
r[0] || (r[0] = y("summary", null, "推理过程", -1)),
|
|
1265
|
+
y("pre", null, L(t.message.reasoning), 1)
|
|
933
1266
|
])
|
|
934
|
-
])) :
|
|
935
|
-
|
|
1267
|
+
])) : R("", !0),
|
|
1268
|
+
y("div", {
|
|
936
1269
|
class: "message-content markdown-body",
|
|
937
1270
|
innerHTML: l.value
|
|
938
|
-
}, null, 8,
|
|
939
|
-
(
|
|
940
|
-
key:
|
|
941
|
-
block:
|
|
942
|
-
"resolved-component":
|
|
1271
|
+
}, null, 8, es),
|
|
1272
|
+
(u(!0), x(G, null, X(t.message.renderBlocks, ($, H) => (u(), D(jt, {
|
|
1273
|
+
key: H,
|
|
1274
|
+
block: $,
|
|
1275
|
+
"resolved-component": _($),
|
|
1276
|
+
onSelect: b
|
|
943
1277
|
}, null, 8, ["block", "resolved-component"]))), 128)),
|
|
944
|
-
t.message.suggestedNext ? (
|
|
1278
|
+
t.message.suggestedNext ? (u(), D(Kt, {
|
|
945
1279
|
key: 1,
|
|
946
1280
|
text: t.message.suggestedNext,
|
|
947
|
-
onExecute:
|
|
948
|
-
}, null, 8, ["text"])) :
|
|
949
|
-
], 64)) :
|
|
950
|
-
t.message.status === "streaming" ? (
|
|
951
|
-
t.message.status === "error" ? (
|
|
1281
|
+
onExecute: b
|
|
1282
|
+
}, null, 8, ["text"])) : R("", !0)
|
|
1283
|
+
], 64)) : R("", !0),
|
|
1284
|
+
t.message.status === "streaming" ? (u(), x("div", ts, "▍")) : R("", !0),
|
|
1285
|
+
t.message.status === "error" ? (u(), x("div", ss, L(t.message.error), 1)) : R("", !0)
|
|
952
1286
|
])
|
|
953
1287
|
], 2);
|
|
954
1288
|
};
|
|
955
1289
|
}
|
|
956
|
-
})
|
|
957
|
-
const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { class: "chat-input" }, xt = {
|
|
1290
|
+
}), os = /* @__PURE__ */ oe(ns, [["__scopeId", "data-v-af392c78"]]), as = { class: "chat-input" }, ls = {
|
|
958
1291
|
key: 0,
|
|
959
1292
|
class: "chat-input__files"
|
|
960
|
-
},
|
|
1293
|
+
}, is = { class: "chat-input__wrap" }, rs = { class: "chat-input__actions" }, cs = /* @__PURE__ */ F({
|
|
961
1294
|
__name: "ChatInput",
|
|
962
1295
|
props: {
|
|
963
1296
|
loading: { type: Boolean },
|
|
@@ -966,14 +1299,14 @@ const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { cla
|
|
|
966
1299
|
},
|
|
967
1300
|
emits: ["send"],
|
|
968
1301
|
setup(t, { emit: e }) {
|
|
969
|
-
const s = t,
|
|
970
|
-
() => (
|
|
1302
|
+
const s = t, i = e, o = W(""), l = W([]), _ = W(null), b = te(
|
|
1303
|
+
() => (o.value.trim().length > 0 || l.value.length > 0) && !s.disabled
|
|
971
1304
|
);
|
|
972
|
-
function
|
|
973
|
-
var
|
|
974
|
-
(
|
|
1305
|
+
function a() {
|
|
1306
|
+
var w;
|
|
1307
|
+
(w = _.value) == null || w.click();
|
|
975
1308
|
}
|
|
976
|
-
const
|
|
1309
|
+
const r = /* @__PURE__ */ new Set([
|
|
977
1310
|
"text/plain",
|
|
978
1311
|
"text/html",
|
|
979
1312
|
"text/css",
|
|
@@ -989,12 +1322,11 @@ const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { cla
|
|
|
989
1322
|
"application/yaml",
|
|
990
1323
|
"application/x-yaml"
|
|
991
1324
|
]);
|
|
992
|
-
function
|
|
993
|
-
var
|
|
994
|
-
if (
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const F = (w = h.name.split(".").pop()) == null ? void 0 : w.toLowerCase();
|
|
1325
|
+
function h(w) {
|
|
1326
|
+
var T;
|
|
1327
|
+
if (w.type.startsWith("text/") || r.has(w.type)) return !0;
|
|
1328
|
+
if (w.type === "" || w.type.startsWith("application/")) {
|
|
1329
|
+
const z = (T = w.name.split(".").pop()) == null ? void 0 : T.toLowerCase();
|
|
998
1330
|
return (/* @__PURE__ */ new Set([
|
|
999
1331
|
"txt",
|
|
1000
1332
|
"md",
|
|
@@ -1043,106 +1375,105 @@ const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { cla
|
|
|
1043
1375
|
"topojson",
|
|
1044
1376
|
"xlsx",
|
|
1045
1377
|
"docx"
|
|
1046
|
-
])).has(
|
|
1378
|
+
])).has(z ?? "");
|
|
1047
1379
|
}
|
|
1048
1380
|
return !1;
|
|
1049
1381
|
}
|
|
1050
|
-
function
|
|
1051
|
-
return new Promise((
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1382
|
+
function m(w) {
|
|
1383
|
+
return new Promise((T) => {
|
|
1384
|
+
const z = new FileReader();
|
|
1385
|
+
z.onload = () => {
|
|
1386
|
+
T({
|
|
1055
1387
|
id: "",
|
|
1056
|
-
name:
|
|
1057
|
-
size:
|
|
1058
|
-
type:
|
|
1059
|
-
data:
|
|
1388
|
+
name: w.name,
|
|
1389
|
+
size: w.size,
|
|
1390
|
+
type: w.type,
|
|
1391
|
+
data: z.result
|
|
1060
1392
|
});
|
|
1061
|
-
},
|
|
1393
|
+
}, h(w) ? z.readAsText(w) : z.readAsDataURL(w);
|
|
1062
1394
|
});
|
|
1063
1395
|
}
|
|
1064
|
-
async function
|
|
1065
|
-
var
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1068
|
-
for (const
|
|
1069
|
-
const
|
|
1070
|
-
l.value.push(
|
|
1396
|
+
async function $(w) {
|
|
1397
|
+
var z;
|
|
1398
|
+
const T = w.target;
|
|
1399
|
+
if ((z = T.files) != null && z.length) {
|
|
1400
|
+
for (const j of Array.from(T.files)) {
|
|
1401
|
+
const J = await m(j);
|
|
1402
|
+
l.value.push(J);
|
|
1071
1403
|
}
|
|
1072
|
-
|
|
1404
|
+
T.value = "";
|
|
1073
1405
|
}
|
|
1074
1406
|
}
|
|
1075
|
-
function
|
|
1076
|
-
l.value.splice(
|
|
1407
|
+
function H(w) {
|
|
1408
|
+
l.value.splice(w, 1);
|
|
1077
1409
|
}
|
|
1078
|
-
function
|
|
1079
|
-
|
|
1410
|
+
function I(w) {
|
|
1411
|
+
w.shiftKey || (w.preventDefault(), A());
|
|
1080
1412
|
}
|
|
1081
|
-
function
|
|
1082
|
-
if (!
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
d("send", h, l.value), r.value = "", l.value = [];
|
|
1413
|
+
function A() {
|
|
1414
|
+
if (!b.value || s.loading) return;
|
|
1415
|
+
const w = o.value.trim();
|
|
1416
|
+
i("send", w, l.value), o.value = "", l.value = [];
|
|
1086
1417
|
}
|
|
1087
|
-
return (
|
|
1088
|
-
const
|
|
1089
|
-
return
|
|
1090
|
-
l.value.length ? (
|
|
1091
|
-
(
|
|
1092
|
-
key:
|
|
1418
|
+
return (w, T) => {
|
|
1419
|
+
const z = P("el-icon"), j = P("el-tag"), J = P("el-input"), U = P("el-button"), N = P("el-tooltip");
|
|
1420
|
+
return u(), x("div", as, [
|
|
1421
|
+
l.value.length ? (u(), x("div", ls, [
|
|
1422
|
+
(u(!0), x(G, null, X(l.value, (g, f) => (u(), D(j, {
|
|
1423
|
+
key: f,
|
|
1093
1424
|
closable: "",
|
|
1094
1425
|
size: "small",
|
|
1095
|
-
type:
|
|
1096
|
-
onClose: (
|
|
1426
|
+
type: g.type.startsWith("image/") ? "success" : "info",
|
|
1427
|
+
onClose: (d) => H(f)
|
|
1097
1428
|
}, {
|
|
1098
1429
|
default: v(() => [
|
|
1099
|
-
|
|
1430
|
+
g.type.startsWith("image/") ? (u(), D(z, {
|
|
1100
1431
|
key: 0,
|
|
1101
1432
|
style: { "margin-right": "4px" }
|
|
1102
1433
|
}, {
|
|
1103
1434
|
default: v(() => [
|
|
1104
|
-
|
|
1435
|
+
p(S(yt))
|
|
1105
1436
|
]),
|
|
1106
1437
|
_: 1
|
|
1107
|
-
})) : (
|
|
1438
|
+
})) : (u(), D(z, {
|
|
1108
1439
|
key: 1,
|
|
1109
1440
|
style: { "margin-right": "4px" }
|
|
1110
1441
|
}, {
|
|
1111
1442
|
default: v(() => [
|
|
1112
|
-
|
|
1443
|
+
p(S(be))
|
|
1113
1444
|
]),
|
|
1114
1445
|
_: 1
|
|
1115
1446
|
})),
|
|
1116
|
-
|
|
1447
|
+
O(" " + L(g.name), 1)
|
|
1117
1448
|
]),
|
|
1118
1449
|
_: 2
|
|
1119
1450
|
}, 1032, ["type", "onClose"]))), 128))
|
|
1120
|
-
])) :
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
modelValue:
|
|
1124
|
-
"onUpdate:modelValue":
|
|
1451
|
+
])) : R("", !0),
|
|
1452
|
+
y("div", is, [
|
|
1453
|
+
p(J, {
|
|
1454
|
+
modelValue: o.value,
|
|
1455
|
+
"onUpdate:modelValue": T[0] || (T[0] = (g) => o.value = g),
|
|
1125
1456
|
type: "textarea",
|
|
1126
1457
|
autosize: { minRows: 1, maxRows: 6 },
|
|
1127
1458
|
resize: "none",
|
|
1128
1459
|
placeholder: t.placeholder,
|
|
1129
|
-
onKeydown:
|
|
1460
|
+
onKeydown: Ne(I, ["enter"])
|
|
1130
1461
|
}, null, 8, ["modelValue", "placeholder"]),
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
content: "
|
|
1462
|
+
y("div", rs, [
|
|
1463
|
+
p(N, {
|
|
1464
|
+
content: "上传文件",
|
|
1134
1465
|
placement: "top"
|
|
1135
1466
|
}, {
|
|
1136
1467
|
default: v(() => [
|
|
1137
|
-
|
|
1468
|
+
p(U, {
|
|
1138
1469
|
text: "",
|
|
1139
1470
|
circle: "",
|
|
1140
|
-
onClick:
|
|
1471
|
+
onClick: a
|
|
1141
1472
|
}, {
|
|
1142
1473
|
default: v(() => [
|
|
1143
|
-
|
|
1474
|
+
p(z, null, {
|
|
1144
1475
|
default: v(() => [
|
|
1145
|
-
|
|
1476
|
+
p(S(_t))
|
|
1146
1477
|
]),
|
|
1147
1478
|
_: 1
|
|
1148
1479
|
})
|
|
@@ -1152,26 +1483,26 @@ const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { cla
|
|
|
1152
1483
|
]),
|
|
1153
1484
|
_: 1
|
|
1154
1485
|
}),
|
|
1155
|
-
|
|
1486
|
+
y("input", {
|
|
1156
1487
|
ref_key: "fileInputRef",
|
|
1157
|
-
ref:
|
|
1488
|
+
ref: _,
|
|
1158
1489
|
type: "file",
|
|
1159
1490
|
multiple: "",
|
|
1160
1491
|
hidden: "",
|
|
1161
|
-
onChange:
|
|
1492
|
+
onChange: $
|
|
1162
1493
|
}, null, 544),
|
|
1163
|
-
|
|
1164
|
-
content: "Enter
|
|
1494
|
+
p(N, {
|
|
1495
|
+
content: "Enter 发送,Shift+Enter 换行",
|
|
1165
1496
|
placement: "top"
|
|
1166
1497
|
}, {
|
|
1167
1498
|
default: v(() => [
|
|
1168
|
-
|
|
1499
|
+
p(U, {
|
|
1169
1500
|
type: "primary",
|
|
1170
|
-
icon:
|
|
1501
|
+
icon: S(bt),
|
|
1171
1502
|
loading: t.loading,
|
|
1172
|
-
disabled: !
|
|
1503
|
+
disabled: !b.value,
|
|
1173
1504
|
circle: "",
|
|
1174
|
-
onClick:
|
|
1505
|
+
onClick: A
|
|
1175
1506
|
}, null, 8, ["icon", "loading", "disabled"])
|
|
1176
1507
|
]),
|
|
1177
1508
|
_: 1
|
|
@@ -1181,114 +1512,156 @@ const Et = /* @__PURE__ */ Q(yt, [["__scopeId", "data-v-fe82b4e5"]]), Ct = { cla
|
|
|
1181
1512
|
]);
|
|
1182
1513
|
};
|
|
1183
1514
|
}
|
|
1184
|
-
})
|
|
1185
|
-
|
|
1186
|
-
{ label: "deepseek-
|
|
1187
|
-
|
|
1188
|
-
], bt = { class: "form-tip" }, $t = { class: "temp-row" }, St = { class: "temp-val" }, It = /* @__PURE__ */ N({
|
|
1515
|
+
}), us = /* @__PURE__ */ oe(cs, [["__scopeId", "data-v-8fcb870c"]]), ds = [
|
|
1516
|
+
{ label: "deepseek-chat (V3 最强)", value: "deepseek-chat" },
|
|
1517
|
+
{ label: "deepseek-reasoner (R1 推理)", value: "deepseek-reasoner" }
|
|
1518
|
+
], ps = { class: "form-tip" }, ms = { class: "temp-row" }, fs = { class: "temp-val" }, gs = /* @__PURE__ */ F({
|
|
1189
1519
|
__name: "ChatSettings",
|
|
1190
1520
|
props: {
|
|
1191
1521
|
modelValue: { type: Boolean },
|
|
1192
|
-
settings: {}
|
|
1522
|
+
settings: {},
|
|
1523
|
+
deviceId: {}
|
|
1193
1524
|
},
|
|
1194
1525
|
emits: ["update:modelValue", "save"],
|
|
1195
1526
|
setup(t, { emit: e }) {
|
|
1196
|
-
const s = t,
|
|
1197
|
-
|
|
1527
|
+
const s = t, i = e, o = W(s.modelValue);
|
|
1528
|
+
le(
|
|
1198
1529
|
() => s.modelValue,
|
|
1199
|
-
(
|
|
1200
|
-
|
|
1530
|
+
(b) => {
|
|
1531
|
+
o.value = b, b && (l.value = { ...s.settings });
|
|
1201
1532
|
}
|
|
1202
|
-
),
|
|
1533
|
+
), le(o, (b) => i("update:modelValue", b));
|
|
1203
1534
|
const l = W({ ...s.settings });
|
|
1204
|
-
function
|
|
1205
|
-
|
|
1535
|
+
function _() {
|
|
1536
|
+
i("save", { ...l.value }), o.value = !1;
|
|
1206
1537
|
}
|
|
1207
|
-
return (
|
|
1208
|
-
const
|
|
1209
|
-
return
|
|
1210
|
-
modelValue:
|
|
1211
|
-
"onUpdate:modelValue":
|
|
1212
|
-
title: "AI
|
|
1538
|
+
return (b, a) => {
|
|
1539
|
+
const r = P("el-radio"), h = P("el-radio-group"), m = P("el-form-item"), $ = P("el-input"), H = P("el-link"), I = P("el-option"), A = P("el-select"), w = P("el-slider"), T = P("el-icon"), z = P("el-tooltip"), j = P("el-switch"), J = P("el-form"), U = P("el-button"), N = P("el-dialog");
|
|
1540
|
+
return u(), D(N, {
|
|
1541
|
+
modelValue: o.value,
|
|
1542
|
+
"onUpdate:modelValue": a[8] || (a[8] = (g) => o.value = g),
|
|
1543
|
+
title: "AI 助手设置",
|
|
1213
1544
|
width: "520px",
|
|
1214
1545
|
"append-to-body": ""
|
|
1215
1546
|
}, {
|
|
1216
1547
|
footer: v(() => [
|
|
1217
|
-
|
|
1218
|
-
onClick:
|
|
1548
|
+
p(U, {
|
|
1549
|
+
onClick: a[7] || (a[7] = (g) => o.value = !1)
|
|
1219
1550
|
}, {
|
|
1220
|
-
default: v(() => [...
|
|
1221
|
-
|
|
1551
|
+
default: v(() => [...a[17] || (a[17] = [
|
|
1552
|
+
O("取消", -1)
|
|
1222
1553
|
])]),
|
|
1223
1554
|
_: 1
|
|
1224
1555
|
}),
|
|
1225
|
-
|
|
1556
|
+
p(U, {
|
|
1226
1557
|
type: "primary",
|
|
1227
|
-
onClick:
|
|
1558
|
+
onClick: _
|
|
1228
1559
|
}, {
|
|
1229
|
-
default: v(() => [...
|
|
1230
|
-
|
|
1560
|
+
default: v(() => [...a[18] || (a[18] = [
|
|
1561
|
+
O("保存", -1)
|
|
1231
1562
|
])]),
|
|
1232
1563
|
_: 1
|
|
1233
1564
|
})
|
|
1234
1565
|
]),
|
|
1235
1566
|
default: v(() => [
|
|
1236
|
-
|
|
1567
|
+
p(J, {
|
|
1237
1568
|
model: l.value,
|
|
1238
1569
|
"label-width": "110px",
|
|
1239
1570
|
"label-position": "right"
|
|
1240
1571
|
}, {
|
|
1241
1572
|
default: v(() => [
|
|
1242
|
-
|
|
1573
|
+
p(m, { label: "调用模式" }, {
|
|
1243
1574
|
default: v(() => [
|
|
1244
|
-
|
|
1245
|
-
modelValue: l.value.
|
|
1246
|
-
"onUpdate:modelValue":
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
])
|
|
1575
|
+
p(h, {
|
|
1576
|
+
modelValue: l.value.providerMode,
|
|
1577
|
+
"onUpdate:modelValue": a[0] || (a[0] = (g) => l.value.providerMode = g)
|
|
1578
|
+
}, {
|
|
1579
|
+
default: v(() => [
|
|
1580
|
+
p(r, { value: "direct" }, {
|
|
1581
|
+
default: v(() => [...a[9] || (a[9] = [
|
|
1582
|
+
O("前端直连", -1)
|
|
1583
|
+
])]),
|
|
1584
|
+
_: 1
|
|
1585
|
+
}),
|
|
1586
|
+
p(r, { value: "proxy" }, {
|
|
1587
|
+
default: v(() => [...a[10] || (a[10] = [
|
|
1588
|
+
O("后端代理", -1)
|
|
1589
|
+
])]),
|
|
1590
|
+
_: 1
|
|
1591
|
+
})
|
|
1592
|
+
]),
|
|
1593
|
+
_: 1
|
|
1594
|
+
}, 8, ["modelValue"]),
|
|
1595
|
+
a[11] || (a[11] = y("div", { class: "form-tip" }, " 前端直连:API Key 保存在浏览器本地,浏览器直接调用模型 API。 后端代理:由你的后端转发请求,API Key 保存在服务端。 ", -1))
|
|
1266
1596
|
]),
|
|
1267
1597
|
_: 1
|
|
1268
1598
|
}),
|
|
1269
|
-
|
|
1599
|
+
l.value.providerMode === "direct" ? (u(), x(G, { key: 0 }, [
|
|
1600
|
+
p(m, { label: "API Key" }, {
|
|
1601
|
+
default: v(() => [
|
|
1602
|
+
p($, {
|
|
1603
|
+
modelValue: l.value.apiKey,
|
|
1604
|
+
"onUpdate:modelValue": a[1] || (a[1] = (g) => l.value.apiKey = g),
|
|
1605
|
+
type: "password",
|
|
1606
|
+
"show-password": "",
|
|
1607
|
+
placeholder: "sk-xxxxxxxxxxxxxxxx",
|
|
1608
|
+
clearable: ""
|
|
1609
|
+
}, null, 8, ["modelValue"]),
|
|
1610
|
+
y("div", ps, [
|
|
1611
|
+
a[13] || (a[13] = O(" 在 ", -1)),
|
|
1612
|
+
p(H, {
|
|
1613
|
+
type: "primary",
|
|
1614
|
+
href: "https://platform.deepseek.com/api_keys",
|
|
1615
|
+
target: "_blank"
|
|
1616
|
+
}, {
|
|
1617
|
+
default: v(() => [...a[12] || (a[12] = [
|
|
1618
|
+
O(" DeepSeek 开放平台 ", -1)
|
|
1619
|
+
])]),
|
|
1620
|
+
_: 1
|
|
1621
|
+
}),
|
|
1622
|
+
a[14] || (a[14] = O(" 获取,仅保存在浏览器本地。 ", -1))
|
|
1623
|
+
])
|
|
1624
|
+
]),
|
|
1625
|
+
_: 1
|
|
1626
|
+
}),
|
|
1627
|
+
p(m, { label: "接口地址" }, {
|
|
1628
|
+
default: v(() => [
|
|
1629
|
+
p($, {
|
|
1630
|
+
modelValue: l.value.baseUrl,
|
|
1631
|
+
"onUpdate:modelValue": a[2] || (a[2] = (g) => l.value.baseUrl = g),
|
|
1632
|
+
placeholder: "https://api.deepseek.com",
|
|
1633
|
+
clearable: ""
|
|
1634
|
+
}, null, 8, ["modelValue"])
|
|
1635
|
+
]),
|
|
1636
|
+
_: 1
|
|
1637
|
+
})
|
|
1638
|
+
], 64)) : (u(), D(m, {
|
|
1639
|
+
key: 1,
|
|
1640
|
+
label: "代理地址"
|
|
1641
|
+
}, {
|
|
1270
1642
|
default: v(() => [
|
|
1271
|
-
|
|
1272
|
-
modelValue: l.value.
|
|
1273
|
-
"onUpdate:modelValue":
|
|
1274
|
-
placeholder: "
|
|
1643
|
+
p($, {
|
|
1644
|
+
modelValue: l.value.proxyUrl,
|
|
1645
|
+
"onUpdate:modelValue": a[3] || (a[3] = (g) => l.value.proxyUrl = g),
|
|
1646
|
+
placeholder: "http://localhost:3001/api/chat",
|
|
1275
1647
|
clearable: ""
|
|
1276
|
-
}, null, 8, ["modelValue"])
|
|
1648
|
+
}, null, 8, ["modelValue"]),
|
|
1649
|
+
a[15] || (a[15] = y("div", { class: "form-tip" }, " 你的后端代理服务地址,API Key 配置在服务端环境变量中。 ", -1))
|
|
1277
1650
|
]),
|
|
1278
1651
|
_: 1
|
|
1279
|
-
}),
|
|
1280
|
-
|
|
1652
|
+
})),
|
|
1653
|
+
p(m, { label: "模型" }, {
|
|
1281
1654
|
default: v(() => [
|
|
1282
|
-
|
|
1655
|
+
p(A, {
|
|
1283
1656
|
modelValue: l.value.model,
|
|
1284
|
-
"onUpdate:modelValue":
|
|
1657
|
+
"onUpdate:modelValue": a[4] || (a[4] = (g) => l.value.model = g),
|
|
1285
1658
|
style: { width: "100%" }
|
|
1286
1659
|
}, {
|
|
1287
1660
|
default: v(() => [
|
|
1288
|
-
(
|
|
1289
|
-
key:
|
|
1290
|
-
label:
|
|
1291
|
-
value:
|
|
1661
|
+
(u(!0), x(G, null, X(S(ds), (g) => (u(), D(I, {
|
|
1662
|
+
key: g.value,
|
|
1663
|
+
label: g.label,
|
|
1664
|
+
value: g.value
|
|
1292
1665
|
}, null, 8, ["label", "value"]))), 128))
|
|
1293
1666
|
]),
|
|
1294
1667
|
_: 1
|
|
@@ -1296,29 +1669,53 @@ const wt = /* @__PURE__ */ Q(Bt, [["__scopeId", "data-v-1f9902c6"]]), At = [
|
|
|
1296
1669
|
]),
|
|
1297
1670
|
_: 1
|
|
1298
1671
|
}),
|
|
1299
|
-
|
|
1672
|
+
p(m, { label: "温度" }, {
|
|
1300
1673
|
default: v(() => [
|
|
1301
|
-
|
|
1302
|
-
|
|
1674
|
+
y("div", ms, [
|
|
1675
|
+
p(w, {
|
|
1303
1676
|
modelValue: l.value.temperature,
|
|
1304
|
-
"onUpdate:modelValue":
|
|
1677
|
+
"onUpdate:modelValue": a[5] || (a[5] = (g) => l.value.temperature = g),
|
|
1305
1678
|
min: 0,
|
|
1306
1679
|
max: 2,
|
|
1307
1680
|
step: 0.1,
|
|
1308
1681
|
style: { flex: "1" }
|
|
1309
1682
|
}, null, 8, ["modelValue"]),
|
|
1310
|
-
|
|
1683
|
+
y("span", fs, L(l.value.temperature.toFixed(1)), 1)
|
|
1311
1684
|
])
|
|
1312
1685
|
]),
|
|
1313
1686
|
_: 1
|
|
1314
1687
|
}),
|
|
1315
|
-
|
|
1688
|
+
p(m, { label: "设备ID" }, {
|
|
1316
1689
|
default: v(() => [
|
|
1317
|
-
|
|
1690
|
+
p($, {
|
|
1691
|
+
"model-value": t.deviceId,
|
|
1692
|
+
readonly: ""
|
|
1693
|
+
}, {
|
|
1694
|
+
append: v(() => [
|
|
1695
|
+
p(z, { content: "该 ID 用于在服务端区分当前浏览器会话,历史消息按此 ID 保存" }, {
|
|
1696
|
+
default: v(() => [
|
|
1697
|
+
p(T, null, {
|
|
1698
|
+
default: v(() => [
|
|
1699
|
+
p(S(gt))
|
|
1700
|
+
]),
|
|
1701
|
+
_: 1
|
|
1702
|
+
})
|
|
1703
|
+
]),
|
|
1704
|
+
_: 1
|
|
1705
|
+
})
|
|
1706
|
+
]),
|
|
1707
|
+
_: 1
|
|
1708
|
+
}, 8, ["model-value"])
|
|
1709
|
+
]),
|
|
1710
|
+
_: 1
|
|
1711
|
+
}),
|
|
1712
|
+
p(m, { label: "启用工具" }, {
|
|
1713
|
+
default: v(() => [
|
|
1714
|
+
p(j, {
|
|
1318
1715
|
modelValue: l.value.useTools,
|
|
1319
|
-
"onUpdate:modelValue":
|
|
1716
|
+
"onUpdate:modelValue": a[6] || (a[6] = (g) => l.value.useTools = g)
|
|
1320
1717
|
}, null, 8, ["modelValue"]),
|
|
1321
|
-
|
|
1718
|
+
a[16] || (a[16] = y("span", { class: "form-tip-inline" }, "关闭后助手仅对话,不会执行页面导航/数据查询等操作", -1))
|
|
1322
1719
|
]),
|
|
1323
1720
|
_: 1
|
|
1324
1721
|
})
|
|
@@ -1330,245 +1727,329 @@ const wt = /* @__PURE__ */ Q(Bt, [["__scopeId", "data-v-1f9902c6"]]), At = [
|
|
|
1330
1727
|
}, 8, ["modelValue"]);
|
|
1331
1728
|
};
|
|
1332
1729
|
}
|
|
1333
|
-
})
|
|
1334
|
-
const Mt = /* @__PURE__ */ Q(It, [["__scopeId", "data-v-21ad42a2"]]), Vt = { class: "chat-panel" }, zt = {
|
|
1335
|
-
key: 0,
|
|
1336
|
-
class: "chat-panel__header"
|
|
1337
|
-
}, Tt = { class: "chat-panel__title" }, Pt = { class: "chat-panel__ops" }, jt = {
|
|
1730
|
+
}), hs = /* @__PURE__ */ oe(gs, [["__scopeId", "data-v-9634bbdc"]]), _s = { class: "chat-panel-root" }, vs = { class: "ai-fab__label" }, ys = { class: "chat-panel__header" }, xs = { class: "chat-panel__title" }, bs = { class: "chat-panel__ops" }, ws = {
|
|
1338
1731
|
key: 0,
|
|
1339
1732
|
class: "chat-empty"
|
|
1340
|
-
},
|
|
1733
|
+
}, ks = { class: "chat-empty__logo" }, Cs = {
|
|
1341
1734
|
key: 0,
|
|
1342
1735
|
class: "chat-panel__error"
|
|
1343
|
-
},
|
|
1736
|
+
}, $s = { class: "chat-panel__footer" }, Ss = {
|
|
1344
1737
|
key: 0,
|
|
1345
1738
|
class: "chat-panel__stop"
|
|
1346
|
-
},
|
|
1739
|
+
}, Ms = /* @__PURE__ */ F({
|
|
1347
1740
|
__name: "ChatPanel",
|
|
1348
1741
|
props: {
|
|
1349
1742
|
chat: {},
|
|
1350
|
-
|
|
1743
|
+
showFab: { type: Boolean, default: !0 }
|
|
1351
1744
|
},
|
|
1352
1745
|
setup(t) {
|
|
1353
1746
|
const e = t, {
|
|
1354
1747
|
messages: s,
|
|
1355
|
-
settings:
|
|
1356
|
-
loading:
|
|
1748
|
+
settings: i,
|
|
1749
|
+
loading: o,
|
|
1357
1750
|
errorMsg: l,
|
|
1358
|
-
hasApiKey:
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1751
|
+
hasApiKey: _,
|
|
1752
|
+
visible: b,
|
|
1753
|
+
toolPackages: a,
|
|
1754
|
+
sendMessage: r,
|
|
1755
|
+
stopGeneration: h,
|
|
1756
|
+
clearMessages: m,
|
|
1757
|
+
saveSettings: $,
|
|
1758
|
+
deviceId: H
|
|
1759
|
+
} = e.chat, I = W(!1), A = W(!1), w = W(null);
|
|
1760
|
+
function T() {
|
|
1761
|
+
b.value = !b.value;
|
|
1762
|
+
}
|
|
1763
|
+
function z() {
|
|
1764
|
+
b.value = !1;
|
|
1765
|
+
}
|
|
1766
|
+
function j() {
|
|
1767
|
+
A.value = !A.value;
|
|
1768
|
+
}
|
|
1769
|
+
function J() {
|
|
1770
|
+
je(() => {
|
|
1771
|
+
const f = w.value;
|
|
1772
|
+
f && (f.scrollTop = f.scrollHeight);
|
|
1369
1773
|
});
|
|
1370
1774
|
}
|
|
1371
|
-
function
|
|
1372
|
-
|
|
1775
|
+
function U(f, d) {
|
|
1776
|
+
r(f, d), J();
|
|
1373
1777
|
}
|
|
1374
|
-
function
|
|
1375
|
-
|
|
1778
|
+
function N(f) {
|
|
1779
|
+
$(f);
|
|
1376
1780
|
}
|
|
1377
|
-
function
|
|
1378
|
-
|
|
1781
|
+
function g() {
|
|
1782
|
+
Ue.confirm("确定要清空所有对话记录吗?", "提示", {
|
|
1379
1783
|
type: "warning",
|
|
1380
|
-
confirmButtonText: "
|
|
1381
|
-
cancelButtonText: "
|
|
1784
|
+
confirmButtonText: "清空",
|
|
1785
|
+
cancelButtonText: "取消"
|
|
1382
1786
|
}).then(() => {
|
|
1383
|
-
|
|
1787
|
+
m();
|
|
1384
1788
|
}).catch(() => {
|
|
1385
1789
|
});
|
|
1386
1790
|
}
|
|
1387
|
-
return
|
|
1388
|
-
() => s.value.map((
|
|
1389
|
-
var
|
|
1390
|
-
return
|
|
1791
|
+
return le(
|
|
1792
|
+
() => s.value.map((f) => {
|
|
1793
|
+
var d;
|
|
1794
|
+
return f.content + f.status + (((d = f.renderBlocks) == null ? void 0 : d.length) || 0);
|
|
1391
1795
|
}).join("|"),
|
|
1392
|
-
() =>
|
|
1393
|
-
), (
|
|
1394
|
-
const
|
|
1395
|
-
return
|
|
1396
|
-
t.
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1796
|
+
() => J()
|
|
1797
|
+
), (f, d) => {
|
|
1798
|
+
const V = P("ChatDotRound"), E = P("el-icon"), Y = P("el-tag"), ee = P("el-button"), Q = P("el-tooltip"), ce = P("el-alert");
|
|
1799
|
+
return u(), x("div", _s, [
|
|
1800
|
+
t.showFab ? (u(), x("div", {
|
|
1801
|
+
key: 0,
|
|
1802
|
+
class: ie(["ai-fab", { "ai-fab--active": S(b) }]),
|
|
1803
|
+
onClick: T
|
|
1804
|
+
}, [
|
|
1805
|
+
y("span", vs, L(S(b) ? "收起" : "AI 助手"), 1)
|
|
1806
|
+
], 2)) : R("", !0),
|
|
1807
|
+
Ee(y("div", {
|
|
1808
|
+
class: ie(["chat-panel", { "chat-panel--fullscreen": A.value }])
|
|
1809
|
+
}, [
|
|
1810
|
+
y("div", ys, [
|
|
1811
|
+
y("div", xs, [
|
|
1812
|
+
p(E, { class: "title-icon" }, {
|
|
1813
|
+
default: v(() => [
|
|
1814
|
+
p(V)
|
|
1815
|
+
]),
|
|
1816
|
+
_: 1
|
|
1817
|
+
}),
|
|
1818
|
+
d[5] || (d[5] = y("span", null, "AI 智能助手", -1)),
|
|
1819
|
+
S(_) ? (u(), D(Y, {
|
|
1820
|
+
key: 0,
|
|
1821
|
+
size: "small",
|
|
1822
|
+
type: "success",
|
|
1823
|
+
effect: "plain"
|
|
1824
|
+
}, {
|
|
1825
|
+
default: v(() => [...d[3] || (d[3] = [
|
|
1826
|
+
O("已配置", -1)
|
|
1827
|
+
])]),
|
|
1828
|
+
_: 1
|
|
1829
|
+
})) : (u(), D(Y, {
|
|
1830
|
+
key: 1,
|
|
1831
|
+
size: "small",
|
|
1832
|
+
type: "warning",
|
|
1833
|
+
effect: "plain"
|
|
1834
|
+
}, {
|
|
1835
|
+
default: v(() => [...d[4] || (d[4] = [
|
|
1836
|
+
O("未配置", -1)
|
|
1837
|
+
])]),
|
|
1838
|
+
_: 1
|
|
1839
|
+
}))
|
|
1840
|
+
]),
|
|
1841
|
+
y("div", bs, [
|
|
1842
|
+
p(Q, {
|
|
1843
|
+
content: "设置",
|
|
1844
|
+
placement: "bottom"
|
|
1845
|
+
}, {
|
|
1846
|
+
default: v(() => [
|
|
1847
|
+
p(ee, {
|
|
1848
|
+
text: "",
|
|
1849
|
+
circle: "",
|
|
1850
|
+
onClick: d[0] || (d[0] = (Z) => I.value = !0)
|
|
1851
|
+
}, {
|
|
1852
|
+
default: v(() => [
|
|
1853
|
+
p(E, null, {
|
|
1854
|
+
default: v(() => [
|
|
1855
|
+
p(S(xe))
|
|
1856
|
+
]),
|
|
1857
|
+
_: 1
|
|
1858
|
+
})
|
|
1859
|
+
]),
|
|
1860
|
+
_: 1
|
|
1861
|
+
})
|
|
1862
|
+
]),
|
|
1863
|
+
_: 1
|
|
1864
|
+
}),
|
|
1865
|
+
p(Q, {
|
|
1866
|
+
content: "清空对话",
|
|
1867
|
+
placement: "bottom"
|
|
1868
|
+
}, {
|
|
1869
|
+
default: v(() => [
|
|
1870
|
+
p(ee, {
|
|
1871
|
+
text: "",
|
|
1872
|
+
circle: "",
|
|
1873
|
+
disabled: !S(s).length,
|
|
1874
|
+
onClick: g
|
|
1875
|
+
}, {
|
|
1876
|
+
default: v(() => [
|
|
1877
|
+
p(E, null, {
|
|
1878
|
+
default: v(() => [
|
|
1879
|
+
p(S(ut))
|
|
1880
|
+
]),
|
|
1881
|
+
_: 1
|
|
1882
|
+
})
|
|
1883
|
+
]),
|
|
1884
|
+
_: 1
|
|
1885
|
+
}, 8, ["disabled"])
|
|
1886
|
+
]),
|
|
1887
|
+
_: 1
|
|
1888
|
+
}),
|
|
1889
|
+
p(Q, {
|
|
1890
|
+
content: A.value ? "退出全屏" : "全屏",
|
|
1891
|
+
placement: "bottom"
|
|
1892
|
+
}, {
|
|
1893
|
+
default: v(() => [
|
|
1894
|
+
p(ee, {
|
|
1895
|
+
text: "",
|
|
1896
|
+
circle: "",
|
|
1897
|
+
onClick: j
|
|
1898
|
+
}, {
|
|
1899
|
+
default: v(() => [
|
|
1900
|
+
p(E, null, {
|
|
1901
|
+
default: v(() => [
|
|
1902
|
+
p(S(mt))
|
|
1903
|
+
]),
|
|
1904
|
+
_: 1
|
|
1905
|
+
})
|
|
1906
|
+
]),
|
|
1907
|
+
_: 1
|
|
1908
|
+
})
|
|
1909
|
+
]),
|
|
1910
|
+
_: 1
|
|
1911
|
+
}, 8, ["content"]),
|
|
1912
|
+
p(Q, {
|
|
1913
|
+
content: "关闭",
|
|
1914
|
+
placement: "bottom"
|
|
1915
|
+
}, {
|
|
1916
|
+
default: v(() => [
|
|
1917
|
+
p(ee, {
|
|
1918
|
+
text: "",
|
|
1919
|
+
circle: "",
|
|
1920
|
+
onClick: z
|
|
1921
|
+
}, {
|
|
1922
|
+
default: v(() => [
|
|
1923
|
+
p(E, null, {
|
|
1924
|
+
default: v(() => [
|
|
1925
|
+
p(S(rt))
|
|
1926
|
+
]),
|
|
1927
|
+
_: 1
|
|
1928
|
+
})
|
|
1929
|
+
]),
|
|
1930
|
+
_: 1
|
|
1931
|
+
})
|
|
1932
|
+
]),
|
|
1933
|
+
_: 1
|
|
1934
|
+
})
|
|
1935
|
+
])
|
|
1426
1936
|
]),
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1937
|
+
y("div", {
|
|
1938
|
+
ref_key: "scrollRef",
|
|
1939
|
+
ref: w,
|
|
1940
|
+
class: "chat-panel__body"
|
|
1941
|
+
}, [
|
|
1942
|
+
S(s).length ? (u(!0), x(G, { key: 1 }, X(S(s), (Z) => (u(), D(os, {
|
|
1943
|
+
key: Z.id,
|
|
1944
|
+
message: Z,
|
|
1945
|
+
"tool-packages": S(a),
|
|
1946
|
+
onExecute: U
|
|
1947
|
+
}, null, 8, ["message", "tool-packages"]))), 128)) : (u(), x("div", ws, [
|
|
1948
|
+
y("div", ks, [
|
|
1949
|
+
p(E, null, {
|
|
1438
1950
|
default: v(() => [
|
|
1439
|
-
|
|
1440
|
-
default: v(() => [
|
|
1441
|
-
_(A(oe))
|
|
1442
|
-
]),
|
|
1443
|
-
_: 1
|
|
1444
|
-
})
|
|
1951
|
+
p(V)
|
|
1445
1952
|
]),
|
|
1446
1953
|
_: 1
|
|
1447
1954
|
})
|
|
1448
1955
|
]),
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
]),
|
|
1467
|
-
_: 1
|
|
1468
|
-
})
|
|
1469
|
-
]),
|
|
1470
|
-
_: 1
|
|
1471
|
-
}, 8, ["disabled"])
|
|
1472
|
-
]),
|
|
1473
|
-
_: 1
|
|
1474
|
-
})
|
|
1475
|
-
])
|
|
1476
|
-
])) : z("", !0),
|
|
1477
|
-
f("div", {
|
|
1478
|
-
ref_key: "scrollRef",
|
|
1479
|
-
ref: M,
|
|
1480
|
-
class: "chat-panel__body"
|
|
1481
|
-
}, [
|
|
1482
|
-
A(s).length ? (a(!0), m(K, { key: 1 }, U(A(s), (D) => (a(), j(Et, {
|
|
1483
|
-
key: D.id,
|
|
1484
|
-
message: D,
|
|
1485
|
-
"tool-packages": A(E),
|
|
1486
|
-
onExecute: T
|
|
1487
|
-
}, null, 8, ["message", "tool-packages"]))), 128)) : (a(), m("div", jt, [
|
|
1488
|
-
f("div", Nt, [
|
|
1489
|
-
_(J, null, {
|
|
1490
|
-
default: v(() => [
|
|
1491
|
-
_(H)
|
|
1492
|
-
]),
|
|
1956
|
+
d[7] || (d[7] = y("h3", null, "你好,我是系统 AI 助手", -1)),
|
|
1957
|
+
d[8] || (d[8] = y("p", { class: "chat-empty__desc" }, [
|
|
1958
|
+
O(" 我可以帮你"),
|
|
1959
|
+
y("span", { class: "hl" }, "查询数据"),
|
|
1960
|
+
O("、"),
|
|
1961
|
+
y("span", { class: "hl" }, "执行操作"),
|
|
1962
|
+
O("。试试输入指令: ")
|
|
1963
|
+
], -1)),
|
|
1964
|
+
S(_) ? R("", !0) : (u(), D(ee, {
|
|
1965
|
+
key: 0,
|
|
1966
|
+
type: "primary",
|
|
1967
|
+
icon: S(xe),
|
|
1968
|
+
onClick: d[1] || (d[1] = (Z) => I.value = !0)
|
|
1969
|
+
}, {
|
|
1970
|
+
default: v(() => [...d[6] || (d[6] = [
|
|
1971
|
+
O(" 先配置 API Key ", -1)
|
|
1972
|
+
])]),
|
|
1493
1973
|
_: 1
|
|
1494
|
-
})
|
|
1974
|
+
}, 8, ["icon"]))
|
|
1975
|
+
]))
|
|
1976
|
+
], 512),
|
|
1977
|
+
p(De, { name: "fade" }, {
|
|
1978
|
+
default: v(() => [
|
|
1979
|
+
S(l) ? (u(), x("div", Cs, [
|
|
1980
|
+
p(ce, {
|
|
1981
|
+
title: S(l),
|
|
1982
|
+
type: "error",
|
|
1983
|
+
"show-icon": "",
|
|
1984
|
+
closable: !1
|
|
1985
|
+
}, null, 8, ["title"])
|
|
1986
|
+
])) : R("", !0)
|
|
1495
1987
|
]),
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
_:
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
], 512),
|
|
1517
|
-
_(ge, { name: "fade" }, {
|
|
1518
|
-
default: v(() => [
|
|
1519
|
-
A(l) ? (a(), m("div", Rt, [
|
|
1520
|
-
_(I, {
|
|
1521
|
-
title: A(l),
|
|
1522
|
-
type: "error",
|
|
1523
|
-
"show-icon": "",
|
|
1524
|
-
closable: !1
|
|
1525
|
-
}, null, 8, ["title"])
|
|
1526
|
-
])) : z("", !0)
|
|
1988
|
+
_: 1
|
|
1989
|
+
}),
|
|
1990
|
+
y("div", $s, [
|
|
1991
|
+
S(o) ? (u(), x("div", Ss, [
|
|
1992
|
+
p(ee, {
|
|
1993
|
+
size: "small",
|
|
1994
|
+
icon: S(St),
|
|
1995
|
+
onClick: S(h)
|
|
1996
|
+
}, {
|
|
1997
|
+
default: v(() => [...d[9] || (d[9] = [
|
|
1998
|
+
O("停止生成", -1)
|
|
1999
|
+
])]),
|
|
2000
|
+
_: 1
|
|
2001
|
+
}, 8, ["icon", "onClick"])
|
|
2002
|
+
])) : R("", !0),
|
|
2003
|
+
p(us, {
|
|
2004
|
+
loading: S(o),
|
|
2005
|
+
placeholder: S(_) ? "输入指令..." : "请先配置 API Key",
|
|
2006
|
+
onSend: U
|
|
2007
|
+
}, null, 8, ["loading", "placeholder"])
|
|
1527
2008
|
]),
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
R("\u505C\u6B62\u751F\u6210", -1)
|
|
1539
|
-
])]),
|
|
1540
|
-
_: 1
|
|
1541
|
-
}, 8, ["icon", "onClick"])
|
|
1542
|
-
])) : z("", !0),
|
|
1543
|
-
_(wt, {
|
|
1544
|
-
loading: A(r),
|
|
1545
|
-
placeholder: A(p) ? "\u8F93\u5165\u6307\u4EE4..." : "\u8BF7\u5148\u914D\u7F6E API Key",
|
|
1546
|
-
onSend: T
|
|
1547
|
-
}, null, 8, ["loading", "placeholder"])
|
|
1548
|
-
]),
|
|
1549
|
-
_(Mt, {
|
|
1550
|
-
modelValue: C.value,
|
|
1551
|
-
"onUpdate:modelValue": c[2] || (c[2] = (D) => C.value = D),
|
|
1552
|
-
settings: A(d),
|
|
1553
|
-
onSave: h
|
|
1554
|
-
}, null, 8, ["modelValue", "settings"])
|
|
2009
|
+
p(hs, {
|
|
2010
|
+
modelValue: I.value,
|
|
2011
|
+
"onUpdate:modelValue": d[2] || (d[2] = (Z) => I.value = Z),
|
|
2012
|
+
settings: S(i),
|
|
2013
|
+
"device-id": S(H),
|
|
2014
|
+
onSave: N
|
|
2015
|
+
}, null, 8, ["modelValue", "settings", "device-id"])
|
|
2016
|
+
], 2), [
|
|
2017
|
+
[Fe, S(b)]
|
|
2018
|
+
])
|
|
1555
2019
|
]);
|
|
1556
2020
|
};
|
|
1557
2021
|
}
|
|
1558
|
-
});
|
|
1559
|
-
|
|
2022
|
+
}), Hs = /* @__PURE__ */ oe(Ms, [["__scopeId", "data-v-57d202bb"]]);
|
|
2023
|
+
function Is(t) {
|
|
2024
|
+
if (typeof t != "string")
|
|
2025
|
+
return t;
|
|
2026
|
+
try {
|
|
2027
|
+
const e = JSON.parse(t);
|
|
2028
|
+
return e !== null && (typeof e == "object" || Array.isArray(e)) ? e : t;
|
|
2029
|
+
} catch {
|
|
2030
|
+
return t;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2034
|
+
__proto__: null,
|
|
2035
|
+
parseStringToObject: Is
|
|
2036
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1560
2037
|
export {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
2038
|
+
Re as Agent,
|
|
2039
|
+
us as ChatInput,
|
|
2040
|
+
os as ChatMessageComp,
|
|
2041
|
+
Hs as ChatPanel,
|
|
2042
|
+
hs as ChatSettingsComp,
|
|
2043
|
+
ve as DEFAULT_SETTINGS,
|
|
2044
|
+
et as EventBus,
|
|
2045
|
+
Ns as ParseUtils,
|
|
2046
|
+
jt as RenderBlockComp,
|
|
2047
|
+
Kt as SuggestedNext,
|
|
2048
|
+
Ke as ToolRegistry,
|
|
2049
|
+
Ge as buildSystemPrompt,
|
|
2050
|
+
Je as createDeepSeekProvider,
|
|
2051
|
+
tt as createEventBus,
|
|
2052
|
+
We as createProxyProvider,
|
|
2053
|
+
zs as resolveRenderBlock,
|
|
2054
|
+
Bs as useAgentChat
|
|
1574
2055
|
};
|