@huyooo/ai-chat-frontend-vue 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter.d.ts +3 -35
- package/dist/adapter.d.ts.map +1 -1
- package/dist/components/ChatInput.vue.d.ts +2 -2
- package/dist/composables/useChat.d.ts +6 -2
- package/dist/composables/useChat.d.ts.map +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +678 -569
- package/dist/types/index.d.ts +9 -40
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/adapter.ts +40 -70
- package/src/composables/useChat.ts +6 -7
- package/src/index.ts +27 -17
- package/src/types/index.ts +21 -43
package/dist/index.js
CHANGED
|
@@ -1,21 +1,118 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { X as ne, Plus as de, Clock as
|
|
1
|
+
import { ref as R, shallowRef as Ee, defineComponent as K, computed as _, onMounted as oe, onUnmounted as fe, createElementBlock as c, openBlock as n, createElementVNode as t, Fragment as N, renderList as q, normalizeClass as E, toDisplayString as D, withModifiers as X, createVNode as z, unref as a, createCommentVNode as y, markRaw as W, createBlock as p, resolveDynamicComponent as te, watch as ae, withDirectives as Be, vModelText as Ne, reactive as Oe, toRef as Le, provide as He, nextTick as Ue } from "vue";
|
|
2
|
+
import { X as ne, Plus as de, Clock as _e, Trash2 as ve, MoreHorizontal as We, XCircle as qe, Download as Ve, Copy as ke, MessageSquare as Pe, Settings as Fe, Code as Je, FileText as pe, Search as ye, MessageCircle as be, Sparkles as Ce, Zap as ge, ChevronDown as j, Check as se, AtSign as Ge, Globe as ie, ImageIcon as Ke, Square as Qe, ArrowUp as Xe, Mic as je, Loader2 as ee, Lightbulb as we, RefreshCw as Ze, Video as Ye, Image as he, Terminal as et } from "lucide-vue-next";
|
|
3
|
+
function Jn(e = {}) {
|
|
4
|
+
const { bridgeName: h = "aiChatBridge" } = e, d = () => {
|
|
5
|
+
const s = window[h];
|
|
6
|
+
if (!s)
|
|
7
|
+
throw new Error("AI Chat Bridge not found. Make sure to call exposeElectronBridge() in preload.");
|
|
8
|
+
return s;
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
// ============ Chat API ============
|
|
12
|
+
async getModels() {
|
|
13
|
+
return (await d().getModels()).map((f) => ({
|
|
14
|
+
...f,
|
|
15
|
+
provider: f.provider,
|
|
16
|
+
supportedThinkingModes: f.supportedThinkingModes
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
async *sendMessage(s, o, f) {
|
|
20
|
+
const l = d(), m = [];
|
|
21
|
+
let M = null, k = !1;
|
|
22
|
+
const T = l.onProgress(($) => {
|
|
23
|
+
m.push($), M == null || M(), ($.type === "done" || $.type === "error") && (k = !0);
|
|
24
|
+
});
|
|
25
|
+
l.send({ message: s, images: f, options: o });
|
|
26
|
+
try {
|
|
27
|
+
for (; !k || m.length > 0; ) {
|
|
28
|
+
for (; m.length === 0 && !k; )
|
|
29
|
+
await new Promise(($) => M = $);
|
|
30
|
+
if (m.length > 0) {
|
|
31
|
+
const $ = m.shift();
|
|
32
|
+
if (yield $, $.type === "done" || $.type === "error")
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} finally {
|
|
37
|
+
T();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
cancel() {
|
|
41
|
+
d().cancel();
|
|
42
|
+
},
|
|
43
|
+
clearAgentHistory() {
|
|
44
|
+
d().clearAgentHistory();
|
|
45
|
+
},
|
|
46
|
+
async getAgentHistory() {
|
|
47
|
+
return d().getAgentHistory();
|
|
48
|
+
},
|
|
49
|
+
setWorkingDir(s) {
|
|
50
|
+
d().setWorkingDir(s);
|
|
51
|
+
},
|
|
52
|
+
// ============ Sessions API ============
|
|
53
|
+
async getSessions() {
|
|
54
|
+
return d().getSessions();
|
|
55
|
+
},
|
|
56
|
+
async getSession(s) {
|
|
57
|
+
return d().getSession(s);
|
|
58
|
+
},
|
|
59
|
+
async createSession(s) {
|
|
60
|
+
return d().createSession(s);
|
|
61
|
+
},
|
|
62
|
+
async updateSession(s, o) {
|
|
63
|
+
return d().updateSession(s, o);
|
|
64
|
+
},
|
|
65
|
+
async deleteSession(s) {
|
|
66
|
+
await d().deleteSession(s);
|
|
67
|
+
},
|
|
68
|
+
// ============ Messages API ============
|
|
69
|
+
async getMessages(s) {
|
|
70
|
+
return d().getMessages(s);
|
|
71
|
+
},
|
|
72
|
+
async saveMessage(s) {
|
|
73
|
+
return d().saveMessage(s);
|
|
74
|
+
},
|
|
75
|
+
async deleteMessagesAfter(s, o) {
|
|
76
|
+
await d().deleteMessagesAfter(s, o);
|
|
77
|
+
},
|
|
78
|
+
// ============ Operations API ============
|
|
79
|
+
async getOperations(s) {
|
|
80
|
+
return d().getOperations(s);
|
|
81
|
+
},
|
|
82
|
+
// ============ Trash API ============
|
|
83
|
+
async getTrashItems() {
|
|
84
|
+
return d().getTrashItems();
|
|
85
|
+
},
|
|
86
|
+
async restoreFromTrash(s) {
|
|
87
|
+
return d().restoreFromTrash(s);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
3
91
|
function tt() {
|
|
4
92
|
return {
|
|
93
|
+
async getModels() {
|
|
94
|
+
return [];
|
|
95
|
+
},
|
|
5
96
|
async getSessions() {
|
|
6
97
|
return [];
|
|
7
98
|
},
|
|
99
|
+
async getSession() {
|
|
100
|
+
return null;
|
|
101
|
+
},
|
|
8
102
|
async createSession(e) {
|
|
9
103
|
return {
|
|
10
104
|
id: Date.now().toString(),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
105
|
+
appId: null,
|
|
106
|
+
userId: null,
|
|
107
|
+
title: (e == null ? void 0 : e.title) || "新对话",
|
|
108
|
+
model: (e == null ? void 0 : e.model) || "",
|
|
109
|
+
mode: (e == null ? void 0 : e.mode) || "agent",
|
|
14
110
|
createdAt: /* @__PURE__ */ new Date(),
|
|
15
111
|
updatedAt: /* @__PURE__ */ new Date()
|
|
16
112
|
};
|
|
17
113
|
},
|
|
18
114
|
async updateSession() {
|
|
115
|
+
return null;
|
|
19
116
|
},
|
|
20
117
|
async deleteSession() {
|
|
21
118
|
},
|
|
@@ -28,12 +125,23 @@ function tt() {
|
|
|
28
125
|
sessionId: e.sessionId,
|
|
29
126
|
role: e.role,
|
|
30
127
|
content: e.content,
|
|
31
|
-
thinking: e.thinking,
|
|
32
|
-
toolCalls: e.toolCalls,
|
|
33
|
-
searchResults: e.searchResults,
|
|
128
|
+
thinking: e.thinking || null,
|
|
129
|
+
toolCalls: e.toolCalls || null,
|
|
130
|
+
searchResults: e.searchResults || null,
|
|
131
|
+
operationIds: null,
|
|
34
132
|
timestamp: /* @__PURE__ */ new Date()
|
|
35
133
|
};
|
|
36
134
|
},
|
|
135
|
+
async deleteMessagesAfter() {
|
|
136
|
+
},
|
|
137
|
+
async getOperations() {
|
|
138
|
+
return [];
|
|
139
|
+
},
|
|
140
|
+
async getTrashItems() {
|
|
141
|
+
return [];
|
|
142
|
+
},
|
|
143
|
+
async restoreFromTrash() {
|
|
144
|
+
},
|
|
37
145
|
async *sendMessage() {
|
|
38
146
|
yield { type: "text", data: "无可用的 Adapter" }, yield { type: "done", data: "" };
|
|
39
147
|
},
|
|
@@ -60,59 +168,59 @@ function nt(e) {
|
|
|
60
168
|
function st(e = {}) {
|
|
61
169
|
const {
|
|
62
170
|
adapter: h = tt(),
|
|
63
|
-
defaultModel:
|
|
64
|
-
defaultMode:
|
|
65
|
-
} = e,
|
|
171
|
+
defaultModel: d = "anthropic/claude-opus-4.5",
|
|
172
|
+
defaultMode: s = "agent"
|
|
173
|
+
} = e, o = R([]), f = R(null), l = R([]), m = R(s), M = R(d), k = R(!0), T = R(!0), $ = R(!1), B = Ee(null);
|
|
66
174
|
async function P() {
|
|
67
175
|
try {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
} catch (
|
|
71
|
-
console.error("加载会话失败:",
|
|
176
|
+
const v = await h.getSessions();
|
|
177
|
+
o.value = v, v.length > 0 && !f.value && await L(v[0].id);
|
|
178
|
+
} catch (v) {
|
|
179
|
+
console.error("加载会话失败:", v);
|
|
72
180
|
}
|
|
73
181
|
}
|
|
74
|
-
async function
|
|
75
|
-
if (f.value !==
|
|
76
|
-
f.value =
|
|
182
|
+
async function L(v) {
|
|
183
|
+
if (f.value !== v) {
|
|
184
|
+
f.value = v;
|
|
77
185
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const r =
|
|
81
|
-
r && (m.value = r.mode,
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("加载消息失败:",
|
|
186
|
+
const S = await h.getMessages(v);
|
|
187
|
+
l.value = S.map(nt);
|
|
188
|
+
const r = o.value.find((I) => I.id === v);
|
|
189
|
+
r && (m.value = r.mode, M.value = r.model);
|
|
190
|
+
} catch (S) {
|
|
191
|
+
console.error("加载消息失败:", S), l.value = [];
|
|
84
192
|
}
|
|
85
193
|
}
|
|
86
194
|
}
|
|
87
|
-
async function
|
|
195
|
+
async function F() {
|
|
88
196
|
try {
|
|
89
|
-
const
|
|
197
|
+
const v = await h.createSession({
|
|
90
198
|
title: "新对话",
|
|
91
|
-
model:
|
|
199
|
+
model: M.value,
|
|
92
200
|
mode: m.value
|
|
93
201
|
});
|
|
94
|
-
|
|
95
|
-
} catch (
|
|
96
|
-
console.error("创建会话失败:",
|
|
202
|
+
o.value = [v, ...o.value], f.value = v.id, l.value = [];
|
|
203
|
+
} catch (v) {
|
|
204
|
+
console.error("创建会话失败:", v);
|
|
97
205
|
}
|
|
98
206
|
}
|
|
99
|
-
async function
|
|
207
|
+
async function A(v) {
|
|
100
208
|
try {
|
|
101
|
-
await h.deleteSession(
|
|
102
|
-
} catch (
|
|
103
|
-
console.error("删除会话失败:",
|
|
209
|
+
await h.deleteSession(v), o.value = o.value.filter((S) => S.id !== v), f.value === v && (o.value.length > 0 ? await L(o.value[0].id) : (f.value = null, l.value = []));
|
|
210
|
+
} catch (S) {
|
|
211
|
+
console.error("删除会话失败:", S);
|
|
104
212
|
}
|
|
105
213
|
}
|
|
106
|
-
async function
|
|
107
|
-
f.value && await
|
|
214
|
+
async function x() {
|
|
215
|
+
f.value && await A(f.value);
|
|
108
216
|
}
|
|
109
|
-
function
|
|
110
|
-
const r =
|
|
217
|
+
function J(v, S) {
|
|
218
|
+
const r = l.value[v];
|
|
111
219
|
if (r) {
|
|
112
|
-
switch (
|
|
220
|
+
switch (S.type) {
|
|
113
221
|
case "thinking": {
|
|
114
|
-
const
|
|
115
|
-
|
|
222
|
+
const I = S.data;
|
|
223
|
+
I.content && (r.thinking = (r.thinking || "") + I.content), r.thinkingComplete = I.isComplete;
|
|
116
224
|
break;
|
|
117
225
|
}
|
|
118
226
|
case "search_start":
|
|
@@ -120,78 +228,78 @@ function st(e = {}) {
|
|
|
120
228
|
break;
|
|
121
229
|
case "search_result": {
|
|
122
230
|
r.searching = !1;
|
|
123
|
-
const
|
|
124
|
-
r.searchResults =
|
|
231
|
+
const I = S.data;
|
|
232
|
+
r.searchResults = I.results || [];
|
|
125
233
|
break;
|
|
126
234
|
}
|
|
127
235
|
case "tool_call": {
|
|
128
|
-
const
|
|
236
|
+
const I = S.data;
|
|
129
237
|
r.toolCalls || (r.toolCalls = []), r.toolCalls.push({
|
|
130
|
-
name:
|
|
131
|
-
args:
|
|
238
|
+
name: I.name,
|
|
239
|
+
args: I.args,
|
|
132
240
|
status: "running"
|
|
133
241
|
});
|
|
134
242
|
break;
|
|
135
243
|
}
|
|
136
244
|
case "tool_result": {
|
|
137
|
-
const
|
|
138
|
-
r.toolCalls && (r.toolCalls = r.toolCalls.map((
|
|
245
|
+
const I = S.data;
|
|
246
|
+
r.toolCalls && (r.toolCalls = r.toolCalls.map((H) => H.name === I.name && H.status === "running" ? { ...H, result: I.result, status: "success" } : H));
|
|
139
247
|
break;
|
|
140
248
|
}
|
|
141
249
|
case "text_delta":
|
|
142
|
-
r.content = (r.content || "") +
|
|
250
|
+
r.content = (r.content || "") + S.data;
|
|
143
251
|
break;
|
|
144
252
|
case "text":
|
|
145
|
-
r.content || (r.content =
|
|
253
|
+
r.content || (r.content = S.data);
|
|
146
254
|
break;
|
|
147
255
|
case "error":
|
|
148
256
|
r.content = (r.content || "") + `
|
|
149
257
|
|
|
150
|
-
❌ 错误: ${
|
|
258
|
+
❌ 错误: ${S.data}`;
|
|
151
259
|
break;
|
|
152
260
|
}
|
|
153
|
-
|
|
261
|
+
l.value = [...l.value];
|
|
154
262
|
}
|
|
155
263
|
}
|
|
156
|
-
async function C(
|
|
264
|
+
async function C(v, S) {
|
|
157
265
|
var u;
|
|
158
|
-
if (!
|
|
266
|
+
if (!v.trim() || $.value) return;
|
|
159
267
|
let r = f.value;
|
|
160
268
|
if (!r)
|
|
161
269
|
try {
|
|
162
|
-
const
|
|
270
|
+
const i = await h.createSession({
|
|
163
271
|
title: "新对话",
|
|
164
|
-
model:
|
|
272
|
+
model: M.value,
|
|
165
273
|
mode: m.value
|
|
166
274
|
});
|
|
167
|
-
|
|
168
|
-
} catch (
|
|
169
|
-
console.error("创建会话失败:",
|
|
275
|
+
o.value = [i, ...o.value], f.value = i.id, r = i.id;
|
|
276
|
+
} catch (i) {
|
|
277
|
+
console.error("创建会话失败:", i);
|
|
170
278
|
return;
|
|
171
279
|
}
|
|
172
|
-
const
|
|
280
|
+
const I = {
|
|
173
281
|
id: me(),
|
|
174
282
|
role: "user",
|
|
175
|
-
content:
|
|
176
|
-
images:
|
|
283
|
+
content: v,
|
|
284
|
+
images: S,
|
|
177
285
|
timestamp: /* @__PURE__ */ new Date()
|
|
178
286
|
};
|
|
179
|
-
|
|
287
|
+
l.value = [...l.value, I];
|
|
180
288
|
try {
|
|
181
289
|
if (await h.saveMessage({
|
|
182
290
|
sessionId: r,
|
|
183
291
|
role: "user",
|
|
184
|
-
content:
|
|
185
|
-
}),
|
|
186
|
-
const
|
|
187
|
-
await h.updateSession(r, { title:
|
|
188
|
-
(
|
|
292
|
+
content: v
|
|
293
|
+
}), l.value.length === 1) {
|
|
294
|
+
const i = v.slice(0, 20) + (v.length > 20 ? "..." : "");
|
|
295
|
+
await h.updateSession(r, { title: i }), o.value = o.value.map(
|
|
296
|
+
(w) => w.id === r ? { ...w, title: i } : w
|
|
189
297
|
);
|
|
190
298
|
}
|
|
191
|
-
} catch (
|
|
192
|
-
console.error("保存消息失败:",
|
|
299
|
+
} catch (i) {
|
|
300
|
+
console.error("保存消息失败:", i);
|
|
193
301
|
}
|
|
194
|
-
const
|
|
302
|
+
const H = l.value.length, Y = {
|
|
195
303
|
id: me(),
|
|
196
304
|
role: "assistant",
|
|
197
305
|
content: "",
|
|
@@ -201,106 +309,106 @@ function st(e = {}) {
|
|
|
201
309
|
loading: !0,
|
|
202
310
|
timestamp: /* @__PURE__ */ new Date()
|
|
203
311
|
};
|
|
204
|
-
|
|
312
|
+
l.value = [...l.value, Y], $.value = !0, B.value = new AbortController();
|
|
205
313
|
try {
|
|
206
|
-
for await (const
|
|
207
|
-
|
|
314
|
+
for await (const i of h.sendMessage(
|
|
315
|
+
v,
|
|
208
316
|
{
|
|
209
317
|
mode: m.value,
|
|
210
|
-
model:
|
|
211
|
-
enableWebSearch:
|
|
212
|
-
thinkingMode:
|
|
318
|
+
model: M.value,
|
|
319
|
+
enableWebSearch: k.value,
|
|
320
|
+
thinkingMode: T.value ? "enabled" : "disabled"
|
|
213
321
|
},
|
|
214
|
-
|
|
322
|
+
S
|
|
215
323
|
))
|
|
216
|
-
if ((u =
|
|
324
|
+
if ((u = B.value) != null && u.signal.aborted || (J(H, i), i.type === "done" || i.type === "error"))
|
|
217
325
|
break;
|
|
218
|
-
} catch (
|
|
219
|
-
console.error("发送消息失败:",
|
|
326
|
+
} catch (i) {
|
|
327
|
+
console.error("发送消息失败:", i), J(H, {
|
|
220
328
|
type: "error",
|
|
221
|
-
data:
|
|
329
|
+
data: i instanceof Error ? i.message : String(i)
|
|
222
330
|
});
|
|
223
331
|
} finally {
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
332
|
+
$.value = !1;
|
|
333
|
+
const i = l.value[H];
|
|
334
|
+
i && (i.loading = !1, l.value = [...l.value], r && h.saveMessage({
|
|
227
335
|
sessionId: r,
|
|
228
336
|
role: "assistant",
|
|
229
|
-
content:
|
|
230
|
-
thinking:
|
|
231
|
-
toolCalls:
|
|
232
|
-
searchResults:
|
|
233
|
-
}).catch((
|
|
337
|
+
content: i.content,
|
|
338
|
+
thinking: i.thinking,
|
|
339
|
+
toolCalls: i.toolCalls ? JSON.stringify(i.toolCalls) : void 0,
|
|
340
|
+
searchResults: i.searchResults ? JSON.stringify(i.searchResults) : void 0
|
|
341
|
+
}).catch((w) => console.error("保存助手消息失败:", w))), B.value = null;
|
|
234
342
|
}
|
|
235
343
|
}
|
|
236
|
-
function
|
|
237
|
-
var
|
|
238
|
-
h.cancel(), (
|
|
344
|
+
function g() {
|
|
345
|
+
var v;
|
|
346
|
+
h.cancel(), (v = B.value) == null || v.abort(), $.value = !1;
|
|
239
347
|
}
|
|
240
|
-
async function b(
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
348
|
+
async function b(v) {
|
|
349
|
+
const S = l.value.find((r) => r.id === v);
|
|
350
|
+
if (S)
|
|
243
351
|
try {
|
|
244
|
-
await navigator.clipboard.writeText(
|
|
245
|
-
(r) => r.id ===
|
|
352
|
+
await navigator.clipboard.writeText(S.content), l.value = l.value.map(
|
|
353
|
+
(r) => r.id === v ? { ...r, copied: !0 } : r
|
|
246
354
|
), setTimeout(() => {
|
|
247
|
-
|
|
248
|
-
(r) => r.id ===
|
|
355
|
+
l.value = l.value.map(
|
|
356
|
+
(r) => r.id === v ? { ...r, copied: !1 } : r
|
|
249
357
|
);
|
|
250
358
|
}, 2e3);
|
|
251
359
|
} catch (r) {
|
|
252
360
|
console.error("复制失败:", r);
|
|
253
361
|
}
|
|
254
362
|
}
|
|
255
|
-
function V(
|
|
256
|
-
var
|
|
257
|
-
if (
|
|
258
|
-
const r =
|
|
259
|
-
|
|
363
|
+
function V(v) {
|
|
364
|
+
var S;
|
|
365
|
+
if (v > 0 && ((S = l.value[v - 1]) == null ? void 0 : S.role) === "user") {
|
|
366
|
+
const r = l.value[v - 1];
|
|
367
|
+
l.value = l.value.slice(0, v - 1), C(r.content, r.images);
|
|
260
368
|
}
|
|
261
369
|
}
|
|
262
|
-
function G(
|
|
263
|
-
h.setWorkingDir && h.setWorkingDir(
|
|
370
|
+
function G(v) {
|
|
371
|
+
h.setWorkingDir && h.setWorkingDir(v);
|
|
264
372
|
}
|
|
265
373
|
return {
|
|
266
374
|
// 状态
|
|
267
|
-
sessions:
|
|
375
|
+
sessions: o,
|
|
268
376
|
currentSessionId: f,
|
|
269
|
-
messages:
|
|
270
|
-
isLoading:
|
|
377
|
+
messages: l,
|
|
378
|
+
isLoading: $,
|
|
271
379
|
mode: m,
|
|
272
|
-
model:
|
|
273
|
-
webSearch:
|
|
274
|
-
thinking:
|
|
380
|
+
model: M,
|
|
381
|
+
webSearch: k,
|
|
382
|
+
thinking: T,
|
|
275
383
|
// 会话方法
|
|
276
384
|
loadSessions: P,
|
|
277
|
-
switchSession:
|
|
278
|
-
createNewSession:
|
|
279
|
-
deleteSession:
|
|
280
|
-
deleteCurrentSession:
|
|
385
|
+
switchSession: L,
|
|
386
|
+
createNewSession: F,
|
|
387
|
+
deleteSession: A,
|
|
388
|
+
deleteCurrentSession: x,
|
|
281
389
|
// 消息方法
|
|
282
390
|
sendMessage: C,
|
|
283
|
-
cancelRequest:
|
|
391
|
+
cancelRequest: g,
|
|
284
392
|
copyMessage: b,
|
|
285
393
|
regenerateMessage: V,
|
|
286
394
|
// 配置方法
|
|
287
|
-
setMode: (
|
|
288
|
-
m.value =
|
|
395
|
+
setMode: (v) => {
|
|
396
|
+
m.value = v;
|
|
289
397
|
},
|
|
290
|
-
setModel: (
|
|
291
|
-
|
|
398
|
+
setModel: (v) => {
|
|
399
|
+
M.value = v;
|
|
292
400
|
},
|
|
293
|
-
setWebSearch: (
|
|
294
|
-
|
|
401
|
+
setWebSearch: (v) => {
|
|
402
|
+
k.value = v;
|
|
295
403
|
},
|
|
296
|
-
setThinking: (
|
|
297
|
-
|
|
404
|
+
setThinking: (v) => {
|
|
405
|
+
T.value = v;
|
|
298
406
|
},
|
|
299
407
|
// 工具方法
|
|
300
408
|
setWorkingDirectory: G
|
|
301
409
|
};
|
|
302
410
|
}
|
|
303
|
-
const
|
|
411
|
+
const $e = [
|
|
304
412
|
{
|
|
305
413
|
provider: "openrouter",
|
|
306
414
|
model: "anthropic/claude-opus-4.5",
|
|
@@ -349,7 +457,7 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
349
457
|
}, ct = ["title", "onClick"], rt = { class: "tab-title" }, ut = ["onClick"], dt = { class: "header-actions" }, vt = {
|
|
350
458
|
key: 0,
|
|
351
459
|
class: "dropdown-panel history-panel"
|
|
352
|
-
},
|
|
460
|
+
}, gt = { class: "panel-header" }, ht = { class: "panel-content" }, mt = ["onClick"], ft = { class: "history-title" }, kt = { class: "history-date" }, pt = ["onClick"], yt = {
|
|
353
461
|
key: 0,
|
|
354
462
|
class: "empty-state"
|
|
355
463
|
}, bt = {
|
|
@@ -364,85 +472,85 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
364
472
|
},
|
|
365
473
|
emits: ["new-session", "switch-session", "delete-session", "close", "clear-all", "close-others", "export", "copy-id", "feedback", "settings"],
|
|
366
474
|
setup(e, { emit: h }) {
|
|
367
|
-
const
|
|
368
|
-
() =>
|
|
369
|
-
),
|
|
370
|
-
function
|
|
475
|
+
const d = e, s = h, o = R(/* @__PURE__ */ new Set()), f = _(
|
|
476
|
+
() => d.sessions.filter((C) => !o.value.has(C.id))
|
|
477
|
+
), l = R(!1), m = R(!1), M = R(null), k = R(null);
|
|
478
|
+
function T(C) {
|
|
371
479
|
return C === "新对话" ? "New Chat" : C;
|
|
372
480
|
}
|
|
373
|
-
function
|
|
374
|
-
const
|
|
375
|
-
return G === 0 ? "今天" : G === 1 ? "昨天" : G < 7 ? `${G}天前` :
|
|
481
|
+
function $(C) {
|
|
482
|
+
const g = new Date(C), V = (/* @__PURE__ */ new Date()).getTime() - g.getTime(), G = Math.floor(V / (1e3 * 60 * 60 * 24));
|
|
483
|
+
return G === 0 ? "今天" : G === 1 ? "昨天" : G < 7 ? `${G}天前` : g.toLocaleDateString();
|
|
376
484
|
}
|
|
377
|
-
function
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
380
|
-
(b) => b.id !== C && !
|
|
485
|
+
function B(C) {
|
|
486
|
+
if (o.value = /* @__PURE__ */ new Set([...o.value, C]), C === d.currentSessionId) {
|
|
487
|
+
const g = d.sessions.filter(
|
|
488
|
+
(b) => b.id !== C && !o.value.has(b.id)
|
|
381
489
|
);
|
|
382
|
-
|
|
490
|
+
g.length > 0 && s("switch-session", g[0].id);
|
|
383
491
|
}
|
|
384
492
|
}
|
|
385
493
|
function P() {
|
|
386
|
-
|
|
494
|
+
l.value = !l.value, m.value = !1;
|
|
387
495
|
}
|
|
388
|
-
function
|
|
389
|
-
m.value = !m.value,
|
|
496
|
+
function L() {
|
|
497
|
+
m.value = !m.value, l.value = !1;
|
|
390
498
|
}
|
|
391
|
-
function
|
|
392
|
-
|
|
499
|
+
function F() {
|
|
500
|
+
s("new-session"), l.value = !1;
|
|
393
501
|
}
|
|
394
|
-
function
|
|
395
|
-
if (
|
|
396
|
-
const
|
|
397
|
-
|
|
502
|
+
function A(C) {
|
|
503
|
+
if (s("switch-session", C), o.value.has(C)) {
|
|
504
|
+
const g = new Set(o.value);
|
|
505
|
+
g.delete(C), o.value = g;
|
|
398
506
|
}
|
|
399
|
-
|
|
507
|
+
l.value = !1;
|
|
400
508
|
}
|
|
401
|
-
function
|
|
509
|
+
function x(C) {
|
|
402
510
|
switch (m.value = !1, C) {
|
|
403
511
|
case "clear-all":
|
|
404
|
-
|
|
512
|
+
s("clear-all");
|
|
405
513
|
break;
|
|
406
514
|
case "close-others":
|
|
407
|
-
|
|
515
|
+
s("close-others");
|
|
408
516
|
break;
|
|
409
517
|
case "export":
|
|
410
|
-
|
|
518
|
+
s("export");
|
|
411
519
|
break;
|
|
412
520
|
case "copy-id":
|
|
413
|
-
|
|
521
|
+
s("copy-id");
|
|
414
522
|
break;
|
|
415
523
|
case "feedback":
|
|
416
|
-
|
|
524
|
+
s("feedback");
|
|
417
525
|
break;
|
|
418
526
|
case "settings":
|
|
419
|
-
|
|
527
|
+
s("settings");
|
|
420
528
|
break;
|
|
421
529
|
}
|
|
422
530
|
}
|
|
423
|
-
function
|
|
424
|
-
const
|
|
425
|
-
|
|
531
|
+
function J(C) {
|
|
532
|
+
const g = C.target;
|
|
533
|
+
M.value && !M.value.contains(g) && (l.value = !1), k.value && !k.value.contains(g) && (m.value = !1);
|
|
426
534
|
}
|
|
427
535
|
return oe(() => {
|
|
428
|
-
document.addEventListener("click",
|
|
536
|
+
document.addEventListener("click", J);
|
|
429
537
|
}), fe(() => {
|
|
430
|
-
document.removeEventListener("click",
|
|
431
|
-
}), (C,
|
|
538
|
+
document.removeEventListener("click", J);
|
|
539
|
+
}), (C, g) => (n(), c("div", at, [
|
|
432
540
|
t("div", ot, [
|
|
433
|
-
f.value.length === 0 ? (n(),
|
|
541
|
+
f.value.length === 0 ? (n(), c("span", it, " New Chat ")) : (n(!0), c(N, { key: 1 }, q(f.value, (b) => (n(), c("div", {
|
|
434
542
|
key: b.id,
|
|
435
543
|
class: E(["tab-item", { active: b.id === e.currentSessionId }]),
|
|
436
544
|
title: b.title,
|
|
437
545
|
onClick: (V) => C.$emit("switch-session", b.id)
|
|
438
546
|
}, [
|
|
439
|
-
t("span", rt,
|
|
547
|
+
t("span", rt, D(T(b.title)), 1),
|
|
440
548
|
t("button", {
|
|
441
549
|
class: "tab-close",
|
|
442
|
-
onClick: X((V) =>
|
|
550
|
+
onClick: X((V) => B(b.id), ["stop"]),
|
|
443
551
|
title: "关闭标签"
|
|
444
552
|
}, [
|
|
445
|
-
|
|
553
|
+
z(a(ne), { size: 12 })
|
|
446
554
|
], 8, ut)
|
|
447
555
|
], 10, ct))), 128))
|
|
448
556
|
]),
|
|
@@ -450,129 +558,129 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
450
558
|
t("button", {
|
|
451
559
|
class: "icon-btn",
|
|
452
560
|
title: "新建对话",
|
|
453
|
-
onClick:
|
|
561
|
+
onClick: g[0] || (g[0] = (b) => C.$emit("new-session"))
|
|
454
562
|
}, [
|
|
455
|
-
|
|
563
|
+
z(a(de), { size: 14 })
|
|
456
564
|
]),
|
|
457
565
|
t("div", {
|
|
458
566
|
ref_key: "historyRef",
|
|
459
|
-
ref:
|
|
567
|
+
ref: M,
|
|
460
568
|
class: "dropdown-container"
|
|
461
569
|
}, [
|
|
462
570
|
t("button", {
|
|
463
|
-
class: E(["icon-btn", { active:
|
|
571
|
+
class: E(["icon-btn", { active: l.value }]),
|
|
464
572
|
title: "历史记录",
|
|
465
573
|
onClick: X(P, ["stop"])
|
|
466
574
|
}, [
|
|
467
|
-
|
|
575
|
+
z(a(_e), { size: 14 })
|
|
468
576
|
], 2),
|
|
469
|
-
|
|
470
|
-
t("div",
|
|
471
|
-
|
|
577
|
+
l.value ? (n(), c("div", vt, [
|
|
578
|
+
t("div", gt, [
|
|
579
|
+
g[8] || (g[8] = t("span", null, "历史记录", -1)),
|
|
472
580
|
t("button", {
|
|
473
581
|
class: "icon-btn small",
|
|
474
582
|
title: "新建对话",
|
|
475
|
-
onClick:
|
|
583
|
+
onClick: F
|
|
476
584
|
}, [
|
|
477
|
-
|
|
585
|
+
z(a(de), { size: 12 })
|
|
478
586
|
])
|
|
479
587
|
]),
|
|
480
|
-
t("div",
|
|
481
|
-
(n(!0),
|
|
588
|
+
t("div", ht, [
|
|
589
|
+
(n(!0), c(N, null, q(e.sessions, (b) => (n(), c("div", {
|
|
482
590
|
key: b.id,
|
|
483
591
|
class: E(["history-item", { active: b.id === e.currentSessionId }]),
|
|
484
|
-
onClick: (V) =>
|
|
592
|
+
onClick: (V) => A(b.id)
|
|
485
593
|
}, [
|
|
486
|
-
t("span", ft,
|
|
487
|
-
t("span", kt,
|
|
594
|
+
t("span", ft, D(b.title), 1),
|
|
595
|
+
t("span", kt, D($(b.updatedAt)), 1),
|
|
488
596
|
t("button", {
|
|
489
597
|
class: "history-delete",
|
|
490
598
|
title: "删除",
|
|
491
599
|
onClick: X((V) => C.$emit("delete-session", b.id), ["stop"])
|
|
492
600
|
}, [
|
|
493
|
-
|
|
601
|
+
z(a(ve), { size: 12 })
|
|
494
602
|
], 8, pt)
|
|
495
603
|
], 10, mt))), 128)),
|
|
496
|
-
e.sessions.length === 0 ? (n(),
|
|
604
|
+
e.sessions.length === 0 ? (n(), c("div", yt, " 暂无历史对话 ")) : y("", !0)
|
|
497
605
|
])
|
|
498
|
-
])) :
|
|
606
|
+
])) : y("", !0)
|
|
499
607
|
], 512),
|
|
500
608
|
t("div", {
|
|
501
609
|
ref_key: "moreRef",
|
|
502
|
-
ref:
|
|
610
|
+
ref: k,
|
|
503
611
|
class: "dropdown-container"
|
|
504
612
|
}, [
|
|
505
613
|
t("button", {
|
|
506
614
|
class: E(["icon-btn", { active: m.value }]),
|
|
507
615
|
title: "更多选项",
|
|
508
|
-
onClick: X(
|
|
616
|
+
onClick: X(L, ["stop"])
|
|
509
617
|
}, [
|
|
510
|
-
|
|
618
|
+
z(a(We), { size: 14 })
|
|
511
619
|
], 2),
|
|
512
|
-
m.value ? (n(),
|
|
620
|
+
m.value ? (n(), c("div", bt, [
|
|
513
621
|
t("button", {
|
|
514
622
|
class: "menu-item",
|
|
515
|
-
onClick:
|
|
623
|
+
onClick: g[1] || (g[1] = (b) => x("clear-all"))
|
|
516
624
|
}, [
|
|
517
|
-
|
|
518
|
-
|
|
625
|
+
z(a(ve), { size: 14 }),
|
|
626
|
+
g[9] || (g[9] = t("span", null, "清空所有对话", -1))
|
|
519
627
|
]),
|
|
520
628
|
t("button", {
|
|
521
629
|
class: "menu-item",
|
|
522
|
-
onClick:
|
|
630
|
+
onClick: g[2] || (g[2] = (b) => x("close-others"))
|
|
523
631
|
}, [
|
|
524
|
-
|
|
525
|
-
|
|
632
|
+
z(a(qe), { size: 14 }),
|
|
633
|
+
g[10] || (g[10] = t("span", null, "关闭其他对话", -1))
|
|
526
634
|
]),
|
|
527
|
-
|
|
635
|
+
g[15] || (g[15] = t("div", { class: "menu-divider" }, null, -1)),
|
|
528
636
|
t("button", {
|
|
529
637
|
class: "menu-item",
|
|
530
|
-
onClick:
|
|
638
|
+
onClick: g[3] || (g[3] = (b) => x("export"))
|
|
531
639
|
}, [
|
|
532
|
-
|
|
533
|
-
|
|
640
|
+
z(a(Ve), { size: 14 }),
|
|
641
|
+
g[11] || (g[11] = t("span", null, "导出对话", -1))
|
|
534
642
|
]),
|
|
535
643
|
t("button", {
|
|
536
644
|
class: "menu-item",
|
|
537
|
-
onClick:
|
|
645
|
+
onClick: g[4] || (g[4] = (b) => x("copy-id"))
|
|
538
646
|
}, [
|
|
539
|
-
|
|
540
|
-
|
|
647
|
+
z(a(ke), { size: 14 }),
|
|
648
|
+
g[12] || (g[12] = t("span", null, "复制请求 ID", -1))
|
|
541
649
|
]),
|
|
542
|
-
|
|
650
|
+
g[16] || (g[16] = t("div", { class: "menu-divider" }, null, -1)),
|
|
543
651
|
t("button", {
|
|
544
652
|
class: "menu-item",
|
|
545
|
-
onClick:
|
|
653
|
+
onClick: g[5] || (g[5] = (b) => x("feedback"))
|
|
546
654
|
}, [
|
|
547
|
-
|
|
548
|
-
|
|
655
|
+
z(a(Pe), { size: 14 }),
|
|
656
|
+
g[13] || (g[13] = t("span", null, "反馈", -1))
|
|
549
657
|
]),
|
|
550
658
|
t("button", {
|
|
551
659
|
class: "menu-item",
|
|
552
|
-
onClick:
|
|
660
|
+
onClick: g[6] || (g[6] = (b) => x("settings"))
|
|
553
661
|
}, [
|
|
554
|
-
|
|
555
|
-
|
|
662
|
+
z(a(Fe), { size: 14 }),
|
|
663
|
+
g[14] || (g[14] = t("span", null, "Agent 设置", -1))
|
|
556
664
|
])
|
|
557
|
-
])) :
|
|
665
|
+
])) : y("", !0)
|
|
558
666
|
], 512),
|
|
559
|
-
e.showClose ? (n(),
|
|
667
|
+
e.showClose ? (n(), c("button", {
|
|
560
668
|
key: 0,
|
|
561
669
|
class: "icon-btn",
|
|
562
670
|
title: "关闭",
|
|
563
|
-
onClick:
|
|
671
|
+
onClick: g[7] || (g[7] = (b) => C.$emit("close"))
|
|
564
672
|
}, [
|
|
565
|
-
|
|
566
|
-
])) :
|
|
673
|
+
z(a(ne), { size: 14 })
|
|
674
|
+
])) : y("", !0)
|
|
567
675
|
])
|
|
568
676
|
]));
|
|
569
677
|
}
|
|
570
678
|
}), Q = (e, h) => {
|
|
571
|
-
const
|
|
572
|
-
for (const [
|
|
573
|
-
|
|
574
|
-
return
|
|
575
|
-
},
|
|
679
|
+
const d = e.__vccOpts || e;
|
|
680
|
+
for (const [s, o] of h)
|
|
681
|
+
d[s] = o;
|
|
682
|
+
return d;
|
|
683
|
+
}, wt = /* @__PURE__ */ Q(Ct, [["__scopeId", "data-v-fd156e6a"]]), $t = { class: "welcome-message" }, St = { class: "welcome-icon" }, Mt = { class: "quick-actions" }, zt = ["onClick"], Rt = /* @__PURE__ */ K({
|
|
576
684
|
__name: "WelcomeMessage",
|
|
577
685
|
emits: ["quick-action"],
|
|
578
686
|
setup(e) {
|
|
@@ -581,7 +689,7 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
581
689
|
id: "code",
|
|
582
690
|
label: "写代码",
|
|
583
691
|
prompt: "帮我写一段代码",
|
|
584
|
-
icon: W(
|
|
692
|
+
icon: W(Je)
|
|
585
693
|
},
|
|
586
694
|
{
|
|
587
695
|
id: "explain",
|
|
@@ -602,23 +710,23 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
602
710
|
icon: W(be)
|
|
603
711
|
}
|
|
604
712
|
];
|
|
605
|
-
return (
|
|
713
|
+
return (d, s) => (n(), c("div", $t, [
|
|
606
714
|
t("div", St, [
|
|
607
|
-
|
|
715
|
+
z(a(Ce), { size: 48 })
|
|
608
716
|
]),
|
|
609
|
-
|
|
610
|
-
|
|
717
|
+
s[0] || (s[0] = t("h3", { class: "welcome-title" }, "AI Assistant", -1)),
|
|
718
|
+
s[1] || (s[1] = t("p", { class: "welcome-desc" }, "我可以帮你完成各种任务,试试下面的快捷操作:", -1)),
|
|
611
719
|
t("div", Mt, [
|
|
612
|
-
(n(),
|
|
613
|
-
key:
|
|
720
|
+
(n(), c(N, null, q(h, (o) => t("button", {
|
|
721
|
+
key: o.id,
|
|
614
722
|
class: "quick-btn",
|
|
615
|
-
onClick: (f) =>
|
|
723
|
+
onClick: (f) => d.$emit("quick-action", o.prompt)
|
|
616
724
|
}, [
|
|
617
|
-
(n(),
|
|
725
|
+
(n(), p(te(o.icon), {
|
|
618
726
|
size: 14,
|
|
619
727
|
class: "quick-icon"
|
|
620
728
|
})),
|
|
621
|
-
t("span", null,
|
|
729
|
+
t("span", null, D(o.label), 1)
|
|
622
730
|
], 8, zt)), 64))
|
|
623
731
|
])
|
|
624
732
|
]));
|
|
@@ -626,13 +734,13 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
626
734
|
}), Dt = /* @__PURE__ */ Q(Rt, [["__scopeId", "data-v-f478d3aa"]]), It = {
|
|
627
735
|
key: 0,
|
|
628
736
|
class: "attachment-preview"
|
|
629
|
-
}, Tt = { class: "preview-images" },
|
|
737
|
+
}, Tt = { class: "preview-images" }, At = ["src"], xt = ["title", "onClick"], Et = {
|
|
630
738
|
key: 0,
|
|
631
739
|
class: "preview-more"
|
|
632
|
-
},
|
|
740
|
+
}, Bt = { class: "input-field-wrapper" }, Nt = ["placeholder"], Ot = {
|
|
633
741
|
key: 1,
|
|
634
742
|
class: "input-controls"
|
|
635
|
-
},
|
|
743
|
+
}, Lt = { class: "input-left" }, Ht = ["onClick"], Ut = ["onClick"], _t = { class: "input-right" }, Wt = ["title"], qt = {
|
|
636
744
|
key: 1,
|
|
637
745
|
class: "icon-btn",
|
|
638
746
|
title: "语音输入"
|
|
@@ -645,53 +753,53 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
645
753
|
isLoading: { type: Boolean, default: !1 },
|
|
646
754
|
mode: { default: "agent" },
|
|
647
755
|
model: { default: "" },
|
|
648
|
-
models: { default: () =>
|
|
756
|
+
models: { default: () => $e },
|
|
649
757
|
webSearchEnabled: { type: Boolean, default: !1 },
|
|
650
758
|
thinkingEnabled: { type: Boolean, default: !1 }
|
|
651
759
|
},
|
|
652
760
|
emits: ["send", "remove-image", "cancel", "upload-image", "at-context", "update:mode", "update:model", "update:webSearch", "update:thinking"],
|
|
653
|
-
setup(e, { expose: h, emit:
|
|
654
|
-
const
|
|
761
|
+
setup(e, { expose: h, emit: d }) {
|
|
762
|
+
const s = e, o = d, f = _(() => s.variant === "message"), l = R(s.value), m = R(null), M = R(null), k = R(!1);
|
|
655
763
|
ae(
|
|
656
|
-
() =>
|
|
764
|
+
() => s.value,
|
|
657
765
|
(u) => {
|
|
658
|
-
|
|
766
|
+
l.value = u;
|
|
659
767
|
}
|
|
660
768
|
);
|
|
661
|
-
const
|
|
662
|
-
{ value: "agent", label: "Agent", icon: W(
|
|
769
|
+
const T = [
|
|
770
|
+
{ value: "agent", label: "Agent", icon: W(ge) },
|
|
663
771
|
{ value: "ask", label: "Ask", icon: W(be) }
|
|
664
|
-
],
|
|
665
|
-
const u =
|
|
772
|
+
], $ = R(!1), B = R(!1), P = _(() => !f.value || k.value), L = _(() => s.selectedImages.slice(0, 3)), F = _(() => s.selectedImages.length > 0 ? "描述你想要的效果..." : s.mode === "ask" ? "有什么问题想问我?" : "描述任务,@ 添加上下文"), A = _(() => {
|
|
773
|
+
const u = T.find((i) => i.value === s.mode);
|
|
666
774
|
return (u == null ? void 0 : u.label) || "Agent";
|
|
667
|
-
}),
|
|
668
|
-
const u =
|
|
669
|
-
return (u == null ? void 0 : u.icon) ||
|
|
670
|
-
}),
|
|
671
|
-
const u =
|
|
775
|
+
}), x = _(() => {
|
|
776
|
+
const u = T.find((i) => i.value === s.mode);
|
|
777
|
+
return (u == null ? void 0 : u.icon) || ge;
|
|
778
|
+
}), J = _(() => {
|
|
779
|
+
const u = s.models.find((i) => i.model === s.model);
|
|
672
780
|
return (u == null ? void 0 : u.displayName) || "Auto";
|
|
673
781
|
});
|
|
674
782
|
function C() {
|
|
675
|
-
|
|
783
|
+
$.value = !$.value, B.value = !1;
|
|
676
784
|
}
|
|
677
|
-
function
|
|
678
|
-
|
|
785
|
+
function g() {
|
|
786
|
+
B.value = !B.value, $.value = !1;
|
|
679
787
|
}
|
|
680
788
|
function b(u) {
|
|
681
|
-
|
|
789
|
+
o("update:mode", u), $.value = !1;
|
|
682
790
|
}
|
|
683
791
|
function V(u) {
|
|
684
|
-
|
|
792
|
+
o("update:model", u.model), B.value = !1;
|
|
685
793
|
}
|
|
686
794
|
function G(u) {
|
|
687
795
|
return u.startsWith("app://") || u.startsWith("file://") || u.startsWith("data:") || u.startsWith("http") ? u : u.match(/^[A-Z]:\\/i) ? `app://file${encodeURIComponent(u.replace(/\\/g, "/"))}` : `app://file${encodeURIComponent(u)}`;
|
|
688
796
|
}
|
|
689
|
-
function
|
|
690
|
-
const
|
|
691
|
-
|
|
797
|
+
function v(u) {
|
|
798
|
+
const i = u.target;
|
|
799
|
+
i.style.display = "none";
|
|
692
800
|
}
|
|
693
|
-
function
|
|
694
|
-
|
|
801
|
+
function S(u) {
|
|
802
|
+
o("remove-image", u);
|
|
695
803
|
}
|
|
696
804
|
function r() {
|
|
697
805
|
if (m.value) {
|
|
@@ -700,21 +808,21 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
700
808
|
m.value.style.height = `${Math.min(u, 150)}px`;
|
|
701
809
|
}
|
|
702
810
|
}
|
|
703
|
-
function
|
|
704
|
-
var
|
|
705
|
-
if (
|
|
706
|
-
|
|
811
|
+
function I() {
|
|
812
|
+
var i;
|
|
813
|
+
if (s.isLoading) {
|
|
814
|
+
o("cancel");
|
|
707
815
|
return;
|
|
708
816
|
}
|
|
709
|
-
const u =
|
|
710
|
-
u && (
|
|
817
|
+
const u = l.value.trim();
|
|
818
|
+
u && (o("send", u), f.value ? k.value = !1 : (l.value = "", m.value && (m.value.style.height = "auto"), (i = m.value) == null || i.focus()));
|
|
711
819
|
}
|
|
712
|
-
function
|
|
713
|
-
u.key === "Enter" && !u.shiftKey ? (u.preventDefault(),
|
|
820
|
+
function H(u) {
|
|
821
|
+
u.key === "Enter" && !u.shiftKey ? (u.preventDefault(), I()) : setTimeout(r, 0);
|
|
714
822
|
}
|
|
715
823
|
function Y(u) {
|
|
716
|
-
const
|
|
717
|
-
|
|
824
|
+
const i = u.target;
|
|
825
|
+
i.closest(".selector") || ($.value = !1, B.value = !1), f.value && M.value && !M.value.contains(i) && (k.value = !1);
|
|
718
826
|
}
|
|
719
827
|
return oe(() => {
|
|
720
828
|
document.addEventListener("click", Y);
|
|
@@ -726,177 +834,177 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
726
834
|
return (u = m.value) == null ? void 0 : u.focus();
|
|
727
835
|
},
|
|
728
836
|
setText: (u) => {
|
|
729
|
-
|
|
837
|
+
l.value = u;
|
|
730
838
|
},
|
|
731
839
|
clear: () => {
|
|
732
|
-
|
|
840
|
+
l.value = "";
|
|
733
841
|
}
|
|
734
|
-
}), (u,
|
|
842
|
+
}), (u, i) => (n(), c("div", {
|
|
735
843
|
class: E(["chat-input", { "message-variant": f.value }])
|
|
736
844
|
}, [
|
|
737
845
|
t("div", {
|
|
738
846
|
ref_key: "containerRef",
|
|
739
|
-
ref:
|
|
740
|
-
class: E(["input-container", { focused:
|
|
847
|
+
ref: M,
|
|
848
|
+
class: E(["input-container", { focused: k.value }])
|
|
741
849
|
}, [
|
|
742
|
-
e.selectedImages.length > 0 ? (n(),
|
|
850
|
+
e.selectedImages.length > 0 ? (n(), c("div", It, [
|
|
743
851
|
t("div", Tt, [
|
|
744
|
-
(n(!0),
|
|
745
|
-
key: `${
|
|
852
|
+
(n(!0), c(N, null, q(L.value, (w, Z) => (n(), c("div", {
|
|
853
|
+
key: `${w}-${Z}`,
|
|
746
854
|
class: "preview-item"
|
|
747
855
|
}, [
|
|
748
856
|
t("img", {
|
|
749
|
-
src: G(
|
|
857
|
+
src: G(w),
|
|
750
858
|
class: "preview-thumb",
|
|
751
|
-
onError:
|
|
752
|
-
}, null, 40,
|
|
753
|
-
f.value ?
|
|
859
|
+
onError: v
|
|
860
|
+
}, null, 40, At),
|
|
861
|
+
f.value ? y("", !0) : (n(), c("button", {
|
|
754
862
|
key: 0,
|
|
755
863
|
class: "remove-btn",
|
|
756
864
|
title: `移除图片 ${Z + 1}`,
|
|
757
|
-
onClick: (ce) =>
|
|
865
|
+
onClick: (ce) => S(Z)
|
|
758
866
|
}, [
|
|
759
|
-
|
|
760
|
-
], 8,
|
|
867
|
+
z(a(ne), { size: 10 })
|
|
868
|
+
], 8, xt))
|
|
761
869
|
]))), 128)),
|
|
762
|
-
e.selectedImages.length > 3 ? (n(),
|
|
870
|
+
e.selectedImages.length > 3 ? (n(), c("div", Et, " +" + D(e.selectedImages.length - 3), 1)) : y("", !0)
|
|
763
871
|
])
|
|
764
|
-
])) :
|
|
765
|
-
t("div",
|
|
766
|
-
|
|
872
|
+
])) : y("", !0),
|
|
873
|
+
t("div", Bt, [
|
|
874
|
+
Be(t("textarea", {
|
|
767
875
|
ref_key: "inputRef",
|
|
768
876
|
ref: m,
|
|
769
|
-
"onUpdate:modelValue":
|
|
770
|
-
placeholder:
|
|
877
|
+
"onUpdate:modelValue": i[0] || (i[0] = (w) => l.value = w),
|
|
878
|
+
placeholder: F.value,
|
|
771
879
|
rows: "1",
|
|
772
880
|
class: "input-field",
|
|
773
|
-
onKeydown:
|
|
881
|
+
onKeydown: H,
|
|
774
882
|
onInput: r,
|
|
775
|
-
onFocus:
|
|
776
|
-
}, null, 40,
|
|
777
|
-
[
|
|
883
|
+
onFocus: i[1] || (i[1] = (w) => k.value = !0)
|
|
884
|
+
}, null, 40, Nt), [
|
|
885
|
+
[Ne, l.value]
|
|
778
886
|
])
|
|
779
887
|
]),
|
|
780
|
-
P.value ? (n(),
|
|
781
|
-
t("div",
|
|
888
|
+
P.value ? (n(), c("div", Ot, [
|
|
889
|
+
t("div", Lt, [
|
|
782
890
|
t("div", {
|
|
783
891
|
class: "selector mode-selector",
|
|
784
892
|
onClick: X(C, ["stop"])
|
|
785
893
|
}, [
|
|
786
|
-
(n(),
|
|
787
|
-
t("span", null,
|
|
788
|
-
|
|
894
|
+
(n(), p(te(x.value), { size: 12 })),
|
|
895
|
+
t("span", null, D(A.value), 1),
|
|
896
|
+
z(a(j), {
|
|
789
897
|
size: 10,
|
|
790
898
|
class: "chevron"
|
|
791
899
|
}),
|
|
792
|
-
|
|
900
|
+
$.value ? (n(), c("div", {
|
|
793
901
|
key: 0,
|
|
794
902
|
class: "dropdown-menu",
|
|
795
|
-
onClick:
|
|
903
|
+
onClick: i[2] || (i[2] = X(() => {
|
|
796
904
|
}, ["stop"]))
|
|
797
905
|
}, [
|
|
798
|
-
(n(),
|
|
799
|
-
key:
|
|
800
|
-
class: E(["dropdown-item", { active: e.mode ===
|
|
801
|
-
onClick: (Z) => b(
|
|
906
|
+
(n(), c(N, null, q(T, (w) => t("button", {
|
|
907
|
+
key: w.value,
|
|
908
|
+
class: E(["dropdown-item", { active: e.mode === w.value }]),
|
|
909
|
+
onClick: (Z) => b(w.value)
|
|
802
910
|
}, [
|
|
803
|
-
(n(),
|
|
804
|
-
t("span", null,
|
|
805
|
-
e.mode ===
|
|
911
|
+
(n(), p(te(w.icon), { size: 14 })),
|
|
912
|
+
t("span", null, D(w.label), 1),
|
|
913
|
+
e.mode === w.value ? (n(), p(a(se), {
|
|
806
914
|
key: 0,
|
|
807
915
|
size: 14,
|
|
808
916
|
class: "check-icon"
|
|
809
|
-
})) :
|
|
810
|
-
], 10,
|
|
811
|
-
])) :
|
|
917
|
+
})) : y("", !0)
|
|
918
|
+
], 10, Ht)), 64))
|
|
919
|
+
])) : y("", !0)
|
|
812
920
|
]),
|
|
813
921
|
t("div", {
|
|
814
922
|
class: "selector model-selector",
|
|
815
|
-
onClick: X(
|
|
923
|
+
onClick: X(g, ["stop"])
|
|
816
924
|
}, [
|
|
817
|
-
t("span", null,
|
|
818
|
-
|
|
925
|
+
t("span", null, D(J.value), 1),
|
|
926
|
+
z(a(j), {
|
|
819
927
|
size: 10,
|
|
820
928
|
class: "chevron"
|
|
821
929
|
}),
|
|
822
|
-
|
|
930
|
+
B.value ? (n(), c("div", {
|
|
823
931
|
key: 0,
|
|
824
932
|
class: "dropdown-menu",
|
|
825
|
-
onClick:
|
|
933
|
+
onClick: i[3] || (i[3] = X(() => {
|
|
826
934
|
}, ["stop"]))
|
|
827
935
|
}, [
|
|
828
|
-
(n(!0),
|
|
829
|
-
key:
|
|
830
|
-
class: E(["dropdown-item", { active: e.model ===
|
|
831
|
-
onClick: (Z) => V(
|
|
936
|
+
(n(!0), c(N, null, q(e.models, (w) => (n(), c("button", {
|
|
937
|
+
key: w.model,
|
|
938
|
+
class: E(["dropdown-item", { active: e.model === w.model }]),
|
|
939
|
+
onClick: (Z) => V(w)
|
|
832
940
|
}, [
|
|
833
|
-
t("span", null,
|
|
834
|
-
e.model ===
|
|
941
|
+
t("span", null, D(w.displayName), 1),
|
|
942
|
+
e.model === w.model ? (n(), p(a(se), {
|
|
835
943
|
key: 0,
|
|
836
944
|
size: 14,
|
|
837
945
|
class: "check-icon"
|
|
838
|
-
})) :
|
|
839
|
-
], 10,
|
|
840
|
-
])) :
|
|
946
|
+
})) : y("", !0)
|
|
947
|
+
], 10, Ut))), 128))
|
|
948
|
+
])) : y("", !0)
|
|
841
949
|
])
|
|
842
950
|
]),
|
|
843
|
-
t("div",
|
|
951
|
+
t("div", _t, [
|
|
844
952
|
t("button", {
|
|
845
953
|
class: "icon-btn",
|
|
846
954
|
title: "提及上下文 (@)",
|
|
847
|
-
onClick:
|
|
955
|
+
onClick: i[4] || (i[4] = (w) => u.$emit("at-context"))
|
|
848
956
|
}, [
|
|
849
|
-
|
|
957
|
+
z(a(Ge), { size: 14 })
|
|
850
958
|
]),
|
|
851
959
|
t("button", {
|
|
852
960
|
class: E(["toggle-btn", { active: e.thinkingEnabled }]),
|
|
853
961
|
title: "深度思考",
|
|
854
|
-
onClick:
|
|
962
|
+
onClick: i[5] || (i[5] = (w) => u.$emit("update:thinking", !e.thinkingEnabled))
|
|
855
963
|
}, [
|
|
856
|
-
|
|
964
|
+
z(a(Ce), { size: 14 })
|
|
857
965
|
], 2),
|
|
858
966
|
t("button", {
|
|
859
967
|
class: E(["toggle-btn", { active: e.webSearchEnabled }]),
|
|
860
968
|
title: "联网搜索",
|
|
861
|
-
onClick:
|
|
969
|
+
onClick: i[6] || (i[6] = (w) => u.$emit("update:webSearch", !e.webSearchEnabled))
|
|
862
970
|
}, [
|
|
863
|
-
|
|
971
|
+
z(a(ie), { size: 14 })
|
|
864
972
|
], 2),
|
|
865
973
|
t("button", {
|
|
866
974
|
class: "icon-btn",
|
|
867
975
|
title: "上传图片",
|
|
868
|
-
onClick:
|
|
976
|
+
onClick: i[7] || (i[7] = (w) => u.$emit("upload-image"))
|
|
869
977
|
}, [
|
|
870
|
-
|
|
978
|
+
z(a(Ke), { size: 14 })
|
|
871
979
|
]),
|
|
872
|
-
|
|
980
|
+
l.value.trim() || e.isLoading ? (n(), c("button", {
|
|
873
981
|
key: 0,
|
|
874
982
|
class: E(["send-btn", { loading: e.isLoading }]),
|
|
875
983
|
title: e.isLoading ? "停止" : f.value ? "重新发送" : "发送",
|
|
876
|
-
onClick:
|
|
984
|
+
onClick: I
|
|
877
985
|
}, [
|
|
878
|
-
e.isLoading ? (n(),
|
|
986
|
+
e.isLoading ? (n(), p(a(Qe), {
|
|
879
987
|
key: 0,
|
|
880
988
|
size: 14
|
|
881
|
-
})) : (n(),
|
|
989
|
+
})) : (n(), p(a(Xe), {
|
|
882
990
|
key: 1,
|
|
883
991
|
size: 14
|
|
884
992
|
}))
|
|
885
|
-
], 10, Wt)) : (n(),
|
|
886
|
-
|
|
993
|
+
], 10, Wt)) : (n(), c("button", qt, [
|
|
994
|
+
z(a(je), { size: 14 })
|
|
887
995
|
]))
|
|
888
996
|
])
|
|
889
|
-
])) :
|
|
997
|
+
])) : y("", !0)
|
|
890
998
|
], 2)
|
|
891
999
|
], 2));
|
|
892
1000
|
}
|
|
893
1001
|
}), Se = /* @__PURE__ */ Q(Vt, [["__scopeId", "data-v-79ec50ab"]]), Pt = {
|
|
894
1002
|
key: 0,
|
|
895
1003
|
class: "execution-steps"
|
|
896
|
-
},
|
|
1004
|
+
}, Ft = {
|
|
897
1005
|
key: 0,
|
|
898
1006
|
class: "step thinking-step"
|
|
899
|
-
},
|
|
1007
|
+
}, Jt = { class: "step-icon" }, Gt = { class: "step-title" }, Kt = {
|
|
900
1008
|
key: 0,
|
|
901
1009
|
class: "step-content"
|
|
902
1010
|
}, Qt = { class: "thinking-content" }, Xt = {
|
|
@@ -920,21 +1028,21 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
920
1028
|
toolCalls: {}
|
|
921
1029
|
},
|
|
922
1030
|
setup(e) {
|
|
923
|
-
const h = e,
|
|
924
|
-
var
|
|
925
|
-
return h.thinking || h.searching || ((
|
|
1031
|
+
const h = e, d = R(!1), s = R(!0), o = Oe({}), f = _(() => {
|
|
1032
|
+
var k, T;
|
|
1033
|
+
return h.thinking || h.searching || ((k = h.searchResults) == null ? void 0 : k.length) || ((T = h.toolCalls) == null ? void 0 : T.length) || h.loading && !h.hasContent;
|
|
926
1034
|
});
|
|
927
|
-
function
|
|
928
|
-
|
|
1035
|
+
function l(k) {
|
|
1036
|
+
o[k] = !o[k];
|
|
929
1037
|
}
|
|
930
|
-
function m(
|
|
1038
|
+
function m(k) {
|
|
931
1039
|
try {
|
|
932
|
-
return new URL(
|
|
1040
|
+
return new URL(k).hostname;
|
|
933
1041
|
} catch {
|
|
934
|
-
return
|
|
1042
|
+
return k;
|
|
935
1043
|
}
|
|
936
1044
|
}
|
|
937
|
-
function
|
|
1045
|
+
function M(k) {
|
|
938
1046
|
return {
|
|
939
1047
|
web_search: "网页搜索",
|
|
940
1048
|
read_file: "读取文件",
|
|
@@ -946,114 +1054,114 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
946
1054
|
move_file: "移动文件",
|
|
947
1055
|
search_files: "搜索文件",
|
|
948
1056
|
analyze_image: "分析图片"
|
|
949
|
-
}[
|
|
1057
|
+
}[k] || k;
|
|
950
1058
|
}
|
|
951
|
-
return (
|
|
952
|
-
var
|
|
953
|
-
return f.value ? (n(),
|
|
954
|
-
e.thinking || e.loading && !e.hasContent && !((
|
|
1059
|
+
return (k, T) => {
|
|
1060
|
+
var $, B, P, L, F;
|
|
1061
|
+
return f.value ? (n(), c("div", Pt, [
|
|
1062
|
+
e.thinking || e.loading && !e.hasContent && !(($ = e.toolCalls) != null && $.length) ? (n(), c("div", Ft, [
|
|
955
1063
|
t("div", {
|
|
956
1064
|
class: "step-header",
|
|
957
|
-
onClick:
|
|
1065
|
+
onClick: T[0] || (T[0] = (A) => d.value = !d.value)
|
|
958
1066
|
}, [
|
|
959
|
-
t("div",
|
|
960
|
-
e.thinkingComplete ? (n(),
|
|
1067
|
+
t("div", Jt, [
|
|
1068
|
+
e.thinkingComplete ? (n(), p(a(we), {
|
|
961
1069
|
key: 1,
|
|
962
1070
|
size: 14
|
|
963
|
-
})) : (n(),
|
|
1071
|
+
})) : (n(), p(a(ee), {
|
|
964
1072
|
key: 0,
|
|
965
1073
|
size: 14,
|
|
966
1074
|
class: "animate-spin"
|
|
967
1075
|
}))
|
|
968
1076
|
]),
|
|
969
|
-
t("span", Gt,
|
|
970
|
-
e.thinking ? (n(),
|
|
1077
|
+
t("span", Gt, D(e.thinkingComplete ? "思考完成" : "正在思考..."), 1),
|
|
1078
|
+
e.thinking ? (n(), p(a(j), {
|
|
971
1079
|
key: 0,
|
|
972
1080
|
size: 14,
|
|
973
|
-
class: E(["step-chevron", { expanded:
|
|
974
|
-
}, null, 8, ["class"])) :
|
|
1081
|
+
class: E(["step-chevron", { expanded: d.value }])
|
|
1082
|
+
}, null, 8, ["class"])) : y("", !0)
|
|
975
1083
|
]),
|
|
976
|
-
e.thinking &&
|
|
977
|
-
t("div", Qt,
|
|
978
|
-
])) :
|
|
979
|
-
])) :
|
|
980
|
-
e.searching || (
|
|
1084
|
+
e.thinking && d.value ? (n(), c("div", Kt, [
|
|
1085
|
+
t("div", Qt, D(e.thinking), 1)
|
|
1086
|
+
])) : y("", !0)
|
|
1087
|
+
])) : y("", !0),
|
|
1088
|
+
e.searching || (B = e.searchResults) != null && B.length ? (n(), c("div", Xt, [
|
|
981
1089
|
t("div", {
|
|
982
1090
|
class: "step-header",
|
|
983
|
-
onClick:
|
|
1091
|
+
onClick: T[1] || (T[1] = (A) => s.value = !s.value)
|
|
984
1092
|
}, [
|
|
985
1093
|
t("div", jt, [
|
|
986
|
-
e.searching ? (n(),
|
|
1094
|
+
e.searching ? (n(), p(a(ee), {
|
|
987
1095
|
key: 0,
|
|
988
1096
|
size: 14,
|
|
989
1097
|
class: "animate-spin"
|
|
990
|
-
})) : (n(),
|
|
1098
|
+
})) : (n(), p(a(ie), {
|
|
991
1099
|
key: 1,
|
|
992
1100
|
size: 14
|
|
993
1101
|
}))
|
|
994
1102
|
]),
|
|
995
|
-
t("span", Zt,
|
|
996
|
-
(
|
|
1103
|
+
t("span", Zt, D(e.searching ? "正在搜索..." : `找到 ${((P = e.searchResults) == null ? void 0 : P.length) || 0} 条结果`), 1),
|
|
1104
|
+
(L = e.searchResults) != null && L.length ? (n(), p(a(j), {
|
|
997
1105
|
key: 0,
|
|
998
1106
|
size: 14,
|
|
999
|
-
class: E(["step-chevron", { expanded:
|
|
1000
|
-
}, null, 8, ["class"])) :
|
|
1107
|
+
class: E(["step-chevron", { expanded: s.value }])
|
|
1108
|
+
}, null, 8, ["class"])) : y("", !0)
|
|
1001
1109
|
]),
|
|
1002
|
-
(
|
|
1110
|
+
(F = e.searchResults) != null && F.length && s.value ? (n(), c("div", Yt, [
|
|
1003
1111
|
t("div", en, [
|
|
1004
|
-
(n(!0),
|
|
1005
|
-
key:
|
|
1006
|
-
href:
|
|
1112
|
+
(n(!0), c(N, null, q(e.searchResults, (A, x) => (n(), c("a", {
|
|
1113
|
+
key: x,
|
|
1114
|
+
href: A.url,
|
|
1007
1115
|
target: "_blank",
|
|
1008
1116
|
class: "search-result"
|
|
1009
1117
|
}, [
|
|
1010
|
-
t("span", nn,
|
|
1011
|
-
t("span", sn,
|
|
1118
|
+
t("span", nn, D(A.title), 1),
|
|
1119
|
+
t("span", sn, D(m(A.url)), 1)
|
|
1012
1120
|
], 8, tn))), 128))
|
|
1013
1121
|
])
|
|
1014
|
-
])) :
|
|
1015
|
-
])) :
|
|
1016
|
-
(n(!0),
|
|
1017
|
-
key:
|
|
1122
|
+
])) : y("", !0)
|
|
1123
|
+
])) : y("", !0),
|
|
1124
|
+
(n(!0), c(N, null, q(e.toolCalls, (A, x) => (n(), c("div", {
|
|
1125
|
+
key: x,
|
|
1018
1126
|
class: "step tool-step"
|
|
1019
1127
|
}, [
|
|
1020
1128
|
t("div", {
|
|
1021
1129
|
class: "step-header",
|
|
1022
|
-
onClick: (
|
|
1130
|
+
onClick: (J) => l(x)
|
|
1023
1131
|
}, [
|
|
1024
1132
|
t("div", an, [
|
|
1025
|
-
|
|
1133
|
+
A.status === "running" ? (n(), p(a(ee), {
|
|
1026
1134
|
key: 0,
|
|
1027
1135
|
size: 14,
|
|
1028
1136
|
class: "animate-spin"
|
|
1029
|
-
})) :
|
|
1137
|
+
})) : A.status === "success" ? (n(), p(a(se), {
|
|
1030
1138
|
key: 1,
|
|
1031
1139
|
size: 14,
|
|
1032
1140
|
class: "text-green"
|
|
1033
|
-
})) : (n(),
|
|
1141
|
+
})) : (n(), p(a(ne), {
|
|
1034
1142
|
key: 2,
|
|
1035
1143
|
size: 14,
|
|
1036
1144
|
class: "text-red"
|
|
1037
1145
|
}))
|
|
1038
1146
|
]),
|
|
1039
|
-
t("span", on,
|
|
1040
|
-
|
|
1147
|
+
t("span", on, D(M(A.name)), 1),
|
|
1148
|
+
A.result ? (n(), p(a(j), {
|
|
1041
1149
|
key: 0,
|
|
1042
1150
|
size: 14,
|
|
1043
|
-
class: E(["step-chevron", { expanded:
|
|
1044
|
-
}, null, 8, ["class"])) :
|
|
1151
|
+
class: E(["step-chevron", { expanded: o[x] }])
|
|
1152
|
+
}, null, 8, ["class"])) : y("", !0)
|
|
1045
1153
|
], 8, ln),
|
|
1046
|
-
|
|
1047
|
-
t("pre", rn,
|
|
1048
|
-
])) :
|
|
1154
|
+
A.result && o[x] ? (n(), c("div", cn, [
|
|
1155
|
+
t("pre", rn, D(A.result), 1)
|
|
1156
|
+
])) : y("", !0)
|
|
1049
1157
|
]))), 128))
|
|
1050
|
-
])) :
|
|
1158
|
+
])) : y("", !0);
|
|
1051
1159
|
};
|
|
1052
1160
|
}
|
|
1053
1161
|
}), dn = /* @__PURE__ */ Q(un, [["__scopeId", "data-v-5ad7fab1"]]), vn = {
|
|
1054
1162
|
key: 1,
|
|
1055
1163
|
class: "user-content"
|
|
1056
|
-
},
|
|
1164
|
+
}, gn = { class: "user-text" }, hn = {
|
|
1057
1165
|
key: 0,
|
|
1058
1166
|
class: "user-images"
|
|
1059
1167
|
}, mn = ["src", "onClick"], fn = { class: "assistant-content" }, kn = ["innerHTML"], pn = {
|
|
@@ -1079,36 +1187,36 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1079
1187
|
},
|
|
1080
1188
|
emits: ["copy", "regenerate", "view-image", "send"],
|
|
1081
1189
|
setup(e) {
|
|
1082
|
-
const h = e,
|
|
1083
|
-
let
|
|
1084
|
-
return
|
|
1190
|
+
const h = e, d = _(() => {
|
|
1191
|
+
let s = h.content;
|
|
1192
|
+
return s = s.replace(/```(\w*)\n([\s\S]*?)```/g, '<pre class="code-block"><code>$2</code></pre>'), s = s.replace(/`([^`]+)`/g, '<code class="inline-code">$1</code>'), s = s.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), s = s.replace(/\*([^*]+)\*/g, "<em>$1</em>"), s = s.replace(/\n/g, "<br>"), s;
|
|
1085
1193
|
});
|
|
1086
|
-
return (
|
|
1194
|
+
return (s, o) => {
|
|
1087
1195
|
var f;
|
|
1088
|
-
return n(),
|
|
1196
|
+
return n(), c("div", {
|
|
1089
1197
|
class: E(["message-bubble", e.role])
|
|
1090
1198
|
}, [
|
|
1091
|
-
e.role === "user" ? (n(),
|
|
1092
|
-
e.onSend ? (n(),
|
|
1199
|
+
e.role === "user" ? (n(), c(N, { key: 0 }, [
|
|
1200
|
+
e.onSend ? (n(), p(Se, {
|
|
1093
1201
|
key: 0,
|
|
1094
1202
|
variant: "message",
|
|
1095
1203
|
value: e.content,
|
|
1096
1204
|
"selected-images": e.images,
|
|
1097
|
-
onSend:
|
|
1098
|
-
}, null, 8, ["value", "selected-images"])) : (n(),
|
|
1099
|
-
t("div",
|
|
1100
|
-
e.images && e.images.length > 0 ? (n(),
|
|
1101
|
-
(n(!0),
|
|
1205
|
+
onSend: o[0] || (o[0] = (l) => s.$emit("send", l))
|
|
1206
|
+
}, null, 8, ["value", "selected-images"])) : (n(), c("div", vn, [
|
|
1207
|
+
t("div", gn, D(e.content), 1),
|
|
1208
|
+
e.images && e.images.length > 0 ? (n(), c("div", hn, [
|
|
1209
|
+
(n(!0), c(N, null, q(e.images, (l, m) => (n(), c("img", {
|
|
1102
1210
|
key: m,
|
|
1103
|
-
src:
|
|
1211
|
+
src: l,
|
|
1104
1212
|
class: "user-image",
|
|
1105
|
-
onClick: (
|
|
1213
|
+
onClick: (M) => s.$emit("view-image", l)
|
|
1106
1214
|
}, null, 8, mn))), 128))
|
|
1107
|
-
])) :
|
|
1215
|
+
])) : y("", !0)
|
|
1108
1216
|
]))
|
|
1109
|
-
], 64)) : (n(),
|
|
1217
|
+
], 64)) : (n(), c(N, { key: 1 }, [
|
|
1110
1218
|
t("div", fn, [
|
|
1111
|
-
|
|
1219
|
+
z(dn, {
|
|
1112
1220
|
loading: e.loading,
|
|
1113
1221
|
"has-content": !!e.content,
|
|
1114
1222
|
thinking: e.thinking,
|
|
@@ -1117,104 +1225,104 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1117
1225
|
"search-results": e.searchResults,
|
|
1118
1226
|
"tool-calls": e.toolCalls
|
|
1119
1227
|
}, null, 8, ["loading", "has-content", "thinking", "thinking-complete", "searching", "search-results", "tool-calls"]),
|
|
1120
|
-
e.content ? (n(),
|
|
1228
|
+
e.content ? (n(), c("div", {
|
|
1121
1229
|
key: 0,
|
|
1122
1230
|
class: "assistant-text",
|
|
1123
|
-
innerHTML:
|
|
1124
|
-
}, null, 8, kn)) :
|
|
1125
|
-
e.loading && !e.content && !e.thinking && !((f = e.toolCalls) != null && f.length) ? (n(),
|
|
1231
|
+
innerHTML: d.value
|
|
1232
|
+
}, null, 8, kn)) : y("", !0),
|
|
1233
|
+
e.loading && !e.content && !e.thinking && !((f = e.toolCalls) != null && f.length) ? (n(), c("div", pn, [...o[3] || (o[3] = [
|
|
1126
1234
|
t("span", { class: "loading-dot" }, null, -1),
|
|
1127
1235
|
t("span", { class: "loading-dot" }, null, -1),
|
|
1128
1236
|
t("span", { class: "loading-dot" }, null, -1)
|
|
1129
|
-
])])) :
|
|
1237
|
+
])])) : y("", !0)
|
|
1130
1238
|
]),
|
|
1131
|
-
e.content && !e.loading ? (n(),
|
|
1239
|
+
e.content && !e.loading ? (n(), c("div", yn, [
|
|
1132
1240
|
t("button", {
|
|
1133
1241
|
class: "action-btn",
|
|
1134
1242
|
title: "复制",
|
|
1135
|
-
onClick:
|
|
1243
|
+
onClick: o[1] || (o[1] = (l) => s.$emit("copy"))
|
|
1136
1244
|
}, [
|
|
1137
|
-
(n(),
|
|
1245
|
+
(n(), p(te(e.copied ? a(se) : a(ke)), { size: 14 }))
|
|
1138
1246
|
]),
|
|
1139
1247
|
t("button", {
|
|
1140
1248
|
class: "action-btn",
|
|
1141
1249
|
title: "重新生成",
|
|
1142
|
-
onClick:
|
|
1250
|
+
onClick: o[2] || (o[2] = (l) => s.$emit("regenerate"))
|
|
1143
1251
|
}, [
|
|
1144
|
-
|
|
1252
|
+
z(a(Ze), { size: 14 })
|
|
1145
1253
|
])
|
|
1146
|
-
])) :
|
|
1254
|
+
])) : y("", !0)
|
|
1147
1255
|
], 64))
|
|
1148
1256
|
], 2);
|
|
1149
1257
|
};
|
|
1150
1258
|
}
|
|
1151
|
-
}), Cn = /* @__PURE__ */ Q(bn, [["__scopeId", "data-v-bb746e4b"]]),
|
|
1259
|
+
}), Cn = /* @__PURE__ */ Q(bn, [["__scopeId", "data-v-bb746e4b"]]), wn = { class: "chat-panel" }, $n = /* @__PURE__ */ K({
|
|
1152
1260
|
__name: "ChatPanel",
|
|
1153
1261
|
props: {
|
|
1154
1262
|
adapter: { default: void 0 },
|
|
1155
1263
|
workingDir: { default: void 0 },
|
|
1156
1264
|
defaultModel: { default: "anthropic/claude-opus-4.5" },
|
|
1157
1265
|
defaultMode: { default: "agent" },
|
|
1158
|
-
models: { default: () =>
|
|
1266
|
+
models: { default: () => $e },
|
|
1159
1267
|
hideHeader: { type: Boolean, default: !1 },
|
|
1160
1268
|
onClose: { type: Function, default: void 0 },
|
|
1161
1269
|
className: { default: "" }
|
|
1162
1270
|
},
|
|
1163
1271
|
emits: ["close"],
|
|
1164
1272
|
setup(e, { emit: h }) {
|
|
1165
|
-
const
|
|
1166
|
-
adapter:
|
|
1167
|
-
defaultModel:
|
|
1168
|
-
defaultMode:
|
|
1273
|
+
const d = e, s = h, o = st({
|
|
1274
|
+
adapter: d.adapter,
|
|
1275
|
+
defaultModel: d.defaultModel,
|
|
1276
|
+
defaultMode: d.defaultMode
|
|
1169
1277
|
}), {
|
|
1170
1278
|
sessions: f,
|
|
1171
|
-
currentSessionId:
|
|
1279
|
+
currentSessionId: l,
|
|
1172
1280
|
messages: m,
|
|
1173
|
-
isLoading:
|
|
1174
|
-
mode:
|
|
1175
|
-
model:
|
|
1176
|
-
webSearch:
|
|
1177
|
-
thinking:
|
|
1281
|
+
isLoading: M,
|
|
1282
|
+
mode: k,
|
|
1283
|
+
model: T,
|
|
1284
|
+
webSearch: $,
|
|
1285
|
+
thinking: B,
|
|
1178
1286
|
loadSessions: P,
|
|
1179
|
-
switchSession:
|
|
1180
|
-
createNewSession:
|
|
1181
|
-
deleteSession:
|
|
1182
|
-
sendMessage:
|
|
1183
|
-
cancelRequest:
|
|
1287
|
+
switchSession: L,
|
|
1288
|
+
createNewSession: F,
|
|
1289
|
+
deleteSession: A,
|
|
1290
|
+
sendMessage: x,
|
|
1291
|
+
cancelRequest: J,
|
|
1184
1292
|
copyMessage: C,
|
|
1185
|
-
regenerateMessage:
|
|
1293
|
+
regenerateMessage: g,
|
|
1186
1294
|
setMode: b,
|
|
1187
1295
|
setModel: V,
|
|
1188
1296
|
setWebSearch: G,
|
|
1189
|
-
setThinking:
|
|
1190
|
-
setWorkingDirectory:
|
|
1191
|
-
} =
|
|
1192
|
-
|
|
1297
|
+
setThinking: v,
|
|
1298
|
+
setWorkingDirectory: S
|
|
1299
|
+
} = o, r = R([]), I = R(null), H = Le(d, "models");
|
|
1300
|
+
He("chatAdapter", d.adapter), oe(() => {
|
|
1193
1301
|
P();
|
|
1194
1302
|
}), ae(
|
|
1195
|
-
() =>
|
|
1196
|
-
(
|
|
1197
|
-
|
|
1303
|
+
() => d.workingDir,
|
|
1304
|
+
(O) => {
|
|
1305
|
+
O && S(O);
|
|
1198
1306
|
},
|
|
1199
1307
|
{ immediate: !0 }
|
|
1200
1308
|
);
|
|
1201
1309
|
async function Y() {
|
|
1202
|
-
await
|
|
1310
|
+
await Ue(), I.value && (I.value.scrollTop = I.value.scrollHeight);
|
|
1203
1311
|
}
|
|
1204
1312
|
ae(m, () => {
|
|
1205
1313
|
Y();
|
|
1206
1314
|
}, { flush: "post" });
|
|
1207
|
-
function u(
|
|
1208
|
-
|
|
1315
|
+
function u(O) {
|
|
1316
|
+
x(O, r.value.length > 0 ? r.value : void 0), r.value = [];
|
|
1209
1317
|
}
|
|
1210
|
-
function
|
|
1211
|
-
|
|
1318
|
+
function i(O) {
|
|
1319
|
+
x(O);
|
|
1212
1320
|
}
|
|
1213
|
-
function
|
|
1214
|
-
m.value = m.value.slice(0,
|
|
1321
|
+
function w(O, re) {
|
|
1322
|
+
m.value = m.value.slice(0, O), x(re);
|
|
1215
1323
|
}
|
|
1216
|
-
function Z(
|
|
1217
|
-
|
|
1324
|
+
function Z(O) {
|
|
1325
|
+
O >= 0 && O < r.value.length && r.value.splice(O, 1);
|
|
1218
1326
|
}
|
|
1219
1327
|
function ce() {
|
|
1220
1328
|
console.log("上传图片");
|
|
@@ -1223,7 +1331,7 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1223
1331
|
console.log("@ 上下文");
|
|
1224
1332
|
}
|
|
1225
1333
|
function ze() {
|
|
1226
|
-
|
|
1334
|
+
d.onClose && d.onClose(), s("close");
|
|
1227
1335
|
}
|
|
1228
1336
|
function Re() {
|
|
1229
1337
|
console.log("清空所有对话");
|
|
@@ -1235,77 +1343,77 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1235
1343
|
console.log("导出对话");
|
|
1236
1344
|
}
|
|
1237
1345
|
function Te() {
|
|
1238
|
-
|
|
1346
|
+
l.value && (navigator.clipboard.writeText(l.value), console.log("已复制请求 ID:", l.value));
|
|
1239
1347
|
}
|
|
1240
|
-
function
|
|
1348
|
+
function Ae() {
|
|
1241
1349
|
console.log("反馈");
|
|
1242
1350
|
}
|
|
1243
|
-
function
|
|
1351
|
+
function xe() {
|
|
1244
1352
|
console.log("Agent 设置");
|
|
1245
1353
|
}
|
|
1246
|
-
return (
|
|
1247
|
-
e.hideHeader ?
|
|
1354
|
+
return (O, re) => (n(), c("div", wn, [
|
|
1355
|
+
e.hideHeader ? y("", !0) : (n(), p(wt, {
|
|
1248
1356
|
key: 0,
|
|
1249
|
-
sessions:
|
|
1250
|
-
"current-session-id": l
|
|
1357
|
+
sessions: a(f),
|
|
1358
|
+
"current-session-id": a(l),
|
|
1251
1359
|
"show-close": !!e.onClose,
|
|
1252
|
-
onNewSession:
|
|
1253
|
-
onSwitchSession:
|
|
1254
|
-
onDeleteSession:
|
|
1360
|
+
onNewSession: a(F),
|
|
1361
|
+
onSwitchSession: a(L),
|
|
1362
|
+
onDeleteSession: a(A),
|
|
1255
1363
|
onClose: ze,
|
|
1256
1364
|
onClearAll: Re,
|
|
1257
1365
|
onCloseOthers: De,
|
|
1258
1366
|
onExport: Ie,
|
|
1259
1367
|
onCopyId: Te,
|
|
1260
|
-
onFeedback:
|
|
1261
|
-
onSettings:
|
|
1368
|
+
onFeedback: Ae,
|
|
1369
|
+
onSettings: xe
|
|
1262
1370
|
}, null, 8, ["sessions", "current-session-id", "show-close", "onNewSession", "onSwitchSession", "onDeleteSession"])),
|
|
1263
1371
|
t("div", {
|
|
1264
1372
|
ref_key: "messagesRef",
|
|
1265
|
-
ref:
|
|
1373
|
+
ref: I,
|
|
1266
1374
|
class: "messages-container"
|
|
1267
1375
|
}, [
|
|
1268
|
-
|
|
1376
|
+
a(m).length === 0 ? (n(), p(Dt, {
|
|
1269
1377
|
key: 0,
|
|
1270
|
-
onQuickAction:
|
|
1271
|
-
})) : (n(!0),
|
|
1272
|
-
key:
|
|
1273
|
-
role:
|
|
1274
|
-
content:
|
|
1275
|
-
images:
|
|
1276
|
-
thinking:
|
|
1277
|
-
"thinking-complete":
|
|
1278
|
-
"search-results":
|
|
1279
|
-
searching:
|
|
1280
|
-
"tool-calls":
|
|
1281
|
-
copied:
|
|
1282
|
-
loading:
|
|
1283
|
-
onCopy: (le) =>
|
|
1284
|
-
onRegenerate: (le) =>
|
|
1285
|
-
onSend: (le) =>
|
|
1378
|
+
onQuickAction: i
|
|
1379
|
+
})) : (n(!0), c(N, { key: 1 }, q(a(m), (U, ue) => (n(), p(Cn, {
|
|
1380
|
+
key: U.id,
|
|
1381
|
+
role: U.role,
|
|
1382
|
+
content: U.content,
|
|
1383
|
+
images: U.images,
|
|
1384
|
+
thinking: U.thinking,
|
|
1385
|
+
"thinking-complete": U.thinkingComplete,
|
|
1386
|
+
"search-results": U.searchResults,
|
|
1387
|
+
searching: U.searching,
|
|
1388
|
+
"tool-calls": U.toolCalls,
|
|
1389
|
+
copied: U.copied,
|
|
1390
|
+
loading: U.loading,
|
|
1391
|
+
onCopy: (le) => a(C)(U.id),
|
|
1392
|
+
onRegenerate: (le) => a(g)(ue),
|
|
1393
|
+
onSend: (le) => w(ue, le)
|
|
1286
1394
|
}, null, 8, ["role", "content", "images", "thinking", "thinking-complete", "search-results", "searching", "tool-calls", "copied", "loading", "onCopy", "onRegenerate", "onSend"]))), 128))
|
|
1287
1395
|
], 512),
|
|
1288
|
-
|
|
1396
|
+
z(Se, {
|
|
1289
1397
|
"selected-images": r.value,
|
|
1290
|
-
"is-loading":
|
|
1291
|
-
mode:
|
|
1292
|
-
model:
|
|
1293
|
-
models:
|
|
1294
|
-
"web-search-enabled":
|
|
1295
|
-
"thinking-enabled":
|
|
1398
|
+
"is-loading": a(M),
|
|
1399
|
+
mode: a(k),
|
|
1400
|
+
model: a(T),
|
|
1401
|
+
models: H.value,
|
|
1402
|
+
"web-search-enabled": a($),
|
|
1403
|
+
"thinking-enabled": a(B),
|
|
1296
1404
|
onSend: u,
|
|
1297
|
-
onCancel:
|
|
1405
|
+
onCancel: a(J),
|
|
1298
1406
|
onRemoveImage: Z,
|
|
1299
1407
|
onUploadImage: ce,
|
|
1300
1408
|
onAtContext: Me,
|
|
1301
|
-
"onUpdate:mode":
|
|
1302
|
-
"onUpdate:model":
|
|
1303
|
-
"onUpdate:webSearch":
|
|
1304
|
-
"onUpdate:thinking":
|
|
1409
|
+
"onUpdate:mode": a(b),
|
|
1410
|
+
"onUpdate:model": a(V),
|
|
1411
|
+
"onUpdate:webSearch": a(G),
|
|
1412
|
+
"onUpdate:thinking": a(v)
|
|
1305
1413
|
}, null, 8, ["selected-images", "is-loading", "mode", "model", "models", "web-search-enabled", "thinking-enabled", "onCancel", "onUpdate:mode", "onUpdate:model", "onUpdate:webSearch", "onUpdate:thinking"])
|
|
1306
1414
|
]));
|
|
1307
1415
|
}
|
|
1308
|
-
}),
|
|
1416
|
+
}), Gn = /* @__PURE__ */ Q($n, [["__scopeId", "data-v-2332ad8f"]]), Sn = { class: "thinking-icon" }, Mn = { class: "thinking-title" }, zn = {
|
|
1309
1417
|
key: 0,
|
|
1310
1418
|
class: "thinking-content"
|
|
1311
1419
|
}, Rn = { class: "thinking-text" }, Dn = /* @__PURE__ */ K({
|
|
@@ -1315,42 +1423,42 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1315
1423
|
isComplete: { type: Boolean }
|
|
1316
1424
|
},
|
|
1317
1425
|
setup(e) {
|
|
1318
|
-
const h =
|
|
1319
|
-
return (
|
|
1426
|
+
const h = R(!1);
|
|
1427
|
+
return (d, s) => (n(), c("div", {
|
|
1320
1428
|
class: E(["thinking-block", { expanded: h.value }])
|
|
1321
1429
|
}, [
|
|
1322
1430
|
t("button", {
|
|
1323
1431
|
class: "thinking-header",
|
|
1324
|
-
onClick:
|
|
1432
|
+
onClick: s[0] || (s[0] = (o) => h.value = !h.value)
|
|
1325
1433
|
}, [
|
|
1326
1434
|
t("div", Sn, [
|
|
1327
|
-
e.isComplete ? (n(),
|
|
1435
|
+
e.isComplete ? (n(), p(a(we), {
|
|
1328
1436
|
key: 1,
|
|
1329
1437
|
size: 14
|
|
1330
|
-
})) : (n(),
|
|
1438
|
+
})) : (n(), p(a(ee), {
|
|
1331
1439
|
key: 0,
|
|
1332
1440
|
size: 14,
|
|
1333
1441
|
class: "spinning"
|
|
1334
1442
|
}))
|
|
1335
1443
|
]),
|
|
1336
|
-
t("span", Mn,
|
|
1337
|
-
|
|
1444
|
+
t("span", Mn, D(e.isComplete ? "思考完成" : "正在思考..."), 1),
|
|
1445
|
+
z(a(j), {
|
|
1338
1446
|
size: 14,
|
|
1339
1447
|
class: E(["chevron", { rotated: h.value }])
|
|
1340
1448
|
}, null, 8, ["class"])
|
|
1341
1449
|
]),
|
|
1342
|
-
h.value && e.content ? (n(),
|
|
1343
|
-
t("div", Rn,
|
|
1344
|
-
])) :
|
|
1450
|
+
h.value && e.content ? (n(), c("div", zn, [
|
|
1451
|
+
t("div", Rn, D(e.content), 1)
|
|
1452
|
+
])) : y("", !0)
|
|
1345
1453
|
], 2));
|
|
1346
1454
|
}
|
|
1347
|
-
}),
|
|
1455
|
+
}), Kn = /* @__PURE__ */ Q(Dn, [["__scopeId", "data-v-318aa171"]]), In = { class: "tool-icon" }, Tn = { class: "tool-name" }, An = {
|
|
1348
1456
|
key: 0,
|
|
1349
1457
|
class: "tool-args"
|
|
1350
|
-
},
|
|
1458
|
+
}, xn = { class: "arg-key" }, En = { class: "arg-value" }, Bn = {
|
|
1351
1459
|
key: 1,
|
|
1352
1460
|
class: "tool-result"
|
|
1353
|
-
},
|
|
1461
|
+
}, Nn = /* @__PURE__ */ K({
|
|
1354
1462
|
__name: "ToolCallBlock",
|
|
1355
1463
|
props: {
|
|
1356
1464
|
name: {},
|
|
@@ -1359,7 +1467,7 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1359
1467
|
status: {}
|
|
1360
1468
|
},
|
|
1361
1469
|
setup(e) {
|
|
1362
|
-
const h = e,
|
|
1470
|
+
const h = e, d = R(!1), s = _(() => ({
|
|
1363
1471
|
execute_command: "执行命令",
|
|
1364
1472
|
analyze_image: "分析图片",
|
|
1365
1473
|
generate_image: "生成图片",
|
|
@@ -1372,126 +1480,127 @@ const at = { class: "chat-header" }, ot = { class: "tabs-container" }, it = {
|
|
|
1372
1480
|
delete_file: "删除文件",
|
|
1373
1481
|
move_file: "移动文件",
|
|
1374
1482
|
search_files: "搜索文件"
|
|
1375
|
-
})[h.name] || h.name),
|
|
1483
|
+
})[h.name] || h.name), o = _(() => ({
|
|
1376
1484
|
execute_command: W(et),
|
|
1377
|
-
analyze_image: W(
|
|
1378
|
-
generate_image: W(
|
|
1485
|
+
analyze_image: W(he),
|
|
1486
|
+
generate_image: W(he),
|
|
1379
1487
|
analyze_video: W(Ye),
|
|
1380
1488
|
web_search: W(ye)
|
|
1381
1489
|
})[h.name] || W(pe));
|
|
1382
|
-
function f(
|
|
1383
|
-
return typeof
|
|
1490
|
+
function f(l) {
|
|
1491
|
+
return typeof l == "string" ? l.length > 50 ? l.substring(0, 50) + "..." : l : JSON.stringify(l);
|
|
1384
1492
|
}
|
|
1385
|
-
return (
|
|
1493
|
+
return (l, m) => (n(), c("div", {
|
|
1386
1494
|
class: E(["tool-call-block", e.status])
|
|
1387
1495
|
}, [
|
|
1388
1496
|
t("div", {
|
|
1389
1497
|
class: "tool-header",
|
|
1390
|
-
onClick: m[0] || (m[0] = (
|
|
1498
|
+
onClick: m[0] || (m[0] = (M) => d.value = !d.value)
|
|
1391
1499
|
}, [
|
|
1392
1500
|
t("div", In, [
|
|
1393
|
-
e.status === "running" ? (n(),
|
|
1501
|
+
e.status === "running" ? (n(), p(a(ee), {
|
|
1394
1502
|
key: 0,
|
|
1395
1503
|
size: 14,
|
|
1396
1504
|
class: "spinning"
|
|
1397
|
-
})) : e.status === "success" ? (n(),
|
|
1505
|
+
})) : e.status === "success" ? (n(), p(a(se), {
|
|
1398
1506
|
key: 1,
|
|
1399
1507
|
size: 14
|
|
1400
|
-
})) : e.status === "error" ? (n(),
|
|
1508
|
+
})) : e.status === "error" ? (n(), p(a(ne), {
|
|
1401
1509
|
key: 2,
|
|
1402
1510
|
size: 14
|
|
1403
|
-
})) : (n(),
|
|
1511
|
+
})) : (n(), p(te(o.value), {
|
|
1404
1512
|
key: 3,
|
|
1405
1513
|
size: 14
|
|
1406
1514
|
}))
|
|
1407
1515
|
]),
|
|
1408
|
-
t("span", Tn,
|
|
1409
|
-
e.result ? (n(),
|
|
1516
|
+
t("span", Tn, D(s.value), 1),
|
|
1517
|
+
e.result ? (n(), p(a(j), {
|
|
1410
1518
|
key: 0,
|
|
1411
1519
|
size: 14,
|
|
1412
|
-
class: E(["chevron", { rotated:
|
|
1413
|
-
}, null, 8, ["class"])) :
|
|
1520
|
+
class: E(["chevron", { rotated: d.value }])
|
|
1521
|
+
}, null, 8, ["class"])) : y("", !0)
|
|
1414
1522
|
]),
|
|
1415
|
-
e.args && Object.keys(e.args).length > 0 &&
|
|
1416
|
-
(n(!0),
|
|
1417
|
-
key:
|
|
1523
|
+
e.args && Object.keys(e.args).length > 0 && d.value ? (n(), c("div", An, [
|
|
1524
|
+
(n(!0), c(N, null, q(e.args, (M, k) => (n(), c("div", {
|
|
1525
|
+
key: k,
|
|
1418
1526
|
class: "arg-item"
|
|
1419
1527
|
}, [
|
|
1420
|
-
t("span",
|
|
1421
|
-
t("span",
|
|
1528
|
+
t("span", xn, D(k) + ":", 1),
|
|
1529
|
+
t("span", En, D(f(M)), 1)
|
|
1422
1530
|
]))), 128))
|
|
1423
|
-
])) :
|
|
1424
|
-
e.result &&
|
|
1425
|
-
t("pre", null,
|
|
1426
|
-
])) :
|
|
1531
|
+
])) : y("", !0),
|
|
1532
|
+
e.result && d.value ? (n(), c("div", Bn, [
|
|
1533
|
+
t("pre", null, D(e.result), 1)
|
|
1534
|
+
])) : y("", !0)
|
|
1427
1535
|
], 2));
|
|
1428
1536
|
}
|
|
1429
|
-
}),
|
|
1537
|
+
}), Qn = /* @__PURE__ */ Q(Nn, [["__scopeId", "data-v-7098f4a3"]]), On = { class: "search-block" }, Ln = { class: "search-icon" }, Hn = { class: "search-title" }, Un = {
|
|
1430
1538
|
key: 0,
|
|
1431
1539
|
class: "search-results"
|
|
1432
|
-
},
|
|
1540
|
+
}, _n = ["href"], Wn = { class: "result-title" }, qn = { class: "result-url" }, Vn = /* @__PURE__ */ K({
|
|
1433
1541
|
__name: "SearchResultBlock",
|
|
1434
1542
|
props: {
|
|
1435
1543
|
results: {},
|
|
1436
1544
|
searching: { type: Boolean }
|
|
1437
1545
|
},
|
|
1438
1546
|
setup(e) {
|
|
1439
|
-
const h =
|
|
1440
|
-
function
|
|
1547
|
+
const h = R(!0);
|
|
1548
|
+
function d(s) {
|
|
1441
1549
|
try {
|
|
1442
|
-
return new URL(
|
|
1550
|
+
return new URL(s).hostname;
|
|
1443
1551
|
} catch {
|
|
1444
|
-
return
|
|
1552
|
+
return s;
|
|
1445
1553
|
}
|
|
1446
1554
|
}
|
|
1447
|
-
return (
|
|
1555
|
+
return (s, o) => (n(), c("div", On, [
|
|
1448
1556
|
t("div", {
|
|
1449
1557
|
class: "search-header",
|
|
1450
|
-
onClick:
|
|
1558
|
+
onClick: o[0] || (o[0] = (f) => h.value = !h.value)
|
|
1451
1559
|
}, [
|
|
1452
|
-
t("div",
|
|
1453
|
-
e.searching ? (n(),
|
|
1560
|
+
t("div", Ln, [
|
|
1561
|
+
e.searching ? (n(), p(a(ee), {
|
|
1454
1562
|
key: 0,
|
|
1455
1563
|
size: 14,
|
|
1456
1564
|
class: "spinning"
|
|
1457
|
-
})) : (n(),
|
|
1565
|
+
})) : (n(), p(a(ie), {
|
|
1458
1566
|
key: 1,
|
|
1459
1567
|
size: 14
|
|
1460
1568
|
}))
|
|
1461
1569
|
]),
|
|
1462
|
-
t("span",
|
|
1463
|
-
!e.searching && e.results.length > 0 ? (n(),
|
|
1570
|
+
t("span", Hn, D(e.searching ? "正在搜索..." : `找到 ${e.results.length} 条结果`), 1),
|
|
1571
|
+
!e.searching && e.results.length > 0 ? (n(), p(a(j), {
|
|
1464
1572
|
key: 0,
|
|
1465
1573
|
size: 14,
|
|
1466
1574
|
class: E(["chevron", { rotated: h.value }])
|
|
1467
|
-
}, null, 8, ["class"])) :
|
|
1575
|
+
}, null, 8, ["class"])) : y("", !0)
|
|
1468
1576
|
]),
|
|
1469
|
-
!e.searching && h.value && e.results.length > 0 ? (n(),
|
|
1470
|
-
(n(!0),
|
|
1471
|
-
key:
|
|
1577
|
+
!e.searching && h.value && e.results.length > 0 ? (n(), c("div", Un, [
|
|
1578
|
+
(n(!0), c(N, null, q(e.results.slice(0, 5), (f, l) => (n(), c("a", {
|
|
1579
|
+
key: l,
|
|
1472
1580
|
href: f.url,
|
|
1473
1581
|
target: "_blank",
|
|
1474
1582
|
class: "result-item"
|
|
1475
1583
|
}, [
|
|
1476
|
-
t("span", Wn,
|
|
1477
|
-
t("span", qn,
|
|
1478
|
-
], 8,
|
|
1479
|
-
])) :
|
|
1584
|
+
t("span", Wn, D(f.title), 1),
|
|
1585
|
+
t("span", qn, D(d(f.url)), 1)
|
|
1586
|
+
], 8, _n))), 128))
|
|
1587
|
+
])) : y("", !0)
|
|
1480
1588
|
]));
|
|
1481
1589
|
}
|
|
1482
|
-
}),
|
|
1590
|
+
}), Xn = /* @__PURE__ */ Q(Vn, [["__scopeId", "data-v-f1490d29"]]);
|
|
1483
1591
|
export {
|
|
1484
|
-
|
|
1592
|
+
wt as ChatHeader,
|
|
1485
1593
|
Se as ChatInput,
|
|
1486
|
-
|
|
1487
|
-
|
|
1594
|
+
Gn as ChatPanel,
|
|
1595
|
+
$e as DEFAULT_MODELS,
|
|
1488
1596
|
dn as ExecutionSteps,
|
|
1489
1597
|
lt as FileType,
|
|
1490
1598
|
Cn as MessageBubble,
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1599
|
+
Xn as SearchResultBlock,
|
|
1600
|
+
Kn as ThinkingBlock,
|
|
1601
|
+
Qn as ToolCallBlock,
|
|
1494
1602
|
Dt as WelcomeMessage,
|
|
1603
|
+
Jn as createElectronAdapter,
|
|
1495
1604
|
tt as createNullAdapter,
|
|
1496
1605
|
st as useChat
|
|
1497
1606
|
};
|