@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/index.js CHANGED
@@ -1,21 +1,118 @@
1
- import { ref as M, shallowRef as Ae, defineComponent as K, computed as H, onMounted as oe, onUnmounted as fe, createElementBlock as i, openBlock as n, createElementVNode as t, Fragment as B, renderList as q, normalizeClass as E, toDisplayString as z, withModifiers as X, createVNode as S, unref as l, createCommentVNode as p, markRaw as W, createBlock as k, resolveDynamicComponent as te, watch as ae, withDirectives as Ne, vModelText as Be, reactive as Le, toRef as Oe, provide as Ue, nextTick as _e } from "vue";
2
- import { X as ne, Plus as de, Clock as He, Trash2 as ve, MoreHorizontal as We, XCircle as qe, Download as Ve, Copy as ke, MessageSquare as Pe, Settings as Je, Code as Fe, FileText as pe, Search as ye, MessageCircle as be, Sparkles as Ce, Zap as he, 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 $e, RefreshCw as Ze, Video as Ye, Image as ge, Terminal as et } from "lucide-vue-next";
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
- title: e.title,
12
- model: e.model,
13
- mode: e.mode,
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: g = "anthropic/claude-opus-4.5",
64
- defaultMode: a = "agent"
65
- } = e, c = M([]), f = M(null), s = M([]), m = M(a), D = M(g), y = M(!0), x = M(!0), A = M(!1), N = Ae(null);
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 d = await h.getSessions();
69
- c.value = d, d.length > 0 && !f.value && await O(d[0].id);
70
- } catch (d) {
71
- console.error("加载会话失败:", d);
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 O(d) {
75
- if (f.value !== d) {
76
- f.value = d;
182
+ async function L(v) {
183
+ if (f.value !== v) {
184
+ f.value = v;
77
185
  try {
78
- const w = await h.getMessages(d);
79
- s.value = w.map(nt);
80
- const r = c.value.find((R) => R.id === d);
81
- r && (m.value = r.mode, D.value = r.model);
82
- } catch (w) {
83
- console.error("加载消息失败:", w), s.value = [];
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 J() {
195
+ async function F() {
88
196
  try {
89
- const d = await h.createSession({
197
+ const v = await h.createSession({
90
198
  title: "新对话",
91
- model: D.value,
199
+ model: M.value,
92
200
  mode: m.value
93
201
  });
94
- c.value = [d, ...c.value], f.value = d.id, s.value = [];
95
- } catch (d) {
96
- console.error("创建会话失败:", d);
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 I(d) {
207
+ async function A(v) {
100
208
  try {
101
- await h.deleteSession(d), c.value = c.value.filter((w) => w.id !== d), f.value === d && (c.value.length > 0 ? await O(c.value[0].id) : (f.value = null, s.value = []));
102
- } catch (w) {
103
- console.error("删除会话失败:", w);
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 T() {
107
- f.value && await I(f.value);
214
+ async function x() {
215
+ f.value && await A(f.value);
108
216
  }
109
- function F(d, w) {
110
- const r = s.value[d];
217
+ function J(v, S) {
218
+ const r = l.value[v];
111
219
  if (r) {
112
- switch (w.type) {
220
+ switch (S.type) {
113
221
  case "thinking": {
114
- const R = w.data;
115
- R.content && (r.thinking = (r.thinking || "") + R.content), r.thinkingComplete = R.isComplete;
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 R = w.data;
124
- r.searchResults = R.results || [];
231
+ const I = S.data;
232
+ r.searchResults = I.results || [];
125
233
  break;
126
234
  }
127
235
  case "tool_call": {
128
- const R = w.data;
236
+ const I = S.data;
129
237
  r.toolCalls || (r.toolCalls = []), r.toolCalls.push({
130
- name: R.name,
131
- args: R.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 R = w.data;
138
- r.toolCalls && (r.toolCalls = r.toolCalls.map((U) => U.name === R.name && U.status === "running" ? { ...U, result: R.result, status: "success" } : U));
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 || "") + w.data;
250
+ r.content = (r.content || "") + S.data;
143
251
  break;
144
252
  case "text":
145
- r.content || (r.content = w.data);
253
+ r.content || (r.content = S.data);
146
254
  break;
147
255
  case "error":
148
256
  r.content = (r.content || "") + `
149
257
 
150
- ❌ 错误: ${w.data}`;
258
+ ❌ 错误: ${S.data}`;
151
259
  break;
152
260
  }
153
- s.value = [...s.value];
261
+ l.value = [...l.value];
154
262
  }
155
263
  }
156
- async function C(d, w) {
264
+ async function C(v, S) {
157
265
  var u;
158
- if (!d.trim() || A.value) return;
266
+ if (!v.trim() || $.value) return;
159
267
  let r = f.value;
160
268
  if (!r)
161
269
  try {
162
- const o = await h.createSession({
270
+ const i = await h.createSession({
163
271
  title: "新对话",
164
- model: D.value,
272
+ model: M.value,
165
273
  mode: m.value
166
274
  });
167
- c.value = [o, ...c.value], f.value = o.id, r = o.id;
168
- } catch (o) {
169
- console.error("创建会话失败:", o);
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 R = {
280
+ const I = {
173
281
  id: me(),
174
282
  role: "user",
175
- content: d,
176
- images: w,
283
+ content: v,
284
+ images: S,
177
285
  timestamp: /* @__PURE__ */ new Date()
178
286
  };
179
- s.value = [...s.value, R];
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: d
185
- }), s.value.length === 1) {
186
- const o = d.slice(0, 20) + (d.length > 20 ? "..." : "");
187
- await h.updateSession(r, { title: o }), c.value = c.value.map(
188
- ($) => $.id === r ? { ...$, title: o } : $
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 (o) {
192
- console.error("保存消息失败:", o);
299
+ } catch (i) {
300
+ console.error("保存消息失败:", i);
193
301
  }
194
- const U = s.value.length, Y = {
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
- s.value = [...s.value, Y], A.value = !0, N.value = new AbortController();
312
+ l.value = [...l.value, Y], $.value = !0, B.value = new AbortController();
205
313
  try {
206
- for await (const o of h.sendMessage(
207
- d,
314
+ for await (const i of h.sendMessage(
315
+ v,
208
316
  {
209
317
  mode: m.value,
210
- model: D.value,
211
- enableWebSearch: y.value,
212
- thinkingMode: x.value ? "enabled" : "disabled"
318
+ model: M.value,
319
+ enableWebSearch: k.value,
320
+ thinkingMode: T.value ? "enabled" : "disabled"
213
321
  },
214
- w
322
+ S
215
323
  ))
216
- if ((u = N.value) != null && u.signal.aborted || (F(U, o), o.type === "done" || o.type === "error"))
324
+ if ((u = B.value) != null && u.signal.aborted || (J(H, i), i.type === "done" || i.type === "error"))
217
325
  break;
218
- } catch (o) {
219
- console.error("发送消息失败:", o), F(U, {
326
+ } catch (i) {
327
+ console.error("发送消息失败:", i), J(H, {
220
328
  type: "error",
221
- data: o instanceof Error ? o.message : String(o)
329
+ data: i instanceof Error ? i.message : String(i)
222
330
  });
223
331
  } finally {
224
- A.value = !1;
225
- const o = s.value[U];
226
- o && (o.loading = !1, s.value = [...s.value], r && h.saveMessage({
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: o.content,
230
- thinking: o.thinking,
231
- toolCalls: o.toolCalls ? JSON.stringify(o.toolCalls) : void 0,
232
- searchResults: o.searchResults ? JSON.stringify(o.searchResults) : void 0
233
- }).catch(($) => console.error("保存助手消息失败:", $))), N.value = null;
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 v() {
237
- var d;
238
- h.cancel(), (d = N.value) == null || d.abort(), A.value = !1;
344
+ function g() {
345
+ var v;
346
+ h.cancel(), (v = B.value) == null || v.abort(), $.value = !1;
239
347
  }
240
- async function b(d) {
241
- const w = s.value.find((r) => r.id === d);
242
- if (w)
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(w.content), s.value = s.value.map(
245
- (r) => r.id === d ? { ...r, copied: !0 } : r
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
- s.value = s.value.map(
248
- (r) => r.id === d ? { ...r, copied: !1 } : r
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(d) {
256
- var w;
257
- if (d > 0 && ((w = s.value[d - 1]) == null ? void 0 : w.role) === "user") {
258
- const r = s.value[d - 1];
259
- s.value = s.value.slice(0, d - 1), C(r.content, r.images);
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(d) {
263
- h.setWorkingDir && h.setWorkingDir(d);
370
+ function G(v) {
371
+ h.setWorkingDir && h.setWorkingDir(v);
264
372
  }
265
373
  return {
266
374
  // 状态
267
- sessions: c,
375
+ sessions: o,
268
376
  currentSessionId: f,
269
- messages: s,
270
- isLoading: A,
377
+ messages: l,
378
+ isLoading: $,
271
379
  mode: m,
272
- model: D,
273
- webSearch: y,
274
- thinking: x,
380
+ model: M,
381
+ webSearch: k,
382
+ thinking: T,
275
383
  // 会话方法
276
384
  loadSessions: P,
277
- switchSession: O,
278
- createNewSession: J,
279
- deleteSession: I,
280
- deleteCurrentSession: T,
385
+ switchSession: L,
386
+ createNewSession: F,
387
+ deleteSession: A,
388
+ deleteCurrentSession: x,
281
389
  // 消息方法
282
390
  sendMessage: C,
283
- cancelRequest: v,
391
+ cancelRequest: g,
284
392
  copyMessage: b,
285
393
  regenerateMessage: V,
286
394
  // 配置方法
287
- setMode: (d) => {
288
- m.value = d;
395
+ setMode: (v) => {
396
+ m.value = v;
289
397
  },
290
- setModel: (d) => {
291
- D.value = d;
398
+ setModel: (v) => {
399
+ M.value = v;
292
400
  },
293
- setWebSearch: (d) => {
294
- y.value = d;
401
+ setWebSearch: (v) => {
402
+ k.value = v;
295
403
  },
296
- setThinking: (d) => {
297
- x.value = d;
404
+ setThinking: (v) => {
405
+ T.value = v;
298
406
  },
299
407
  // 工具方法
300
408
  setWorkingDirectory: G
301
409
  };
302
410
  }
303
- const we = [
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
- }, ht = { class: "panel-header" }, gt = { class: "panel-content" }, mt = ["onClick"], ft = { class: "history-title" }, kt = { class: "history-date" }, pt = ["onClick"], yt = {
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 g = e, a = h, c = M(/* @__PURE__ */ new Set()), f = H(
368
- () => g.sessions.filter((C) => !c.value.has(C.id))
369
- ), s = M(!1), m = M(!1), D = M(null), y = M(null);
370
- function x(C) {
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 A(C) {
374
- const v = new Date(C), V = (/* @__PURE__ */ new Date()).getTime() - v.getTime(), G = Math.floor(V / (1e3 * 60 * 60 * 24));
375
- return G === 0 ? "今天" : G === 1 ? "昨天" : G < 7 ? `${G}天前` : v.toLocaleDateString();
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 N(C) {
378
- if (c.value = /* @__PURE__ */ new Set([...c.value, C]), C === g.currentSessionId) {
379
- const v = g.sessions.filter(
380
- (b) => b.id !== C && !c.value.has(b.id)
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
- v.length > 0 && a("switch-session", v[0].id);
490
+ g.length > 0 && s("switch-session", g[0].id);
383
491
  }
384
492
  }
385
493
  function P() {
386
- s.value = !s.value, m.value = !1;
494
+ l.value = !l.value, m.value = !1;
387
495
  }
388
- function O() {
389
- m.value = !m.value, s.value = !1;
496
+ function L() {
497
+ m.value = !m.value, l.value = !1;
390
498
  }
391
- function J() {
392
- a("new-session"), s.value = !1;
499
+ function F() {
500
+ s("new-session"), l.value = !1;
393
501
  }
394
- function I(C) {
395
- if (a("switch-session", C), c.value.has(C)) {
396
- const v = new Set(c.value);
397
- v.delete(C), c.value = v;
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
- s.value = !1;
507
+ l.value = !1;
400
508
  }
401
- function T(C) {
509
+ function x(C) {
402
510
  switch (m.value = !1, C) {
403
511
  case "clear-all":
404
- a("clear-all");
512
+ s("clear-all");
405
513
  break;
406
514
  case "close-others":
407
- a("close-others");
515
+ s("close-others");
408
516
  break;
409
517
  case "export":
410
- a("export");
518
+ s("export");
411
519
  break;
412
520
  case "copy-id":
413
- a("copy-id");
521
+ s("copy-id");
414
522
  break;
415
523
  case "feedback":
416
- a("feedback");
524
+ s("feedback");
417
525
  break;
418
526
  case "settings":
419
- a("settings");
527
+ s("settings");
420
528
  break;
421
529
  }
422
530
  }
423
- function F(C) {
424
- const v = C.target;
425
- D.value && !D.value.contains(v) && (s.value = !1), y.value && !y.value.contains(v) && (m.value = !1);
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", F);
536
+ document.addEventListener("click", J);
429
537
  }), fe(() => {
430
- document.removeEventListener("click", F);
431
- }), (C, v) => (n(), i("div", at, [
538
+ document.removeEventListener("click", J);
539
+ }), (C, g) => (n(), c("div", at, [
432
540
  t("div", ot, [
433
- f.value.length === 0 ? (n(), i("span", it, " New Chat ")) : (n(!0), i(B, { key: 1 }, q(f.value, (b) => (n(), i("div", {
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, z(x(b.title)), 1),
547
+ t("span", rt, D(T(b.title)), 1),
440
548
  t("button", {
441
549
  class: "tab-close",
442
- onClick: X((V) => N(b.id), ["stop"]),
550
+ onClick: X((V) => B(b.id), ["stop"]),
443
551
  title: "关闭标签"
444
552
  }, [
445
- S(l(ne), { size: 12 })
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: v[0] || (v[0] = (b) => C.$emit("new-session"))
561
+ onClick: g[0] || (g[0] = (b) => C.$emit("new-session"))
454
562
  }, [
455
- S(l(de), { size: 14 })
563
+ z(a(de), { size: 14 })
456
564
  ]),
457
565
  t("div", {
458
566
  ref_key: "historyRef",
459
- ref: D,
567
+ ref: M,
460
568
  class: "dropdown-container"
461
569
  }, [
462
570
  t("button", {
463
- class: E(["icon-btn", { active: s.value }]),
571
+ class: E(["icon-btn", { active: l.value }]),
464
572
  title: "历史记录",
465
573
  onClick: X(P, ["stop"])
466
574
  }, [
467
- S(l(He), { size: 14 })
575
+ z(a(_e), { size: 14 })
468
576
  ], 2),
469
- s.value ? (n(), i("div", vt, [
470
- t("div", ht, [
471
- v[8] || (v[8] = t("span", null, "历史记录", -1)),
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: J
583
+ onClick: F
476
584
  }, [
477
- S(l(de), { size: 12 })
585
+ z(a(de), { size: 12 })
478
586
  ])
479
587
  ]),
480
- t("div", gt, [
481
- (n(!0), i(B, null, q(e.sessions, (b) => (n(), i("div", {
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) => I(b.id)
592
+ onClick: (V) => A(b.id)
485
593
  }, [
486
- t("span", ft, z(b.title), 1),
487
- t("span", kt, z(A(b.updatedAt)), 1),
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
- S(l(ve), { size: 12 })
601
+ z(a(ve), { size: 12 })
494
602
  ], 8, pt)
495
603
  ], 10, mt))), 128)),
496
- e.sessions.length === 0 ? (n(), i("div", yt, " 暂无历史对话 ")) : p("", !0)
604
+ e.sessions.length === 0 ? (n(), c("div", yt, " 暂无历史对话 ")) : y("", !0)
497
605
  ])
498
- ])) : p("", !0)
606
+ ])) : y("", !0)
499
607
  ], 512),
500
608
  t("div", {
501
609
  ref_key: "moreRef",
502
- ref: y,
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(O, ["stop"])
616
+ onClick: X(L, ["stop"])
509
617
  }, [
510
- S(l(We), { size: 14 })
618
+ z(a(We), { size: 14 })
511
619
  ], 2),
512
- m.value ? (n(), i("div", bt, [
620
+ m.value ? (n(), c("div", bt, [
513
621
  t("button", {
514
622
  class: "menu-item",
515
- onClick: v[1] || (v[1] = (b) => T("clear-all"))
623
+ onClick: g[1] || (g[1] = (b) => x("clear-all"))
516
624
  }, [
517
- S(l(ve), { size: 14 }),
518
- v[9] || (v[9] = t("span", null, "清空所有对话", -1))
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: v[2] || (v[2] = (b) => T("close-others"))
630
+ onClick: g[2] || (g[2] = (b) => x("close-others"))
523
631
  }, [
524
- S(l(qe), { size: 14 }),
525
- v[10] || (v[10] = t("span", null, "关闭其他对话", -1))
632
+ z(a(qe), { size: 14 }),
633
+ g[10] || (g[10] = t("span", null, "关闭其他对话", -1))
526
634
  ]),
527
- v[15] || (v[15] = t("div", { class: "menu-divider" }, null, -1)),
635
+ g[15] || (g[15] = t("div", { class: "menu-divider" }, null, -1)),
528
636
  t("button", {
529
637
  class: "menu-item",
530
- onClick: v[3] || (v[3] = (b) => T("export"))
638
+ onClick: g[3] || (g[3] = (b) => x("export"))
531
639
  }, [
532
- S(l(Ve), { size: 14 }),
533
- v[11] || (v[11] = t("span", null, "导出对话", -1))
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: v[4] || (v[4] = (b) => T("copy-id"))
645
+ onClick: g[4] || (g[4] = (b) => x("copy-id"))
538
646
  }, [
539
- S(l(ke), { size: 14 }),
540
- v[12] || (v[12] = t("span", null, "复制请求 ID", -1))
647
+ z(a(ke), { size: 14 }),
648
+ g[12] || (g[12] = t("span", null, "复制请求 ID", -1))
541
649
  ]),
542
- v[16] || (v[16] = t("div", { class: "menu-divider" }, null, -1)),
650
+ g[16] || (g[16] = t("div", { class: "menu-divider" }, null, -1)),
543
651
  t("button", {
544
652
  class: "menu-item",
545
- onClick: v[5] || (v[5] = (b) => T("feedback"))
653
+ onClick: g[5] || (g[5] = (b) => x("feedback"))
546
654
  }, [
547
- S(l(Pe), { size: 14 }),
548
- v[13] || (v[13] = t("span", null, "反馈", -1))
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: v[6] || (v[6] = (b) => T("settings"))
660
+ onClick: g[6] || (g[6] = (b) => x("settings"))
553
661
  }, [
554
- S(l(Je), { size: 14 }),
555
- v[14] || (v[14] = t("span", null, "Agent 设置", -1))
662
+ z(a(Fe), { size: 14 }),
663
+ g[14] || (g[14] = t("span", null, "Agent 设置", -1))
556
664
  ])
557
- ])) : p("", !0)
665
+ ])) : y("", !0)
558
666
  ], 512),
559
- e.showClose ? (n(), i("button", {
667
+ e.showClose ? (n(), c("button", {
560
668
  key: 0,
561
669
  class: "icon-btn",
562
670
  title: "关闭",
563
- onClick: v[7] || (v[7] = (b) => C.$emit("close"))
671
+ onClick: g[7] || (g[7] = (b) => C.$emit("close"))
564
672
  }, [
565
- S(l(ne), { size: 14 })
566
- ])) : p("", !0)
673
+ z(a(ne), { size: 14 })
674
+ ])) : y("", !0)
567
675
  ])
568
676
  ]));
569
677
  }
570
678
  }), Q = (e, h) => {
571
- const g = e.__vccOpts || e;
572
- for (const [a, c] of h)
573
- g[a] = c;
574
- return g;
575
- }, $t = /* @__PURE__ */ Q(Ct, [["__scopeId", "data-v-fd156e6a"]]), wt = { class: "welcome-message" }, St = { class: "welcome-icon" }, Mt = { class: "quick-actions" }, zt = ["onClick"], Rt = /* @__PURE__ */ K({
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(Fe)
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 (g, a) => (n(), i("div", wt, [
713
+ return (d, s) => (n(), c("div", $t, [
606
714
  t("div", St, [
607
- S(l(Ce), { size: 48 })
715
+ z(a(Ce), { size: 48 })
608
716
  ]),
609
- a[0] || (a[0] = t("h3", { class: "welcome-title" }, "AI Assistant", -1)),
610
- a[1] || (a[1] = t("p", { class: "welcome-desc" }, "我可以帮你完成各种任务,试试下面的快捷操作:", -1)),
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(), i(B, null, q(h, (c) => t("button", {
613
- key: c.id,
720
+ (n(), c(N, null, q(h, (o) => t("button", {
721
+ key: o.id,
614
722
  class: "quick-btn",
615
- onClick: (f) => g.$emit("quick-action", c.prompt)
723
+ onClick: (f) => d.$emit("quick-action", o.prompt)
616
724
  }, [
617
- (n(), k(te(c.icon), {
725
+ (n(), p(te(o.icon), {
618
726
  size: 14,
619
727
  class: "quick-icon"
620
728
  })),
621
- t("span", null, z(c.label), 1)
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" }, xt = ["src"], Et = ["title", "onClick"], At = {
737
+ }, Tt = { class: "preview-images" }, At = ["src"], xt = ["title", "onClick"], Et = {
630
738
  key: 0,
631
739
  class: "preview-more"
632
- }, Nt = { class: "input-field-wrapper" }, Bt = ["placeholder"], Lt = {
740
+ }, Bt = { class: "input-field-wrapper" }, Nt = ["placeholder"], Ot = {
633
741
  key: 1,
634
742
  class: "input-controls"
635
- }, Ot = { class: "input-left" }, Ut = ["onClick"], _t = ["onClick"], Ht = { class: "input-right" }, Wt = ["title"], qt = {
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: () => we },
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: g }) {
654
- const a = e, c = g, f = H(() => a.variant === "message"), s = M(a.value), m = M(null), D = M(null), y = M(!1);
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
- () => a.value,
764
+ () => s.value,
657
765
  (u) => {
658
- s.value = u;
766
+ l.value = u;
659
767
  }
660
768
  );
661
- const x = [
662
- { value: "agent", label: "Agent", icon: W(he) },
769
+ const T = [
770
+ { value: "agent", label: "Agent", icon: W(ge) },
663
771
  { value: "ask", label: "Ask", icon: W(be) }
664
- ], A = M(!1), N = M(!1), P = H(() => !f.value || y.value), O = H(() => a.selectedImages.slice(0, 3)), J = H(() => a.selectedImages.length > 0 ? "描述你想要的效果..." : a.mode === "ask" ? "有什么问题想问我?" : "描述任务,@ 添加上下文"), I = H(() => {
665
- const u = x.find((o) => o.value === a.mode);
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
- }), T = H(() => {
668
- const u = x.find((o) => o.value === a.mode);
669
- return (u == null ? void 0 : u.icon) || he;
670
- }), F = H(() => {
671
- const u = a.models.find((o) => o.model === a.model);
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
- A.value = !A.value, N.value = !1;
783
+ $.value = !$.value, B.value = !1;
676
784
  }
677
- function v() {
678
- N.value = !N.value, A.value = !1;
785
+ function g() {
786
+ B.value = !B.value, $.value = !1;
679
787
  }
680
788
  function b(u) {
681
- c("update:mode", u), A.value = !1;
789
+ o("update:mode", u), $.value = !1;
682
790
  }
683
791
  function V(u) {
684
- c("update:model", u.model), N.value = !1;
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 d(u) {
690
- const o = u.target;
691
- o.style.display = "none";
797
+ function v(u) {
798
+ const i = u.target;
799
+ i.style.display = "none";
692
800
  }
693
- function w(u) {
694
- c("remove-image", u);
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 R() {
704
- var o;
705
- if (a.isLoading) {
706
- c("cancel");
811
+ function I() {
812
+ var i;
813
+ if (s.isLoading) {
814
+ o("cancel");
707
815
  return;
708
816
  }
709
- const u = s.value.trim();
710
- u && (c("send", u), f.value ? y.value = !1 : (s.value = "", m.value && (m.value.style.height = "auto"), (o = m.value) == null || o.focus()));
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 U(u) {
713
- u.key === "Enter" && !u.shiftKey ? (u.preventDefault(), R()) : setTimeout(r, 0);
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 o = u.target;
717
- o.closest(".selector") || (A.value = !1, N.value = !1), f.value && D.value && !D.value.contains(o) && (y.value = !1);
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
- s.value = u;
837
+ l.value = u;
730
838
  },
731
839
  clear: () => {
732
- s.value = "";
840
+ l.value = "";
733
841
  }
734
- }), (u, o) => (n(), i("div", {
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: D,
740
- class: E(["input-container", { focused: y.value }])
847
+ ref: M,
848
+ class: E(["input-container", { focused: k.value }])
741
849
  }, [
742
- e.selectedImages.length > 0 ? (n(), i("div", It, [
850
+ e.selectedImages.length > 0 ? (n(), c("div", It, [
743
851
  t("div", Tt, [
744
- (n(!0), i(B, null, q(O.value, ($, Z) => (n(), i("div", {
745
- key: `${$}-${Z}`,
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: d
752
- }, null, 40, xt),
753
- f.value ? p("", !0) : (n(), i("button", {
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) => w(Z)
865
+ onClick: (ce) => S(Z)
758
866
  }, [
759
- S(l(ne), { size: 10 })
760
- ], 8, Et))
867
+ z(a(ne), { size: 10 })
868
+ ], 8, xt))
761
869
  ]))), 128)),
762
- e.selectedImages.length > 3 ? (n(), i("div", At, " +" + z(e.selectedImages.length - 3), 1)) : p("", !0)
870
+ e.selectedImages.length > 3 ? (n(), c("div", Et, " +" + D(e.selectedImages.length - 3), 1)) : y("", !0)
763
871
  ])
764
- ])) : p("", !0),
765
- t("div", Nt, [
766
- Ne(t("textarea", {
872
+ ])) : y("", !0),
873
+ t("div", Bt, [
874
+ Be(t("textarea", {
767
875
  ref_key: "inputRef",
768
876
  ref: m,
769
- "onUpdate:modelValue": o[0] || (o[0] = ($) => s.value = $),
770
- placeholder: J.value,
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: U,
881
+ onKeydown: H,
774
882
  onInput: r,
775
- onFocus: o[1] || (o[1] = ($) => y.value = !0)
776
- }, null, 40, Bt), [
777
- [Be, s.value]
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(), i("div", Lt, [
781
- t("div", Ot, [
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(), k(te(T.value), { size: 12 })),
787
- t("span", null, z(I.value), 1),
788
- S(l(j), {
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
- A.value ? (n(), i("div", {
900
+ $.value ? (n(), c("div", {
793
901
  key: 0,
794
902
  class: "dropdown-menu",
795
- onClick: o[2] || (o[2] = X(() => {
903
+ onClick: i[2] || (i[2] = X(() => {
796
904
  }, ["stop"]))
797
905
  }, [
798
- (n(), i(B, null, q(x, ($) => t("button", {
799
- key: $.value,
800
- class: E(["dropdown-item", { active: e.mode === $.value }]),
801
- onClick: (Z) => b($.value)
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(), k(te($.icon), { size: 14 })),
804
- t("span", null, z($.label), 1),
805
- e.mode === $.value ? (n(), k(l(se), {
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
- })) : p("", !0)
810
- ], 10, Ut)), 64))
811
- ])) : p("", !0)
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(v, ["stop"])
923
+ onClick: X(g, ["stop"])
816
924
  }, [
817
- t("span", null, z(F.value), 1),
818
- S(l(j), {
925
+ t("span", null, D(J.value), 1),
926
+ z(a(j), {
819
927
  size: 10,
820
928
  class: "chevron"
821
929
  }),
822
- N.value ? (n(), i("div", {
930
+ B.value ? (n(), c("div", {
823
931
  key: 0,
824
932
  class: "dropdown-menu",
825
- onClick: o[3] || (o[3] = X(() => {
933
+ onClick: i[3] || (i[3] = X(() => {
826
934
  }, ["stop"]))
827
935
  }, [
828
- (n(!0), i(B, null, q(e.models, ($) => (n(), i("button", {
829
- key: $.model,
830
- class: E(["dropdown-item", { active: e.model === $.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, z($.displayName), 1),
834
- e.model === $.model ? (n(), k(l(se), {
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
- })) : p("", !0)
839
- ], 10, _t))), 128))
840
- ])) : p("", !0)
946
+ })) : y("", !0)
947
+ ], 10, Ut))), 128))
948
+ ])) : y("", !0)
841
949
  ])
842
950
  ]),
843
- t("div", Ht, [
951
+ t("div", _t, [
844
952
  t("button", {
845
953
  class: "icon-btn",
846
954
  title: "提及上下文 (@)",
847
- onClick: o[4] || (o[4] = ($) => u.$emit("at-context"))
955
+ onClick: i[4] || (i[4] = (w) => u.$emit("at-context"))
848
956
  }, [
849
- S(l(Ge), { size: 14 })
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: o[5] || (o[5] = ($) => u.$emit("update:thinking", !e.thinkingEnabled))
962
+ onClick: i[5] || (i[5] = (w) => u.$emit("update:thinking", !e.thinkingEnabled))
855
963
  }, [
856
- S(l(Ce), { size: 14 })
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: o[6] || (o[6] = ($) => u.$emit("update:webSearch", !e.webSearchEnabled))
969
+ onClick: i[6] || (i[6] = (w) => u.$emit("update:webSearch", !e.webSearchEnabled))
862
970
  }, [
863
- S(l(ie), { size: 14 })
971
+ z(a(ie), { size: 14 })
864
972
  ], 2),
865
973
  t("button", {
866
974
  class: "icon-btn",
867
975
  title: "上传图片",
868
- onClick: o[7] || (o[7] = ($) => u.$emit("upload-image"))
976
+ onClick: i[7] || (i[7] = (w) => u.$emit("upload-image"))
869
977
  }, [
870
- S(l(Ke), { size: 14 })
978
+ z(a(Ke), { size: 14 })
871
979
  ]),
872
- s.value.trim() || e.isLoading ? (n(), i("button", {
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: R
984
+ onClick: I
877
985
  }, [
878
- e.isLoading ? (n(), k(l(Qe), {
986
+ e.isLoading ? (n(), p(a(Qe), {
879
987
  key: 0,
880
988
  size: 14
881
- })) : (n(), k(l(Xe), {
989
+ })) : (n(), p(a(Xe), {
882
990
  key: 1,
883
991
  size: 14
884
992
  }))
885
- ], 10, Wt)) : (n(), i("button", qt, [
886
- S(l(je), { size: 14 })
993
+ ], 10, Wt)) : (n(), c("button", qt, [
994
+ z(a(je), { size: 14 })
887
995
  ]))
888
996
  ])
889
- ])) : p("", !0)
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
- }, Jt = {
1004
+ }, Ft = {
897
1005
  key: 0,
898
1006
  class: "step thinking-step"
899
- }, Ft = { class: "step-icon" }, Gt = { class: "step-title" }, Kt = {
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, g = M(!1), a = M(!0), c = Le({}), f = H(() => {
924
- var y, x;
925
- return h.thinking || h.searching || ((y = h.searchResults) == null ? void 0 : y.length) || ((x = h.toolCalls) == null ? void 0 : x.length) || h.loading && !h.hasContent;
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 s(y) {
928
- c[y] = !c[y];
1035
+ function l(k) {
1036
+ o[k] = !o[k];
929
1037
  }
930
- function m(y) {
1038
+ function m(k) {
931
1039
  try {
932
- return new URL(y).hostname;
1040
+ return new URL(k).hostname;
933
1041
  } catch {
934
- return y;
1042
+ return k;
935
1043
  }
936
1044
  }
937
- function D(y) {
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
- }[y] || y;
1057
+ }[k] || k;
950
1058
  }
951
- return (y, x) => {
952
- var A, N, P, O, J;
953
- return f.value ? (n(), i("div", Pt, [
954
- e.thinking || e.loading && !e.hasContent && !((A = e.toolCalls) != null && A.length) ? (n(), i("div", Jt, [
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: x[0] || (x[0] = (I) => g.value = !g.value)
1065
+ onClick: T[0] || (T[0] = (A) => d.value = !d.value)
958
1066
  }, [
959
- t("div", Ft, [
960
- e.thinkingComplete ? (n(), k(l($e), {
1067
+ t("div", Jt, [
1068
+ e.thinkingComplete ? (n(), p(a(we), {
961
1069
  key: 1,
962
1070
  size: 14
963
- })) : (n(), k(l(ee), {
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, z(e.thinkingComplete ? "思考完成" : "正在思考..."), 1),
970
- e.thinking ? (n(), k(l(j), {
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: g.value }])
974
- }, null, 8, ["class"])) : p("", !0)
1081
+ class: E(["step-chevron", { expanded: d.value }])
1082
+ }, null, 8, ["class"])) : y("", !0)
975
1083
  ]),
976
- e.thinking && g.value ? (n(), i("div", Kt, [
977
- t("div", Qt, z(e.thinking), 1)
978
- ])) : p("", !0)
979
- ])) : p("", !0),
980
- e.searching || (N = e.searchResults) != null && N.length ? (n(), i("div", Xt, [
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: x[1] || (x[1] = (I) => a.value = !a.value)
1091
+ onClick: T[1] || (T[1] = (A) => s.value = !s.value)
984
1092
  }, [
985
1093
  t("div", jt, [
986
- e.searching ? (n(), k(l(ee), {
1094
+ e.searching ? (n(), p(a(ee), {
987
1095
  key: 0,
988
1096
  size: 14,
989
1097
  class: "animate-spin"
990
- })) : (n(), k(l(ie), {
1098
+ })) : (n(), p(a(ie), {
991
1099
  key: 1,
992
1100
  size: 14
993
1101
  }))
994
1102
  ]),
995
- t("span", Zt, z(e.searching ? "正在搜索..." : `找到 ${((P = e.searchResults) == null ? void 0 : P.length) || 0} 条结果`), 1),
996
- (O = e.searchResults) != null && O.length ? (n(), k(l(j), {
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: a.value }])
1000
- }, null, 8, ["class"])) : p("", !0)
1107
+ class: E(["step-chevron", { expanded: s.value }])
1108
+ }, null, 8, ["class"])) : y("", !0)
1001
1109
  ]),
1002
- (J = e.searchResults) != null && J.length && a.value ? (n(), i("div", Yt, [
1110
+ (F = e.searchResults) != null && F.length && s.value ? (n(), c("div", Yt, [
1003
1111
  t("div", en, [
1004
- (n(!0), i(B, null, q(e.searchResults, (I, T) => (n(), i("a", {
1005
- key: T,
1006
- href: I.url,
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, z(I.title), 1),
1011
- t("span", sn, z(m(I.url)), 1)
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
- ])) : p("", !0)
1015
- ])) : p("", !0),
1016
- (n(!0), i(B, null, q(e.toolCalls, (I, T) => (n(), i("div", {
1017
- key: T,
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: (F) => s(T)
1130
+ onClick: (J) => l(x)
1023
1131
  }, [
1024
1132
  t("div", an, [
1025
- I.status === "running" ? (n(), k(l(ee), {
1133
+ A.status === "running" ? (n(), p(a(ee), {
1026
1134
  key: 0,
1027
1135
  size: 14,
1028
1136
  class: "animate-spin"
1029
- })) : I.status === "success" ? (n(), k(l(se), {
1137
+ })) : A.status === "success" ? (n(), p(a(se), {
1030
1138
  key: 1,
1031
1139
  size: 14,
1032
1140
  class: "text-green"
1033
- })) : (n(), k(l(ne), {
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, z(D(I.name)), 1),
1040
- I.result ? (n(), k(l(j), {
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: c[T] }])
1044
- }, null, 8, ["class"])) : p("", !0)
1151
+ class: E(["step-chevron", { expanded: o[x] }])
1152
+ }, null, 8, ["class"])) : y("", !0)
1045
1153
  ], 8, ln),
1046
- I.result && c[T] ? (n(), i("div", cn, [
1047
- t("pre", rn, z(I.result), 1)
1048
- ])) : p("", !0)
1154
+ A.result && o[x] ? (n(), c("div", cn, [
1155
+ t("pre", rn, D(A.result), 1)
1156
+ ])) : y("", !0)
1049
1157
  ]))), 128))
1050
- ])) : p("", !0);
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
- }, hn = { class: "user-text" }, gn = {
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, g = H(() => {
1083
- let a = h.content;
1084
- return a = a.replace(/```(\w*)\n([\s\S]*?)```/g, '<pre class="code-block"><code>$2</code></pre>'), a = a.replace(/`([^`]+)`/g, '<code class="inline-code">$1</code>'), a = a.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), a = a.replace(/\*([^*]+)\*/g, "<em>$1</em>"), a = a.replace(/\n/g, "<br>"), a;
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 (a, c) => {
1194
+ return (s, o) => {
1087
1195
  var f;
1088
- return n(), i("div", {
1196
+ return n(), c("div", {
1089
1197
  class: E(["message-bubble", e.role])
1090
1198
  }, [
1091
- e.role === "user" ? (n(), i(B, { key: 0 }, [
1092
- e.onSend ? (n(), k(Se, {
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: c[0] || (c[0] = (s) => a.$emit("send", s))
1098
- }, null, 8, ["value", "selected-images"])) : (n(), i("div", vn, [
1099
- t("div", hn, z(e.content), 1),
1100
- e.images && e.images.length > 0 ? (n(), i("div", gn, [
1101
- (n(!0), i(B, null, q(e.images, (s, m) => (n(), i("img", {
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: s,
1211
+ src: l,
1104
1212
  class: "user-image",
1105
- onClick: (D) => a.$emit("view-image", s)
1213
+ onClick: (M) => s.$emit("view-image", l)
1106
1214
  }, null, 8, mn))), 128))
1107
- ])) : p("", !0)
1215
+ ])) : y("", !0)
1108
1216
  ]))
1109
- ], 64)) : (n(), i(B, { key: 1 }, [
1217
+ ], 64)) : (n(), c(N, { key: 1 }, [
1110
1218
  t("div", fn, [
1111
- S(dn, {
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(), i("div", {
1228
+ e.content ? (n(), c("div", {
1121
1229
  key: 0,
1122
1230
  class: "assistant-text",
1123
- innerHTML: g.value
1124
- }, null, 8, kn)) : p("", !0),
1125
- e.loading && !e.content && !e.thinking && !((f = e.toolCalls) != null && f.length) ? (n(), i("div", pn, [...c[3] || (c[3] = [
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
- ])])) : p("", !0)
1237
+ ])])) : y("", !0)
1130
1238
  ]),
1131
- e.content && !e.loading ? (n(), i("div", yn, [
1239
+ e.content && !e.loading ? (n(), c("div", yn, [
1132
1240
  t("button", {
1133
1241
  class: "action-btn",
1134
1242
  title: "复制",
1135
- onClick: c[1] || (c[1] = (s) => a.$emit("copy"))
1243
+ onClick: o[1] || (o[1] = (l) => s.$emit("copy"))
1136
1244
  }, [
1137
- (n(), k(te(e.copied ? l(se) : l(ke)), { size: 14 }))
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: c[2] || (c[2] = (s) => a.$emit("regenerate"))
1250
+ onClick: o[2] || (o[2] = (l) => s.$emit("regenerate"))
1143
1251
  }, [
1144
- S(l(Ze), { size: 14 })
1252
+ z(a(Ze), { size: 14 })
1145
1253
  ])
1146
- ])) : p("", !0)
1254
+ ])) : y("", !0)
1147
1255
  ], 64))
1148
1256
  ], 2);
1149
1257
  };
1150
1258
  }
1151
- }), Cn = /* @__PURE__ */ Q(bn, [["__scopeId", "data-v-bb746e4b"]]), $n = { class: "chat-panel" }, wn = /* @__PURE__ */ K({
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: () => we },
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 g = e, a = h, c = st({
1166
- adapter: g.adapter,
1167
- defaultModel: g.defaultModel,
1168
- defaultMode: g.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: s,
1279
+ currentSessionId: l,
1172
1280
  messages: m,
1173
- isLoading: D,
1174
- mode: y,
1175
- model: x,
1176
- webSearch: A,
1177
- thinking: N,
1281
+ isLoading: M,
1282
+ mode: k,
1283
+ model: T,
1284
+ webSearch: $,
1285
+ thinking: B,
1178
1286
  loadSessions: P,
1179
- switchSession: O,
1180
- createNewSession: J,
1181
- deleteSession: I,
1182
- sendMessage: T,
1183
- cancelRequest: F,
1287
+ switchSession: L,
1288
+ createNewSession: F,
1289
+ deleteSession: A,
1290
+ sendMessage: x,
1291
+ cancelRequest: J,
1184
1292
  copyMessage: C,
1185
- regenerateMessage: v,
1293
+ regenerateMessage: g,
1186
1294
  setMode: b,
1187
1295
  setModel: V,
1188
1296
  setWebSearch: G,
1189
- setThinking: d,
1190
- setWorkingDirectory: w
1191
- } = c, r = M([]), R = M(null), U = Oe(g, "models");
1192
- Ue("chatAdapter", g.adapter), oe(() => {
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
- () => g.workingDir,
1196
- (L) => {
1197
- L && w(L);
1303
+ () => d.workingDir,
1304
+ (O) => {
1305
+ O && S(O);
1198
1306
  },
1199
1307
  { immediate: !0 }
1200
1308
  );
1201
1309
  async function Y() {
1202
- await _e(), R.value && (R.value.scrollTop = R.value.scrollHeight);
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(L) {
1208
- T(L, r.value.length > 0 ? r.value : void 0), r.value = [];
1315
+ function u(O) {
1316
+ x(O, r.value.length > 0 ? r.value : void 0), r.value = [];
1209
1317
  }
1210
- function o(L) {
1211
- T(L);
1318
+ function i(O) {
1319
+ x(O);
1212
1320
  }
1213
- function $(L, re) {
1214
- m.value = m.value.slice(0, L), T(re);
1321
+ function w(O, re) {
1322
+ m.value = m.value.slice(0, O), x(re);
1215
1323
  }
1216
- function Z(L) {
1217
- L >= 0 && L < r.value.length && r.value.splice(L, 1);
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
- g.onClose && g.onClose(), a("close");
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
- s.value && (navigator.clipboard.writeText(s.value), console.log("已复制请求 ID:", s.value));
1346
+ l.value && (navigator.clipboard.writeText(l.value), console.log("已复制请求 ID:", l.value));
1239
1347
  }
1240
- function xe() {
1348
+ function Ae() {
1241
1349
  console.log("反馈");
1242
1350
  }
1243
- function Ee() {
1351
+ function xe() {
1244
1352
  console.log("Agent 设置");
1245
1353
  }
1246
- return (L, re) => (n(), i("div", $n, [
1247
- e.hideHeader ? p("", !0) : (n(), k($t, {
1354
+ return (O, re) => (n(), c("div", wn, [
1355
+ e.hideHeader ? y("", !0) : (n(), p(wt, {
1248
1356
  key: 0,
1249
- sessions: l(f),
1250
- "current-session-id": l(s),
1357
+ sessions: a(f),
1358
+ "current-session-id": a(l),
1251
1359
  "show-close": !!e.onClose,
1252
- onNewSession: l(J),
1253
- onSwitchSession: l(O),
1254
- onDeleteSession: l(I),
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: xe,
1261
- onSettings: Ee
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: R,
1373
+ ref: I,
1266
1374
  class: "messages-container"
1267
1375
  }, [
1268
- l(m).length === 0 ? (n(), k(Dt, {
1376
+ a(m).length === 0 ? (n(), p(Dt, {
1269
1377
  key: 0,
1270
- onQuickAction: o
1271
- })) : (n(!0), i(B, { key: 1 }, q(l(m), (_, ue) => (n(), k(Cn, {
1272
- key: _.id,
1273
- role: _.role,
1274
- content: _.content,
1275
- images: _.images,
1276
- thinking: _.thinking,
1277
- "thinking-complete": _.thinkingComplete,
1278
- "search-results": _.searchResults,
1279
- searching: _.searching,
1280
- "tool-calls": _.toolCalls,
1281
- copied: _.copied,
1282
- loading: _.loading,
1283
- onCopy: (le) => l(C)(_.id),
1284
- onRegenerate: (le) => l(v)(ue),
1285
- onSend: (le) => $(ue, 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
- S(Se, {
1396
+ z(Se, {
1289
1397
  "selected-images": r.value,
1290
- "is-loading": l(D),
1291
- mode: l(y),
1292
- model: l(x),
1293
- models: U.value,
1294
- "web-search-enabled": l(A),
1295
- "thinking-enabled": l(N),
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: l(F),
1405
+ onCancel: a(J),
1298
1406
  onRemoveImage: Z,
1299
1407
  onUploadImage: ce,
1300
1408
  onAtContext: Me,
1301
- "onUpdate:mode": l(b),
1302
- "onUpdate:model": l(V),
1303
- "onUpdate:webSearch": l(G),
1304
- "onUpdate:thinking": l(d)
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
- }), Fn = /* @__PURE__ */ Q(wn, [["__scopeId", "data-v-2332ad8f"]]), Sn = { class: "thinking-icon" }, Mn = { class: "thinking-title" }, zn = {
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 = M(!1);
1319
- return (g, a) => (n(), i("div", {
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: a[0] || (a[0] = (c) => h.value = !h.value)
1432
+ onClick: s[0] || (s[0] = (o) => h.value = !h.value)
1325
1433
  }, [
1326
1434
  t("div", Sn, [
1327
- e.isComplete ? (n(), k(l($e), {
1435
+ e.isComplete ? (n(), p(a(we), {
1328
1436
  key: 1,
1329
1437
  size: 14
1330
- })) : (n(), k(l(ee), {
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, z(e.isComplete ? "思考完成" : "正在思考..."), 1),
1337
- S(l(j), {
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(), i("div", zn, [
1343
- t("div", Rn, z(e.content), 1)
1344
- ])) : p("", !0)
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
- }), Gn = /* @__PURE__ */ Q(Dn, [["__scopeId", "data-v-318aa171"]]), In = { class: "tool-icon" }, Tn = { class: "tool-name" }, xn = {
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
- }, En = { class: "arg-key" }, An = { class: "arg-value" }, Nn = {
1458
+ }, xn = { class: "arg-key" }, En = { class: "arg-value" }, Bn = {
1351
1459
  key: 1,
1352
1460
  class: "tool-result"
1353
- }, Bn = /* @__PURE__ */ K({
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, g = M(!1), a = H(() => ({
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), c = H(() => ({
1483
+ })[h.name] || h.name), o = _(() => ({
1376
1484
  execute_command: W(et),
1377
- analyze_image: W(ge),
1378
- generate_image: W(ge),
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(s) {
1383
- return typeof s == "string" ? s.length > 50 ? s.substring(0, 50) + "..." : s : JSON.stringify(s);
1490
+ function f(l) {
1491
+ return typeof l == "string" ? l.length > 50 ? l.substring(0, 50) + "..." : l : JSON.stringify(l);
1384
1492
  }
1385
- return (s, m) => (n(), i("div", {
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] = (D) => g.value = !g.value)
1498
+ onClick: m[0] || (m[0] = (M) => d.value = !d.value)
1391
1499
  }, [
1392
1500
  t("div", In, [
1393
- e.status === "running" ? (n(), k(l(ee), {
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(), k(l(se), {
1505
+ })) : e.status === "success" ? (n(), p(a(se), {
1398
1506
  key: 1,
1399
1507
  size: 14
1400
- })) : e.status === "error" ? (n(), k(l(ne), {
1508
+ })) : e.status === "error" ? (n(), p(a(ne), {
1401
1509
  key: 2,
1402
1510
  size: 14
1403
- })) : (n(), k(te(c.value), {
1511
+ })) : (n(), p(te(o.value), {
1404
1512
  key: 3,
1405
1513
  size: 14
1406
1514
  }))
1407
1515
  ]),
1408
- t("span", Tn, z(a.value), 1),
1409
- e.result ? (n(), k(l(j), {
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: g.value }])
1413
- }, null, 8, ["class"])) : p("", !0)
1520
+ class: E(["chevron", { rotated: d.value }])
1521
+ }, null, 8, ["class"])) : y("", !0)
1414
1522
  ]),
1415
- e.args && Object.keys(e.args).length > 0 && g.value ? (n(), i("div", xn, [
1416
- (n(!0), i(B, null, q(e.args, (D, y) => (n(), i("div", {
1417
- key: y,
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", En, z(y) + ":", 1),
1421
- t("span", An, z(f(D)), 1)
1528
+ t("span", xn, D(k) + ":", 1),
1529
+ t("span", En, D(f(M)), 1)
1422
1530
  ]))), 128))
1423
- ])) : p("", !0),
1424
- e.result && g.value ? (n(), i("div", Nn, [
1425
- t("pre", null, z(e.result), 1)
1426
- ])) : p("", !0)
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
- }), Kn = /* @__PURE__ */ Q(Bn, [["__scopeId", "data-v-7098f4a3"]]), Ln = { class: "search-block" }, On = { class: "search-icon" }, Un = { class: "search-title" }, _n = {
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
- }, Hn = ["href"], Wn = { class: "result-title" }, qn = { class: "result-url" }, Vn = /* @__PURE__ */ K({
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 = M(!0);
1440
- function g(a) {
1547
+ const h = R(!0);
1548
+ function d(s) {
1441
1549
  try {
1442
- return new URL(a).hostname;
1550
+ return new URL(s).hostname;
1443
1551
  } catch {
1444
- return a;
1552
+ return s;
1445
1553
  }
1446
1554
  }
1447
- return (a, c) => (n(), i("div", Ln, [
1555
+ return (s, o) => (n(), c("div", On, [
1448
1556
  t("div", {
1449
1557
  class: "search-header",
1450
- onClick: c[0] || (c[0] = (f) => h.value = !h.value)
1558
+ onClick: o[0] || (o[0] = (f) => h.value = !h.value)
1451
1559
  }, [
1452
- t("div", On, [
1453
- e.searching ? (n(), k(l(ee), {
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(), k(l(ie), {
1565
+ })) : (n(), p(a(ie), {
1458
1566
  key: 1,
1459
1567
  size: 14
1460
1568
  }))
1461
1569
  ]),
1462
- t("span", Un, z(e.searching ? "正在搜索..." : `找到 ${e.results.length} 条结果`), 1),
1463
- !e.searching && e.results.length > 0 ? (n(), k(l(j), {
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"])) : p("", !0)
1575
+ }, null, 8, ["class"])) : y("", !0)
1468
1576
  ]),
1469
- !e.searching && h.value && e.results.length > 0 ? (n(), i("div", _n, [
1470
- (n(!0), i(B, null, q(e.results.slice(0, 5), (f, s) => (n(), i("a", {
1471
- key: s,
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, z(f.title), 1),
1477
- t("span", qn, z(g(f.url)), 1)
1478
- ], 8, Hn))), 128))
1479
- ])) : p("", !0)
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
- }), Qn = /* @__PURE__ */ Q(Vn, [["__scopeId", "data-v-f1490d29"]]);
1590
+ }), Xn = /* @__PURE__ */ Q(Vn, [["__scopeId", "data-v-f1490d29"]]);
1483
1591
  export {
1484
- $t as ChatHeader,
1592
+ wt as ChatHeader,
1485
1593
  Se as ChatInput,
1486
- Fn as ChatPanel,
1487
- we as DEFAULT_MODELS,
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
- Qn as SearchResultBlock,
1492
- Gn as ThinkingBlock,
1493
- Kn as ToolCallBlock,
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
  };