tax-ai 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/index.d.ts +308 -0
- package/dist/tax-ai.css +1 -0
- package/dist/tax-ai.js +1323 -0
- package/package.json +56 -0
package/dist/tax-ai.js
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
import { provide as kt, inject as ht, computed as S, defineComponent as U, ref as C, onBeforeUnmount as wt, openBlock as v, createElementBlock as k, withModifiers as $, normalizeClass as q, createElementVNode as a, onUnmounted as Mt, createBlock as tt, unref as m, withCtx as dt, toDisplayString as E, createVNode as F, createCommentVNode as N, h as Z, nextTick as G, watch as z, withDirectives as H, vModelText as vt, Fragment as ut, renderList as _t, vShow as V, Transition as xt } from "vue";
|
|
2
|
+
import { XRequest as Et, ThoughtChainItemStatus as X, Bubble as Tt, XProvider as Rt, Welcome as Bt, Prompts as St, Sender as Pt, ThoughtChain as Yt } from "tax-x";
|
|
3
|
+
import { TaxMarkdown as Ot } from "tax-markdown";
|
|
4
|
+
const Lt = {
|
|
5
|
+
panel: {
|
|
6
|
+
title: "AI 助手",
|
|
7
|
+
statusText: "随时为你解答",
|
|
8
|
+
historyTitle: "聊天记录",
|
|
9
|
+
backLabel: "返回"
|
|
10
|
+
},
|
|
11
|
+
welcome: {
|
|
12
|
+
title: "AI 助手",
|
|
13
|
+
description: "我可以帮助你解答问题、分析数据或提供操作指引。"
|
|
14
|
+
},
|
|
15
|
+
prompts: {
|
|
16
|
+
title: "试试这些问题",
|
|
17
|
+
items: []
|
|
18
|
+
},
|
|
19
|
+
sender: {
|
|
20
|
+
placeholder: "输入问题,Enter 发送"
|
|
21
|
+
},
|
|
22
|
+
chat: {
|
|
23
|
+
loadingHistoryText: "加载历史对话中...",
|
|
24
|
+
loadHistoryFailedPrefix: "**加载历史失败:**",
|
|
25
|
+
unknownErrorText: "未知错误",
|
|
26
|
+
streamErrorPrefix: "**错误:**",
|
|
27
|
+
requestFailedPrefix: "**请求失败:**",
|
|
28
|
+
networkErrorPrefix: "**网络错误:**"
|
|
29
|
+
},
|
|
30
|
+
history: {
|
|
31
|
+
searchPlaceholder: "搜索对话标题或内容",
|
|
32
|
+
loadingText: "加载中...",
|
|
33
|
+
loadFailedText: "加载失败",
|
|
34
|
+
deleteFailedText: "删除失败",
|
|
35
|
+
renameFailedText: "重命名失败",
|
|
36
|
+
renameEmptyError: "标题不能为空",
|
|
37
|
+
emptyTitle: "暂无聊天记录",
|
|
38
|
+
emptyDescription: "开始新对话后,历史记录会显示在这里",
|
|
39
|
+
roundUnit: "轮",
|
|
40
|
+
loadMoreText: "加载更多",
|
|
41
|
+
loadingMoreText: "加载更多..."
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function jt(t, e) {
|
|
45
|
+
var o, c;
|
|
46
|
+
return {
|
|
47
|
+
panel: { ...t.panel, ...e == null ? void 0 : e.panel },
|
|
48
|
+
welcome: { ...t.welcome, ...e == null ? void 0 : e.welcome },
|
|
49
|
+
prompts: {
|
|
50
|
+
title: ((o = e == null ? void 0 : e.prompts) == null ? void 0 : o.title) ?? t.prompts.title,
|
|
51
|
+
items: ((c = e == null ? void 0 : e.prompts) == null ? void 0 : c.items) ?? t.prompts.items
|
|
52
|
+
},
|
|
53
|
+
sender: { ...t.sender, ...e == null ? void 0 : e.sender },
|
|
54
|
+
chat: { ...t.chat, ...e == null ? void 0 : e.chat },
|
|
55
|
+
history: { ...t.history, ...e == null ? void 0 : e.history }
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const At = Symbol("AiHostAdapter");
|
|
59
|
+
function Ft(t) {
|
|
60
|
+
kt(At, t);
|
|
61
|
+
}
|
|
62
|
+
function Ct() {
|
|
63
|
+
const t = ht(At);
|
|
64
|
+
if (!t)
|
|
65
|
+
throw new Error("[ai-assistant] AiHostAdapter is not provided");
|
|
66
|
+
return t;
|
|
67
|
+
}
|
|
68
|
+
function Dt() {
|
|
69
|
+
return ht(At);
|
|
70
|
+
}
|
|
71
|
+
function mt() {
|
|
72
|
+
const t = Ct();
|
|
73
|
+
return S(() => jt(Lt, t.ui));
|
|
74
|
+
}
|
|
75
|
+
const Nt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAAC1ay+zAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAmyUlEQVR4AZVbB2CU5d3/3b7LZW8yIAlJIIQQdmQKWnGgiAProLhFq6LVuidara3V2tZW66htFbUOtAIORFmydwIJSciGkL0vt+++3/+5ezEgrV+f5O593+d91n+P5zmd3+8P6nQ6BINBSJF7rWh1Wr32rLWR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1wTS20A7Vlbj/Ys77W6U9sqBEjl0MZao//lOnQCGWvoeMKivTyJ0tnFQ438KX0nD0328GzSIE9pSbFyvy86Klqd303kCfJEnvqK4RkEi2RFw0XG1xIzXK3iGu2ddtXm1NZy6rPWTrvK+/8Df+aFpfYYc4MAAAAASUVORK5CYII=", bt = Symbol("AiAvatar");
|
|
76
|
+
function Ht(t) {
|
|
77
|
+
kt(bt, t);
|
|
78
|
+
}
|
|
79
|
+
function pt() {
|
|
80
|
+
const t = ht(bt);
|
|
81
|
+
return S(() => (t == null ? void 0 : t.value) || Nt);
|
|
82
|
+
}
|
|
83
|
+
const Ut = {
|
|
84
|
+
list: "/api/conversations",
|
|
85
|
+
messages: (t) => `/api/conversations/${t}/messages`,
|
|
86
|
+
rename: (t) => `/api/conversations/${t}`,
|
|
87
|
+
delete: (t) => `/api/conversations/${t}`
|
|
88
|
+
}, Kt = 600 * 1e3;
|
|
89
|
+
function yt(t, e) {
|
|
90
|
+
const o = t == null ? void 0 : t[e];
|
|
91
|
+
return o != null && o > 0 ? o : Kt;
|
|
92
|
+
}
|
|
93
|
+
function Gt(t) {
|
|
94
|
+
return yt(t.requestTimeouts, "fetch");
|
|
95
|
+
}
|
|
96
|
+
function qt(t) {
|
|
97
|
+
return yt(t.requestTimeouts, "stream");
|
|
98
|
+
}
|
|
99
|
+
function Qt(t) {
|
|
100
|
+
return yt(t.requestTimeouts, "streamIdle");
|
|
101
|
+
}
|
|
102
|
+
function Jt(t, e) {
|
|
103
|
+
const o = AbortSignal.timeout(t);
|
|
104
|
+
return e && typeof AbortSignal.any == "function" ? AbortSignal.any([e, o]) : o;
|
|
105
|
+
}
|
|
106
|
+
function Wt(t, e) {
|
|
107
|
+
return `${t.getApiBaseUrl().replace(/\/$/, "")}${e}`;
|
|
108
|
+
}
|
|
109
|
+
async function Zt(t) {
|
|
110
|
+
try {
|
|
111
|
+
return (await t.json()).detail ?? t.statusText;
|
|
112
|
+
} catch {
|
|
113
|
+
return t.statusText;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function et(t, e, o) {
|
|
117
|
+
var h;
|
|
118
|
+
const c = await ((h = t.getRequestHeaders) == null ? void 0 : h.call(t)) ?? {}, l = Gt(t), i = await fetch(Wt(t, e), {
|
|
119
|
+
...o,
|
|
120
|
+
credentials: t.credentials ?? "include",
|
|
121
|
+
signal: Jt(l, o == null ? void 0 : o.signal),
|
|
122
|
+
headers: {
|
|
123
|
+
Accept: "application/json",
|
|
124
|
+
...c,
|
|
125
|
+
...o == null ? void 0 : o.headers
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
if (!i.ok)
|
|
129
|
+
throw new Error(await Zt(i));
|
|
130
|
+
return i.json();
|
|
131
|
+
}
|
|
132
|
+
function ot(t) {
|
|
133
|
+
return {
|
|
134
|
+
...Ut,
|
|
135
|
+
...t.conversationEndpoints
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function zt(t, e = {}) {
|
|
139
|
+
const o = ot(t), c = new URLSearchParams();
|
|
140
|
+
e.keyword && c.set("keyword", e.keyword), e.limit && c.set("limit", String(e.limit)), e.cursor && c.set("cursor", e.cursor);
|
|
141
|
+
const l = c.toString(), i = l ? `${o.list}?${l}` : o.list;
|
|
142
|
+
return et(t, i);
|
|
143
|
+
}
|
|
144
|
+
async function Vt(t, e, o = {}) {
|
|
145
|
+
const c = ot(t), l = new URLSearchParams();
|
|
146
|
+
o.limit && l.set("limit", String(o.limit)), o.cursor && l.set("cursor", o.cursor);
|
|
147
|
+
const i = l.toString(), h = c.messages(e), p = i ? `${h}?${i}` : h;
|
|
148
|
+
return et(t, p);
|
|
149
|
+
}
|
|
150
|
+
async function Xt(t, e, o) {
|
|
151
|
+
const c = ot(t);
|
|
152
|
+
return et(t, c.rename(e), {
|
|
153
|
+
method: "PATCH",
|
|
154
|
+
headers: { "Content-Type": "application/json" },
|
|
155
|
+
body: JSON.stringify({ title: o })
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async function $t(t, e) {
|
|
159
|
+
const o = ot(t);
|
|
160
|
+
return et(t, o.delete(e), {
|
|
161
|
+
method: "DELETE"
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const te = {
|
|
165
|
+
stream: "/api/chat/stream"
|
|
166
|
+
};
|
|
167
|
+
function ee(t) {
|
|
168
|
+
var c;
|
|
169
|
+
const e = t.getApiBaseUrl().replace(/\/$/, ""), o = ((c = t.chatEndpoints) == null ? void 0 : c.stream) ?? te.stream;
|
|
170
|
+
return `${e}${o}`;
|
|
171
|
+
}
|
|
172
|
+
function oe(t) {
|
|
173
|
+
const e = t.data;
|
|
174
|
+
if (typeof e != "string" || !e.trim())
|
|
175
|
+
return null;
|
|
176
|
+
try {
|
|
177
|
+
return JSON.parse(e);
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function ne(t) {
|
|
183
|
+
return typeof t.token == "string";
|
|
184
|
+
}
|
|
185
|
+
function ft(t) {
|
|
186
|
+
return typeof t.full == "string";
|
|
187
|
+
}
|
|
188
|
+
function ae(t, e) {
|
|
189
|
+
var o, c, l, i, h;
|
|
190
|
+
switch (t.type) {
|
|
191
|
+
case "heartbeat":
|
|
192
|
+
(o = e.onHeartbeat) == null || o.call(e);
|
|
193
|
+
break;
|
|
194
|
+
case "cot":
|
|
195
|
+
(c = e.onCot) == null || c.call(e, t.status, t.data, t.message_id);
|
|
196
|
+
break;
|
|
197
|
+
case "msg":
|
|
198
|
+
t.status === "running" && ne(t.data) ? (l = e.onMsgDelta) == null || l.call(e, t.data.token, t.message_id) : t.status === "end" && ft(t.data) ? (i = e.onMsgEnd) == null || i.call(e, t.data.full, t.message_id) : t.status === "error" && ft(t.data) && ((h = e.onMsgError) == null || h.call(
|
|
199
|
+
e,
|
|
200
|
+
t.data.full,
|
|
201
|
+
t.data.reason ?? "生成失败",
|
|
202
|
+
t.message_id
|
|
203
|
+
));
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async function ie(t, e, o) {
|
|
208
|
+
var M;
|
|
209
|
+
const c = await ((M = t.getRequestHeaders) == null ? void 0 : M.call(t)) ?? {};
|
|
210
|
+
let l, i;
|
|
211
|
+
const h = new Promise((y, b) => {
|
|
212
|
+
l = y, i = b;
|
|
213
|
+
}), p = Et(ee(t), {
|
|
214
|
+
manual: !0,
|
|
215
|
+
credentials: t.credentials ?? "include",
|
|
216
|
+
timeout: qt(t),
|
|
217
|
+
streamTimeout: Qt(t),
|
|
218
|
+
headers: {
|
|
219
|
+
Accept: "text/event-stream",
|
|
220
|
+
"Content-Type": "application/json",
|
|
221
|
+
...c
|
|
222
|
+
},
|
|
223
|
+
callbacks: {
|
|
224
|
+
onUpdate: (y) => {
|
|
225
|
+
const b = oe(y);
|
|
226
|
+
b && ae(b, o);
|
|
227
|
+
},
|
|
228
|
+
onSuccess: () => {
|
|
229
|
+
var y;
|
|
230
|
+
(y = o.onFinish) == null || y.call(o), l();
|
|
231
|
+
},
|
|
232
|
+
onError: (y) => {
|
|
233
|
+
var b;
|
|
234
|
+
y.name !== "AbortError" ? ((b = o.onError) == null || b.call(o, y.message || "Request failed"), i(y)) : l();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}), g = t.getPageContext ? await t.getPageContext() : void 0, I = {
|
|
238
|
+
...e,
|
|
239
|
+
...g !== void 0 ? { page_context: g } : {}
|
|
240
|
+
};
|
|
241
|
+
return p.run(I), {
|
|
242
|
+
abort: () => p.abort(),
|
|
243
|
+
finished: h
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const se = {
|
|
247
|
+
loading: X.LOADING,
|
|
248
|
+
success: X.SUCCESS,
|
|
249
|
+
error: X.ERROR,
|
|
250
|
+
abort: X.ABORT
|
|
251
|
+
};
|
|
252
|
+
function le(t) {
|
|
253
|
+
return t.map((e, o) => ({
|
|
254
|
+
key: `${o}-${e.title}`,
|
|
255
|
+
title: e.title,
|
|
256
|
+
content: e.content,
|
|
257
|
+
collapsible: !!e.content,
|
|
258
|
+
status: se[e.status],
|
|
259
|
+
blink: e.status === "loading"
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
function re(t) {
|
|
263
|
+
return t.map(
|
|
264
|
+
(e) => e.status === "loading" ? { ...e, status: "abort" } : e
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
function K(t) {
|
|
268
|
+
return String(t).padStart(2, "0");
|
|
269
|
+
}
|
|
270
|
+
function ce(t) {
|
|
271
|
+
const e = t.getFullYear(), o = K(t.getMonth() + 1), c = K(t.getDate()), l = K(t.getHours()), i = K(t.getMinutes()), h = K(t.getSeconds()), p = String(t.getMilliseconds()).padStart(3, "0");
|
|
272
|
+
return `${e}${o}${c}${l}${i}${h}${p}`;
|
|
273
|
+
}
|
|
274
|
+
function ue() {
|
|
275
|
+
const t = new Uint8Array(4);
|
|
276
|
+
return crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
277
|
+
}
|
|
278
|
+
function gt(t = /* @__PURE__ */ new Date()) {
|
|
279
|
+
return `web_${ce(t)}_${ue()}`;
|
|
280
|
+
}
|
|
281
|
+
const de = /^web_\d{17}_[0-9a-f]{8}$/;
|
|
282
|
+
function Co(t) {
|
|
283
|
+
return de.test(t);
|
|
284
|
+
}
|
|
285
|
+
const he = {
|
|
286
|
+
key: 0,
|
|
287
|
+
viewBox: "0 0 16 16",
|
|
288
|
+
fill: "none",
|
|
289
|
+
"aria-hidden": "true"
|
|
290
|
+
}, Ae = {
|
|
291
|
+
key: 1,
|
|
292
|
+
viewBox: "0 0 16 16",
|
|
293
|
+
fill: "none",
|
|
294
|
+
"aria-hidden": "true"
|
|
295
|
+
}, me = /* @__PURE__ */ U({
|
|
296
|
+
__name: "AiChatCopyButton",
|
|
297
|
+
props: {
|
|
298
|
+
content: {}
|
|
299
|
+
},
|
|
300
|
+
setup(t) {
|
|
301
|
+
const e = t, o = C(!1);
|
|
302
|
+
let c = null;
|
|
303
|
+
function l() {
|
|
304
|
+
c && (clearTimeout(c), c = null);
|
|
305
|
+
}
|
|
306
|
+
function i() {
|
|
307
|
+
l(), o.value = !0, c = setTimeout(() => {
|
|
308
|
+
o.value = !1, c = null;
|
|
309
|
+
}, 2e3);
|
|
310
|
+
}
|
|
311
|
+
async function h() {
|
|
312
|
+
try {
|
|
313
|
+
await navigator.clipboard.writeText(e.content), i();
|
|
314
|
+
} catch {
|
|
315
|
+
try {
|
|
316
|
+
const p = document.createElement("textarea");
|
|
317
|
+
p.value = e.content, p.style.position = "fixed", p.style.opacity = "0", document.body.appendChild(p), p.select(), document.execCommand("copy"), document.body.removeChild(p), i();
|
|
318
|
+
} catch {
|
|
319
|
+
l(), o.value = !1;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return wt(() => {
|
|
324
|
+
l();
|
|
325
|
+
}), (p, g) => (v(), k("button", {
|
|
326
|
+
type: "button",
|
|
327
|
+
class: q(["ai-chat-copy-btn", { "ai-chat-copy-btn--success": o.value }]),
|
|
328
|
+
onClick: $(h, ["stop"])
|
|
329
|
+
}, [
|
|
330
|
+
o.value ? (v(), k("svg", he, [...g[0] || (g[0] = [
|
|
331
|
+
a("path", {
|
|
332
|
+
d: "M4 8.5l2.5 2.5L12 5.5",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
"stroke-width": "1.6",
|
|
335
|
+
"stroke-linecap": "round",
|
|
336
|
+
"stroke-linejoin": "round"
|
|
337
|
+
}, null, -1)
|
|
338
|
+
])])) : (v(), k("svg", Ae, [...g[1] || (g[1] = [
|
|
339
|
+
a("rect", {
|
|
340
|
+
x: "5.5",
|
|
341
|
+
y: "5.5",
|
|
342
|
+
width: "8",
|
|
343
|
+
height: "8",
|
|
344
|
+
rx: "1.5",
|
|
345
|
+
stroke: "currentColor",
|
|
346
|
+
"stroke-width": "1.5"
|
|
347
|
+
}, null, -1),
|
|
348
|
+
a("path", {
|
|
349
|
+
d: "M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5",
|
|
350
|
+
stroke: "currentColor",
|
|
351
|
+
"stroke-width": "1.5",
|
|
352
|
+
"stroke-linecap": "round"
|
|
353
|
+
}, null, -1)
|
|
354
|
+
])]))
|
|
355
|
+
], 2));
|
|
356
|
+
}
|
|
357
|
+
}), nt = (t, e) => {
|
|
358
|
+
const o = t.__vccOpts || t;
|
|
359
|
+
for (const [c, l] of e)
|
|
360
|
+
o[c] = l;
|
|
361
|
+
return o;
|
|
362
|
+
}, It = /* @__PURE__ */ nt(me, [["__scopeId", "data-v-4ab8d22c"]]), pe = { class: "ai-chat" }, ye = { class: "ai-chat__content" }, ve = {
|
|
363
|
+
key: 0,
|
|
364
|
+
class: "ai-chat__loading"
|
|
365
|
+
}, fe = {
|
|
366
|
+
key: 1,
|
|
367
|
+
class: "ai-chat__starter"
|
|
368
|
+
}, ge = ["src"], ke = { class: "ai-chat__sender" }, we = /* @__PURE__ */ U({
|
|
369
|
+
__name: "AiChat",
|
|
370
|
+
setup(t, { expose: e }) {
|
|
371
|
+
const o = Tt.List, c = Ct(), l = mt(), i = pt(), h = C([]), p = C(gt()), g = C(""), I = C(!1), M = C(null), y = C(!1), b = C();
|
|
372
|
+
let _ = 1, A = null, x = null;
|
|
373
|
+
const O = S(() => !y.value && h.value.length === 0);
|
|
374
|
+
function P(s, f) {
|
|
375
|
+
return Z(Ot, {
|
|
376
|
+
content: s,
|
|
377
|
+
class: "tax-markdown-light",
|
|
378
|
+
streaming: M.value === f ? { hasNextChunk: !0 } : void 0
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
function T(s) {
|
|
382
|
+
return Z(It, { content: s });
|
|
383
|
+
}
|
|
384
|
+
function at(s, f) {
|
|
385
|
+
const w = `${s}:${JSON.stringify(f)}`, r = Y.get(w);
|
|
386
|
+
if (r)
|
|
387
|
+
return r;
|
|
388
|
+
const n = L(f);
|
|
389
|
+
return Y.set(w, n), n;
|
|
390
|
+
}
|
|
391
|
+
const Y = /* @__PURE__ */ new Map(), it = () => Z("img", {
|
|
392
|
+
src: i.value,
|
|
393
|
+
alt: "",
|
|
394
|
+
style: {
|
|
395
|
+
width: "36px",
|
|
396
|
+
height: "36px",
|
|
397
|
+
borderRadius: "50%"
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
function L(s) {
|
|
401
|
+
if (s != null && s.length)
|
|
402
|
+
return Z(Yt, {
|
|
403
|
+
items: le(s),
|
|
404
|
+
line: !0,
|
|
405
|
+
class: "ai-chat__cot"
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
const Q = S(() => ({
|
|
409
|
+
ai: {
|
|
410
|
+
variant: "borderless",
|
|
411
|
+
shape: "corner",
|
|
412
|
+
typing: !1,
|
|
413
|
+
avatar: it
|
|
414
|
+
},
|
|
415
|
+
user: {
|
|
416
|
+
avatar: "👤",
|
|
417
|
+
placement: "end",
|
|
418
|
+
variant: "filled",
|
|
419
|
+
shape: "corner"
|
|
420
|
+
}
|
|
421
|
+
}));
|
|
422
|
+
function R(s, f) {
|
|
423
|
+
h.value = h.value.map(
|
|
424
|
+
(w) => w.key === s ? { ...w, ...f } : w
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
const J = S(
|
|
428
|
+
() => h.value.map((s) => {
|
|
429
|
+
var f, w;
|
|
430
|
+
if (s.role === "ai") {
|
|
431
|
+
const r = !!((f = s.content) != null && f.trim() && !s.loading && M.value !== s.key);
|
|
432
|
+
return {
|
|
433
|
+
...s,
|
|
434
|
+
footerPlacement: "inner-end",
|
|
435
|
+
contentRender: (u) => P(u, s.key),
|
|
436
|
+
...(w = s.cotSteps) != null && w.length ? { header: at(s.key, s.cotSteps) } : {},
|
|
437
|
+
...r ? { footer: () => T(s.content) } : {}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
return s;
|
|
441
|
+
})
|
|
442
|
+
);
|
|
443
|
+
async function D() {
|
|
444
|
+
var s;
|
|
445
|
+
await G(), (s = b.value) == null || s.scrollTo({ top: "bottom", behavior: "smooth" });
|
|
446
|
+
}
|
|
447
|
+
async function st(s, f) {
|
|
448
|
+
let w = "";
|
|
449
|
+
x = s;
|
|
450
|
+
const r = await ie(
|
|
451
|
+
c,
|
|
452
|
+
{
|
|
453
|
+
conversation_id: p.value,
|
|
454
|
+
query: f
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
onCot: (n, u, d) => {
|
|
458
|
+
R(s, {
|
|
459
|
+
cotSteps: u,
|
|
460
|
+
cotStatus: n,
|
|
461
|
+
messageId: d,
|
|
462
|
+
loading: n === "running" && !w
|
|
463
|
+
}), n === "error" && R(s, { loading: !1 }), D();
|
|
464
|
+
},
|
|
465
|
+
onMsgDelta: (n) => {
|
|
466
|
+
w += n, M.value = s, R(s, { loading: !1, content: w });
|
|
467
|
+
},
|
|
468
|
+
onMsgEnd: (n) => {
|
|
469
|
+
w = n, R(s, { loading: !1, content: n });
|
|
470
|
+
},
|
|
471
|
+
onMsgError: (n, u) => {
|
|
472
|
+
w = n;
|
|
473
|
+
const d = u ? `
|
|
474
|
+
|
|
475
|
+
${l.value.chat.streamErrorPrefix}${u}` : "";
|
|
476
|
+
R(s, {
|
|
477
|
+
loading: !1,
|
|
478
|
+
content: n ? `${n}${d}` : `${l.value.chat.requestFailedPrefix}${u}`
|
|
479
|
+
});
|
|
480
|
+
},
|
|
481
|
+
onError: (n) => {
|
|
482
|
+
R(s, {
|
|
483
|
+
loading: !1,
|
|
484
|
+
content: w || `${l.value.chat.networkErrorPrefix}${n}`
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
A = r.abort;
|
|
490
|
+
try {
|
|
491
|
+
await r.finished;
|
|
492
|
+
} finally {
|
|
493
|
+
A = null, x = null;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async function W(s) {
|
|
497
|
+
const f = s.trim();
|
|
498
|
+
if (!f || I.value)
|
|
499
|
+
return;
|
|
500
|
+
const w = _++, r = _++;
|
|
501
|
+
I.value = !0, g.value = "", h.value = [
|
|
502
|
+
...h.value,
|
|
503
|
+
{ key: w, role: "user", content: f },
|
|
504
|
+
{ key: r, role: "ai", content: "", loading: !0 }
|
|
505
|
+
], await D();
|
|
506
|
+
try {
|
|
507
|
+
await st(r, f);
|
|
508
|
+
} finally {
|
|
509
|
+
M.value = null, I.value = !1, await D();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function lt(s) {
|
|
513
|
+
const { label: f } = s.data;
|
|
514
|
+
typeof f == "string" && f.trim() && W(f);
|
|
515
|
+
}
|
|
516
|
+
function j() {
|
|
517
|
+
if (A == null || A(), x != null) {
|
|
518
|
+
const s = h.value.find((f) => f.key === x);
|
|
519
|
+
s && R(x, {
|
|
520
|
+
loading: !1,
|
|
521
|
+
cotSteps: s.cotSteps ? re(s.cotSteps) : void 0,
|
|
522
|
+
cotStatus: "abort"
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
A = null, x = null, I.value = !1, M.value = null;
|
|
526
|
+
}
|
|
527
|
+
function rt() {
|
|
528
|
+
j(), Y.clear(), p.value = gt(), h.value = [], g.value = "", _ = 1;
|
|
529
|
+
}
|
|
530
|
+
async function B(s) {
|
|
531
|
+
var f, w;
|
|
532
|
+
j(), p.value = s, g.value = "", y.value = !0, h.value = [];
|
|
533
|
+
try {
|
|
534
|
+
const r = await Vt(c, s), n = [];
|
|
535
|
+
let u = 1;
|
|
536
|
+
for (const d of r.messages)
|
|
537
|
+
n.push({ key: u++, role: "user", content: d.query }), n.push({
|
|
538
|
+
key: u++,
|
|
539
|
+
role: "ai",
|
|
540
|
+
content: d.msg,
|
|
541
|
+
messageId: d.id,
|
|
542
|
+
cotSteps: (f = d.cot) != null && f.length ? d.cot : void 0,
|
|
543
|
+
cotStatus: (w = d.cot) != null && w.length ? "success" : void 0
|
|
544
|
+
});
|
|
545
|
+
h.value = n, _ = u, await D();
|
|
546
|
+
} catch (r) {
|
|
547
|
+
h.value = [
|
|
548
|
+
{
|
|
549
|
+
key: 1,
|
|
550
|
+
role: "system",
|
|
551
|
+
content: `${l.value.chat.loadHistoryFailedPrefix}${r instanceof Error ? r.message : l.value.chat.unknownErrorText}`
|
|
552
|
+
}
|
|
553
|
+
], _ = 2;
|
|
554
|
+
} finally {
|
|
555
|
+
y.value = !1;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return Mt(() => {
|
|
559
|
+
A == null || A();
|
|
560
|
+
}), e({
|
|
561
|
+
startNewChat: rt,
|
|
562
|
+
loadConversation: B,
|
|
563
|
+
conversationId: p
|
|
564
|
+
}), (s, f) => (v(), tt(m(Rt), null, {
|
|
565
|
+
default: dt(() => [
|
|
566
|
+
a("div", pe, [
|
|
567
|
+
a("div", ye, [
|
|
568
|
+
y.value ? (v(), k("div", ve, E(m(l).chat.loadingHistoryText), 1)) : O.value ? (v(), k("div", fe, [
|
|
569
|
+
F(m(Bt), {
|
|
570
|
+
variant: "borderless",
|
|
571
|
+
title: m(l).welcome.title,
|
|
572
|
+
description: m(l).welcome.description,
|
|
573
|
+
class: "ai-chat__welcome"
|
|
574
|
+
}, {
|
|
575
|
+
icon: dt(() => [
|
|
576
|
+
a("img", {
|
|
577
|
+
class: "ai-chat__welcome-icon",
|
|
578
|
+
src: m(i),
|
|
579
|
+
alt: "",
|
|
580
|
+
"aria-hidden": "true"
|
|
581
|
+
}, null, 8, ge)
|
|
582
|
+
]),
|
|
583
|
+
_: 1
|
|
584
|
+
}, 8, ["title", "description"]),
|
|
585
|
+
m(l).prompts.items.length ? (v(), tt(m(St), {
|
|
586
|
+
key: 0,
|
|
587
|
+
title: m(l).prompts.title,
|
|
588
|
+
vertical: "",
|
|
589
|
+
items: m(l).prompts.items,
|
|
590
|
+
class: "ai-chat__prompts",
|
|
591
|
+
onItemClick: lt
|
|
592
|
+
}, null, 8, ["title", "items"])) : N("", !0)
|
|
593
|
+
])) : (v(), tt(m(o), {
|
|
594
|
+
key: 2,
|
|
595
|
+
ref_key: "listRef",
|
|
596
|
+
ref: b,
|
|
597
|
+
items: J.value,
|
|
598
|
+
role: Q.value,
|
|
599
|
+
class: "ai-chat__list"
|
|
600
|
+
}, null, 8, ["items", "role"]))
|
|
601
|
+
]),
|
|
602
|
+
a("div", ke, [
|
|
603
|
+
F(m(Pt), {
|
|
604
|
+
value: g.value,
|
|
605
|
+
"onUpdate:value": f[0] || (f[0] = (w) => g.value = w),
|
|
606
|
+
loading: I.value,
|
|
607
|
+
placeholder: m(l).sender.placeholder,
|
|
608
|
+
onSubmit: W,
|
|
609
|
+
onCancel: j
|
|
610
|
+
}, null, 8, ["value", "loading", "placeholder"])
|
|
611
|
+
])
|
|
612
|
+
])
|
|
613
|
+
]),
|
|
614
|
+
_: 1
|
|
615
|
+
}));
|
|
616
|
+
}
|
|
617
|
+
}), Ce = /* @__PURE__ */ nt(we, [["__scopeId", "data-v-66d043b1"]]), be = { class: "ai-chat-history" }, Ie = { class: "ai-chat-history__toolbar" }, Me = ["placeholder"], _e = ["disabled"], xe = ["disabled"], Ee = {
|
|
618
|
+
key: 0,
|
|
619
|
+
class: "ai-chat-history__state"
|
|
620
|
+
}, Te = {
|
|
621
|
+
key: 1,
|
|
622
|
+
class: "ai-chat-history__state ai-chat-history__state--error"
|
|
623
|
+
}, Re = {
|
|
624
|
+
key: 2,
|
|
625
|
+
class: "ai-chat-history__empty"
|
|
626
|
+
}, Be = { class: "ai-chat-history__title" }, Se = { class: "ai-chat-history__desc" }, Pe = ["onClick"], Ye = { class: "ai-chat-history__item-main" }, Oe = ["disabled", "onKeydown"], Le = {
|
|
627
|
+
key: 0,
|
|
628
|
+
class: "ai-chat-history__rename-error"
|
|
629
|
+
}, je = { class: "ai-chat-history__item-title" }, Fe = { class: "ai-chat-history__item-meta" }, De = ["disabled", "onClick"], Ne = ["disabled"], He = ["onClick"], Ue = ["onClick"], Ke = {
|
|
630
|
+
key: 1,
|
|
631
|
+
class: "ai-chat-history__loading-more"
|
|
632
|
+
}, Ge = {
|
|
633
|
+
key: 4,
|
|
634
|
+
class: "ai-chat-history__inline-error"
|
|
635
|
+
}, qe = 20, Qe = /* @__PURE__ */ U({
|
|
636
|
+
__name: "AiChatHistory",
|
|
637
|
+
props: {
|
|
638
|
+
active: { type: Boolean }
|
|
639
|
+
},
|
|
640
|
+
emits: ["select"],
|
|
641
|
+
setup(t, { emit: e }) {
|
|
642
|
+
const o = t, c = e, l = Dt(), i = mt(), h = C(""), p = C(!1), g = C(!1), I = C(""), M = C(""), y = C([]), b = C(null), _ = C(null), A = C(null), x = C(null), O = C(""), P = C(!1);
|
|
643
|
+
let T = null;
|
|
644
|
+
const at = S(() => !p.value && !I.value && y.value.length === 0), Y = S(() => b.value !== null), it = S(() => p.value && y.value.length === 0);
|
|
645
|
+
async function L(r = h.value, n = {}) {
|
|
646
|
+
if (!l) {
|
|
647
|
+
y.value = [], b.value = null;
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
const u = n.append ?? !1;
|
|
651
|
+
if (u) {
|
|
652
|
+
if (g.value || p.value || !b.value)
|
|
653
|
+
return;
|
|
654
|
+
g.value = !0;
|
|
655
|
+
} else
|
|
656
|
+
p.value = !0, b.value = null;
|
|
657
|
+
I.value = "";
|
|
658
|
+
try {
|
|
659
|
+
const d = await zt(l, {
|
|
660
|
+
keyword: r.trim() || void 0,
|
|
661
|
+
limit: qe,
|
|
662
|
+
cursor: u ? b.value ?? void 0 : void 0
|
|
663
|
+
});
|
|
664
|
+
y.value = u ? [...y.value, ...d.items] : d.items, b.value = d.next_cursor;
|
|
665
|
+
} catch (d) {
|
|
666
|
+
u ? I.value = d instanceof Error ? d.message : i.value.history.loadFailedText : (I.value = d instanceof Error ? d.message : i.value.history.loadFailedText, y.value = [], b.value = null);
|
|
667
|
+
} finally {
|
|
668
|
+
p.value = !1, g.value = !1, await G(), R();
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
function Q() {
|
|
672
|
+
L(h.value, { append: !0 });
|
|
673
|
+
}
|
|
674
|
+
function R() {
|
|
675
|
+
T == null || T.disconnect(), T = null, !(!o.active || !Y.value || !_.value || !A.value) && (T = new IntersectionObserver(
|
|
676
|
+
(r) => {
|
|
677
|
+
var n;
|
|
678
|
+
(n = r[0]) != null && n.isIntersecting && Q();
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
root: _.value,
|
|
682
|
+
rootMargin: "48px",
|
|
683
|
+
threshold: 0
|
|
684
|
+
}
|
|
685
|
+
), T.observe(A.value));
|
|
686
|
+
}
|
|
687
|
+
function J() {
|
|
688
|
+
L();
|
|
689
|
+
}
|
|
690
|
+
function D() {
|
|
691
|
+
L();
|
|
692
|
+
}
|
|
693
|
+
function st(r) {
|
|
694
|
+
r.key === "Enter" && J();
|
|
695
|
+
}
|
|
696
|
+
function W(r) {
|
|
697
|
+
const n = new Date(r);
|
|
698
|
+
return Number.isNaN(n.getTime()) ? r : n.toLocaleString("zh-CN", {
|
|
699
|
+
month: "2-digit",
|
|
700
|
+
day: "2-digit",
|
|
701
|
+
hour: "2-digit",
|
|
702
|
+
minute: "2-digit"
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function lt(r) {
|
|
706
|
+
if (x.value) {
|
|
707
|
+
x.value !== r && B();
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
c("select", r);
|
|
711
|
+
}
|
|
712
|
+
function j(r) {
|
|
713
|
+
if (!x.value)
|
|
714
|
+
return;
|
|
715
|
+
const n = document.querySelector(".ai-chat-history__item--editing");
|
|
716
|
+
n && !n.contains(r.target) && B();
|
|
717
|
+
}
|
|
718
|
+
z(x, (r) => {
|
|
719
|
+
r ? document.addEventListener("mousedown", j) : document.removeEventListener("mousedown", j);
|
|
720
|
+
}), wt(() => {
|
|
721
|
+
document.removeEventListener("mousedown", j), T == null || T.disconnect();
|
|
722
|
+
});
|
|
723
|
+
async function rt(r, n) {
|
|
724
|
+
var u, d;
|
|
725
|
+
r.stopPropagation(), M.value = "", x.value = n.conversation_id, O.value = n.title, await G(), (u = document.querySelector(".ai-chat-history__item--editing .ai-chat-history__rename-input")) == null || u.focus(), (d = document.querySelector(".ai-chat-history__item--editing .ai-chat-history__rename-input")) == null || d.select();
|
|
726
|
+
}
|
|
727
|
+
function B() {
|
|
728
|
+
x.value = null, O.value = "", M.value = "";
|
|
729
|
+
}
|
|
730
|
+
async function s(r) {
|
|
731
|
+
if (!l || P.value)
|
|
732
|
+
return;
|
|
733
|
+
const n = O.value.trim();
|
|
734
|
+
if (!n) {
|
|
735
|
+
M.value = i.value.history.renameEmptyError;
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
const u = y.value.find((d) => d.conversation_id === r);
|
|
739
|
+
if (u && u.title === n) {
|
|
740
|
+
B();
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
P.value = !0, M.value = "";
|
|
744
|
+
try {
|
|
745
|
+
const d = await Xt(l, r, n);
|
|
746
|
+
y.value = y.value.map(
|
|
747
|
+
(ct) => ct.conversation_id === r ? {
|
|
748
|
+
...ct,
|
|
749
|
+
title: d.title,
|
|
750
|
+
title_status: d.title_status,
|
|
751
|
+
update_time: d.update_time
|
|
752
|
+
} : ct
|
|
753
|
+
), B();
|
|
754
|
+
} catch (d) {
|
|
755
|
+
M.value = d instanceof Error ? d.message : i.value.history.renameFailedText;
|
|
756
|
+
} finally {
|
|
757
|
+
P.value = !1;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
function f(r, n) {
|
|
761
|
+
r.key === "Enter" ? (r.preventDefault(), r.stopPropagation(), s(n)) : r.key === "Escape" && (r.preventDefault(), r.stopPropagation(), B());
|
|
762
|
+
}
|
|
763
|
+
async function w(r, n) {
|
|
764
|
+
if (r.stopPropagation(), !!l) {
|
|
765
|
+
x.value === n && B();
|
|
766
|
+
try {
|
|
767
|
+
await $t(l, n), y.value = y.value.filter((u) => u.conversation_id !== n);
|
|
768
|
+
} catch (u) {
|
|
769
|
+
I.value = u instanceof Error ? u.message : i.value.history.deleteFailedText;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return z(
|
|
774
|
+
() => o.active,
|
|
775
|
+
(r) => {
|
|
776
|
+
r && L();
|
|
777
|
+
}
|
|
778
|
+
), z(
|
|
779
|
+
() => l,
|
|
780
|
+
() => {
|
|
781
|
+
o.active && L();
|
|
782
|
+
}
|
|
783
|
+
), z(Y, async () => {
|
|
784
|
+
await G(), R();
|
|
785
|
+
}), (r, n) => (v(), k("div", be, [
|
|
786
|
+
a("div", Ie, [
|
|
787
|
+
H(a("input", {
|
|
788
|
+
"onUpdate:modelValue": n[0] || (n[0] = (u) => h.value = u),
|
|
789
|
+
class: "ai-chat-history__search",
|
|
790
|
+
type: "search",
|
|
791
|
+
placeholder: m(i).history.searchPlaceholder,
|
|
792
|
+
onKeydown: st
|
|
793
|
+
}, null, 40, Me), [
|
|
794
|
+
[vt, h.value]
|
|
795
|
+
]),
|
|
796
|
+
a("button", {
|
|
797
|
+
type: "button",
|
|
798
|
+
class: "ai-chat-history__toolbar-btn",
|
|
799
|
+
disabled: p.value,
|
|
800
|
+
onClick: J
|
|
801
|
+
}, [...n[5] || (n[5] = [
|
|
802
|
+
a("svg", {
|
|
803
|
+
viewBox: "0 0 24 24",
|
|
804
|
+
width: "16",
|
|
805
|
+
height: "16",
|
|
806
|
+
"aria-hidden": "true"
|
|
807
|
+
}, [
|
|
808
|
+
a("path", {
|
|
809
|
+
d: "M10.5 18a7.5 7.5 0 110-15 7.5 7.5 0 010 15zM16 16l5 5",
|
|
810
|
+
fill: "none",
|
|
811
|
+
stroke: "currentColor",
|
|
812
|
+
"stroke-width": "1.8",
|
|
813
|
+
"stroke-linecap": "round",
|
|
814
|
+
"stroke-linejoin": "round"
|
|
815
|
+
})
|
|
816
|
+
], -1)
|
|
817
|
+
])], 8, _e),
|
|
818
|
+
a("button", {
|
|
819
|
+
type: "button",
|
|
820
|
+
class: "ai-chat-history__toolbar-btn",
|
|
821
|
+
disabled: p.value,
|
|
822
|
+
onClick: D
|
|
823
|
+
}, [...n[6] || (n[6] = [
|
|
824
|
+
a("svg", {
|
|
825
|
+
viewBox: "0 0 24 24",
|
|
826
|
+
width: "16",
|
|
827
|
+
height: "16",
|
|
828
|
+
"aria-hidden": "true"
|
|
829
|
+
}, [
|
|
830
|
+
a("path", {
|
|
831
|
+
d: "M20 12a8 8 0 10-1.6 4.9M20 12V7m0 5h-5",
|
|
832
|
+
fill: "none",
|
|
833
|
+
stroke: "currentColor",
|
|
834
|
+
"stroke-width": "1.8",
|
|
835
|
+
"stroke-linecap": "round",
|
|
836
|
+
"stroke-linejoin": "round"
|
|
837
|
+
})
|
|
838
|
+
], -1)
|
|
839
|
+
])], 8, xe)
|
|
840
|
+
]),
|
|
841
|
+
it.value ? (v(), k("div", Ee, E(m(i).history.loadingText), 1)) : I.value && y.value.length === 0 ? (v(), k("div", Te, E(I.value), 1)) : at.value ? (v(), k("div", Re, [
|
|
842
|
+
n[7] || (n[7] = a("div", {
|
|
843
|
+
class: "ai-chat-history__icon",
|
|
844
|
+
"aria-hidden": "true"
|
|
845
|
+
}, [
|
|
846
|
+
a("svg", {
|
|
847
|
+
viewBox: "0 0 24 24",
|
|
848
|
+
width: "28",
|
|
849
|
+
height: "28"
|
|
850
|
+
}, [
|
|
851
|
+
a("path", {
|
|
852
|
+
d: "M12 8v4l3 2M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
|
|
853
|
+
fill: "none",
|
|
854
|
+
stroke: "currentColor",
|
|
855
|
+
"stroke-width": "1.6",
|
|
856
|
+
"stroke-linecap": "round",
|
|
857
|
+
"stroke-linejoin": "round"
|
|
858
|
+
})
|
|
859
|
+
])
|
|
860
|
+
], -1)),
|
|
861
|
+
a("p", Be, E(m(i).history.emptyTitle), 1),
|
|
862
|
+
a("p", Se, E(m(i).history.emptyDescription), 1)
|
|
863
|
+
])) : (v(), k("ul", {
|
|
864
|
+
key: 3,
|
|
865
|
+
ref_key: "listRef",
|
|
866
|
+
ref: _,
|
|
867
|
+
class: "ai-chat-history__list"
|
|
868
|
+
}, [
|
|
869
|
+
(v(!0), k(ut, null, _t(y.value, (u) => (v(), k("li", {
|
|
870
|
+
key: u.conversation_id,
|
|
871
|
+
class: q(["ai-chat-history__item", { "ai-chat-history__item--editing": x.value === u.conversation_id }]),
|
|
872
|
+
onClick: (d) => lt(u.conversation_id)
|
|
873
|
+
}, [
|
|
874
|
+
a("div", Ye, [
|
|
875
|
+
x.value === u.conversation_id ? (v(), k(ut, { key: 0 }, [
|
|
876
|
+
H(a("input", {
|
|
877
|
+
"onUpdate:modelValue": n[1] || (n[1] = (d) => O.value = d),
|
|
878
|
+
class: "ai-chat-history__rename-input",
|
|
879
|
+
type: "text",
|
|
880
|
+
disabled: P.value,
|
|
881
|
+
onKeydown: (d) => f(d, u.conversation_id)
|
|
882
|
+
}, null, 40, Oe), [
|
|
883
|
+
[vt, O.value]
|
|
884
|
+
]),
|
|
885
|
+
M.value ? (v(), k("p", Le, E(M.value), 1)) : N("", !0)
|
|
886
|
+
], 64)) : (v(), k(ut, { key: 1 }, [
|
|
887
|
+
a("p", je, E(u.title), 1),
|
|
888
|
+
a("p", Fe, E(W(u.update_time)) + " · " + E(u.message_count) + " " + E(m(i).history.roundUnit), 1)
|
|
889
|
+
], 64))
|
|
890
|
+
]),
|
|
891
|
+
x.value === u.conversation_id ? (v(), k("div", {
|
|
892
|
+
key: 0,
|
|
893
|
+
class: "ai-chat-history__item-actions",
|
|
894
|
+
onClick: n[2] || (n[2] = $(() => {
|
|
895
|
+
}, ["stop"])),
|
|
896
|
+
onMousedown: n[3] || (n[3] = $(() => {
|
|
897
|
+
}, ["stop"]))
|
|
898
|
+
}, [
|
|
899
|
+
a("button", {
|
|
900
|
+
type: "button",
|
|
901
|
+
class: "ai-chat-history__action ai-chat-history__action--confirm",
|
|
902
|
+
disabled: P.value,
|
|
903
|
+
onClick: (d) => s(u.conversation_id)
|
|
904
|
+
}, [...n[8] || (n[8] = [
|
|
905
|
+
a("svg", {
|
|
906
|
+
viewBox: "0 0 24 24",
|
|
907
|
+
width: "16",
|
|
908
|
+
height: "16",
|
|
909
|
+
"aria-hidden": "true"
|
|
910
|
+
}, [
|
|
911
|
+
a("path", {
|
|
912
|
+
d: "M5 12l4 4L19 6",
|
|
913
|
+
fill: "none",
|
|
914
|
+
stroke: "currentColor",
|
|
915
|
+
"stroke-width": "1.8",
|
|
916
|
+
"stroke-linecap": "round",
|
|
917
|
+
"stroke-linejoin": "round"
|
|
918
|
+
})
|
|
919
|
+
], -1)
|
|
920
|
+
])], 8, De),
|
|
921
|
+
a("button", {
|
|
922
|
+
type: "button",
|
|
923
|
+
class: "ai-chat-history__action ai-chat-history__action--cancel",
|
|
924
|
+
disabled: P.value,
|
|
925
|
+
onClick: B
|
|
926
|
+
}, [...n[9] || (n[9] = [
|
|
927
|
+
a("svg", {
|
|
928
|
+
viewBox: "0 0 24 24",
|
|
929
|
+
width: "16",
|
|
930
|
+
height: "16",
|
|
931
|
+
"aria-hidden": "true"
|
|
932
|
+
}, [
|
|
933
|
+
a("path", {
|
|
934
|
+
d: "M6 6l12 12M18 6L6 18",
|
|
935
|
+
fill: "none",
|
|
936
|
+
stroke: "currentColor",
|
|
937
|
+
"stroke-width": "1.8",
|
|
938
|
+
"stroke-linecap": "round",
|
|
939
|
+
"stroke-linejoin": "round"
|
|
940
|
+
})
|
|
941
|
+
], -1)
|
|
942
|
+
])], 8, Ne)
|
|
943
|
+
], 32)) : (v(), k("div", {
|
|
944
|
+
key: 1,
|
|
945
|
+
class: "ai-chat-history__item-actions",
|
|
946
|
+
onClick: n[4] || (n[4] = $(() => {
|
|
947
|
+
}, ["stop"]))
|
|
948
|
+
}, [
|
|
949
|
+
F(It, {
|
|
950
|
+
content: u.conversation_id,
|
|
951
|
+
class: "ai-chat-history__action ai-chat-history__action--copy"
|
|
952
|
+
}, null, 8, ["content"]),
|
|
953
|
+
a("button", {
|
|
954
|
+
type: "button",
|
|
955
|
+
class: "ai-chat-history__action ai-chat-history__action--rename",
|
|
956
|
+
onClick: (d) => rt(d, u)
|
|
957
|
+
}, [...n[10] || (n[10] = [
|
|
958
|
+
a("svg", {
|
|
959
|
+
viewBox: "0 0 24 24",
|
|
960
|
+
width: "16",
|
|
961
|
+
height: "16",
|
|
962
|
+
"aria-hidden": "true"
|
|
963
|
+
}, [
|
|
964
|
+
a("path", {
|
|
965
|
+
d: "M4 20h4l10.5-10.5a2.1 2.1 0 10-3-3L5 17v3zM14 6l3 3",
|
|
966
|
+
fill: "none",
|
|
967
|
+
stroke: "currentColor",
|
|
968
|
+
"stroke-width": "1.6",
|
|
969
|
+
"stroke-linecap": "round",
|
|
970
|
+
"stroke-linejoin": "round"
|
|
971
|
+
})
|
|
972
|
+
], -1)
|
|
973
|
+
])], 8, He),
|
|
974
|
+
a("button", {
|
|
975
|
+
type: "button",
|
|
976
|
+
class: "ai-chat-history__action ai-chat-history__action--delete",
|
|
977
|
+
onClick: (d) => w(d, u.conversation_id)
|
|
978
|
+
}, [...n[11] || (n[11] = [
|
|
979
|
+
a("svg", {
|
|
980
|
+
viewBox: "0 0 24 24",
|
|
981
|
+
width: "16",
|
|
982
|
+
height: "16",
|
|
983
|
+
"aria-hidden": "true"
|
|
984
|
+
}, [
|
|
985
|
+
a("path", {
|
|
986
|
+
d: "M6 7h12M9 7V5h6v2m-7 4v6m4-6v6M8 7l1 12h6l1-12",
|
|
987
|
+
fill: "none",
|
|
988
|
+
stroke: "currentColor",
|
|
989
|
+
"stroke-width": "1.6",
|
|
990
|
+
"stroke-linecap": "round",
|
|
991
|
+
"stroke-linejoin": "round"
|
|
992
|
+
})
|
|
993
|
+
], -1)
|
|
994
|
+
])], 8, Ue)
|
|
995
|
+
]))
|
|
996
|
+
], 10, Pe))), 128)),
|
|
997
|
+
Y.value || g.value ? (v(), k("li", {
|
|
998
|
+
key: 0,
|
|
999
|
+
ref_key: "loadMoreSentinel",
|
|
1000
|
+
ref: A,
|
|
1001
|
+
class: "ai-chat-history__footer"
|
|
1002
|
+
}, [
|
|
1003
|
+
Y.value && !g.value ? (v(), k("button", {
|
|
1004
|
+
key: 0,
|
|
1005
|
+
type: "button",
|
|
1006
|
+
class: "ai-chat-history__load-more",
|
|
1007
|
+
onClick: Q
|
|
1008
|
+
}, E(m(i).history.loadMoreText), 1)) : g.value ? (v(), k("span", Ke, E(m(i).history.loadingMoreText), 1)) : N("", !0)
|
|
1009
|
+
], 512)) : N("", !0)
|
|
1010
|
+
], 512)),
|
|
1011
|
+
I.value && y.value.length > 0 ? (v(), k("div", Ge, E(I.value), 1)) : N("", !0)
|
|
1012
|
+
]));
|
|
1013
|
+
}
|
|
1014
|
+
}), Je = /* @__PURE__ */ nt(Qe, [["__scopeId", "data-v-1f7291f3"]]), We = { class: "ai-assistant__panel" }, Ze = { class: "ai-assistant__header" }, ze = { class: "ai-assistant__header-main" }, Ve = { class: "ai-assistant__brand" }, Xe = { class: "ai-assistant__avatar-wrap" }, $e = ["src"], to = { class: "ai-assistant__meta" }, eo = { class: "ai-assistant__title" }, oo = { class: "ai-assistant__status" }, no = { class: "ai-assistant__status-text" }, ao = { class: "ai-assistant__header-left" }, io = { class: "ai-assistant__title ai-assistant__title--history" }, so = { class: "ai-assistant__header-actions" }, lo = ["tabindex", "aria-hidden"], ro = ["tabindex", "aria-hidden"], co = {
|
|
1015
|
+
key: 0,
|
|
1016
|
+
viewBox: "0 0 24 24",
|
|
1017
|
+
width: "18",
|
|
1018
|
+
height: "18",
|
|
1019
|
+
"aria-hidden": "true"
|
|
1020
|
+
}, uo = {
|
|
1021
|
+
key: 1,
|
|
1022
|
+
viewBox: "0 0 24 24",
|
|
1023
|
+
width: "18",
|
|
1024
|
+
height: "18",
|
|
1025
|
+
"aria-hidden": "true"
|
|
1026
|
+
}, ho = { class: "ai-assistant__body" }, Ao = /* @__PURE__ */ U({
|
|
1027
|
+
__name: "AiAssistantPanel",
|
|
1028
|
+
props: {
|
|
1029
|
+
maximized: { type: Boolean }
|
|
1030
|
+
},
|
|
1031
|
+
emits: ["close", "toggle-maximize"],
|
|
1032
|
+
setup(t, { emit: e }) {
|
|
1033
|
+
const o = e, c = mt(), l = pt(), i = C("chat"), h = C();
|
|
1034
|
+
function p() {
|
|
1035
|
+
i.value = "history";
|
|
1036
|
+
}
|
|
1037
|
+
function g() {
|
|
1038
|
+
i.value = "chat";
|
|
1039
|
+
}
|
|
1040
|
+
function I() {
|
|
1041
|
+
var _;
|
|
1042
|
+
i.value = "chat", (_ = h.value) == null || _.startNewChat();
|
|
1043
|
+
}
|
|
1044
|
+
async function M() {
|
|
1045
|
+
for (let _ = 0; _ < 20; _ += 1)
|
|
1046
|
+
if (await G(), h.value)
|
|
1047
|
+
return h.value;
|
|
1048
|
+
}
|
|
1049
|
+
async function y(_) {
|
|
1050
|
+
i.value = "chat";
|
|
1051
|
+
const A = await M();
|
|
1052
|
+
await (A == null ? void 0 : A.loadConversation(_));
|
|
1053
|
+
}
|
|
1054
|
+
function b() {
|
|
1055
|
+
i.value = "chat", o("close");
|
|
1056
|
+
}
|
|
1057
|
+
return (_, A) => (v(), k("aside", We, [
|
|
1058
|
+
a("header", Ze, [
|
|
1059
|
+
a("div", ze, [
|
|
1060
|
+
H(a("div", Ve, [
|
|
1061
|
+
a("div", Xe, [
|
|
1062
|
+
a("img", {
|
|
1063
|
+
class: "ai-assistant__avatar",
|
|
1064
|
+
src: m(l),
|
|
1065
|
+
alt: "",
|
|
1066
|
+
"aria-hidden": "true"
|
|
1067
|
+
}, null, 8, $e)
|
|
1068
|
+
]),
|
|
1069
|
+
a("div", to, [
|
|
1070
|
+
a("h2", eo, E(m(c).panel.title), 1),
|
|
1071
|
+
a("span", oo, [
|
|
1072
|
+
A[1] || (A[1] = a("span", {
|
|
1073
|
+
class: "ai-assistant__status-dot",
|
|
1074
|
+
"aria-hidden": "true"
|
|
1075
|
+
}, null, -1)),
|
|
1076
|
+
a("span", no, E(m(c).panel.statusText), 1)
|
|
1077
|
+
])
|
|
1078
|
+
])
|
|
1079
|
+
], 512), [
|
|
1080
|
+
[V, i.value === "chat"]
|
|
1081
|
+
]),
|
|
1082
|
+
H(a("div", ao, [
|
|
1083
|
+
a("button", {
|
|
1084
|
+
type: "button",
|
|
1085
|
+
class: "ai-assistant__back",
|
|
1086
|
+
onClick: g
|
|
1087
|
+
}, [
|
|
1088
|
+
A[2] || (A[2] = a("svg", {
|
|
1089
|
+
viewBox: "0 0 24 24",
|
|
1090
|
+
width: "18",
|
|
1091
|
+
height: "18",
|
|
1092
|
+
"aria-hidden": "true"
|
|
1093
|
+
}, [
|
|
1094
|
+
a("path", {
|
|
1095
|
+
d: "M15 6l-6 6 6 6",
|
|
1096
|
+
fill: "none",
|
|
1097
|
+
stroke: "currentColor",
|
|
1098
|
+
"stroke-width": "2",
|
|
1099
|
+
"stroke-linecap": "round",
|
|
1100
|
+
"stroke-linejoin": "round"
|
|
1101
|
+
})
|
|
1102
|
+
], -1)),
|
|
1103
|
+
a("span", null, E(m(c).panel.backLabel), 1)
|
|
1104
|
+
]),
|
|
1105
|
+
a("h2", io, E(m(c).panel.historyTitle), 1)
|
|
1106
|
+
], 512), [
|
|
1107
|
+
[V, i.value === "history"]
|
|
1108
|
+
])
|
|
1109
|
+
]),
|
|
1110
|
+
a("div", so, [
|
|
1111
|
+
a("button", {
|
|
1112
|
+
type: "button",
|
|
1113
|
+
class: q(["ai-assistant__icon-btn", { "ai-assistant__icon-btn--hidden": i.value !== "chat" }]),
|
|
1114
|
+
tabindex: i.value === "chat" ? 0 : -1,
|
|
1115
|
+
"aria-hidden": i.value !== "chat",
|
|
1116
|
+
onClick: I
|
|
1117
|
+
}, [...A[3] || (A[3] = [
|
|
1118
|
+
a("svg", {
|
|
1119
|
+
viewBox: "0 0 24 24",
|
|
1120
|
+
width: "18",
|
|
1121
|
+
height: "18",
|
|
1122
|
+
"aria-hidden": "true"
|
|
1123
|
+
}, [
|
|
1124
|
+
a("path", {
|
|
1125
|
+
d: "M12 5v14M5 12h14",
|
|
1126
|
+
fill: "none",
|
|
1127
|
+
stroke: "currentColor",
|
|
1128
|
+
"stroke-width": "2",
|
|
1129
|
+
"stroke-linecap": "round",
|
|
1130
|
+
"stroke-linejoin": "round"
|
|
1131
|
+
})
|
|
1132
|
+
], -1)
|
|
1133
|
+
])], 10, lo),
|
|
1134
|
+
a("button", {
|
|
1135
|
+
type: "button",
|
|
1136
|
+
class: q(["ai-assistant__icon-btn", { "ai-assistant__icon-btn--hidden": i.value !== "chat" }]),
|
|
1137
|
+
tabindex: i.value === "chat" ? 0 : -1,
|
|
1138
|
+
"aria-hidden": i.value !== "chat",
|
|
1139
|
+
onClick: p
|
|
1140
|
+
}, [...A[4] || (A[4] = [
|
|
1141
|
+
a("svg", {
|
|
1142
|
+
viewBox: "0 0 24 24",
|
|
1143
|
+
width: "18",
|
|
1144
|
+
height: "18",
|
|
1145
|
+
"aria-hidden": "true"
|
|
1146
|
+
}, [
|
|
1147
|
+
a("path", {
|
|
1148
|
+
d: "M12 8v4l3 2M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
|
|
1149
|
+
fill: "none",
|
|
1150
|
+
stroke: "currentColor",
|
|
1151
|
+
"stroke-width": "1.8",
|
|
1152
|
+
"stroke-linecap": "round",
|
|
1153
|
+
"stroke-linejoin": "round"
|
|
1154
|
+
})
|
|
1155
|
+
], -1)
|
|
1156
|
+
])], 10, ro),
|
|
1157
|
+
a("button", {
|
|
1158
|
+
type: "button",
|
|
1159
|
+
class: "ai-assistant__icon-btn",
|
|
1160
|
+
onClick: A[0] || (A[0] = (x) => o("toggle-maximize"))
|
|
1161
|
+
}, [
|
|
1162
|
+
t.maximized ? (v(), k("svg", uo, [...A[6] || (A[6] = [
|
|
1163
|
+
a("path", {
|
|
1164
|
+
d: "M4 14h6v6M20 10h-6V4M14 10l7-7M10 14l-7 7",
|
|
1165
|
+
fill: "none",
|
|
1166
|
+
stroke: "currentColor",
|
|
1167
|
+
"stroke-width": "1.8",
|
|
1168
|
+
"stroke-linecap": "round",
|
|
1169
|
+
"stroke-linejoin": "round"
|
|
1170
|
+
}, null, -1)
|
|
1171
|
+
])])) : (v(), k("svg", co, [...A[5] || (A[5] = [
|
|
1172
|
+
a("path", {
|
|
1173
|
+
d: "M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3",
|
|
1174
|
+
fill: "none",
|
|
1175
|
+
stroke: "currentColor",
|
|
1176
|
+
"stroke-width": "1.8",
|
|
1177
|
+
"stroke-linecap": "round",
|
|
1178
|
+
"stroke-linejoin": "round"
|
|
1179
|
+
}, null, -1)
|
|
1180
|
+
])]))
|
|
1181
|
+
]),
|
|
1182
|
+
a("button", {
|
|
1183
|
+
type: "button",
|
|
1184
|
+
class: "ai-assistant__icon-btn",
|
|
1185
|
+
onClick: b
|
|
1186
|
+
}, [...A[7] || (A[7] = [
|
|
1187
|
+
a("svg", {
|
|
1188
|
+
viewBox: "0 0 24 24",
|
|
1189
|
+
width: "18",
|
|
1190
|
+
height: "18",
|
|
1191
|
+
"aria-hidden": "true"
|
|
1192
|
+
}, [
|
|
1193
|
+
a("path", {
|
|
1194
|
+
d: "M6 6l12 12M18 6L6 18",
|
|
1195
|
+
fill: "none",
|
|
1196
|
+
stroke: "currentColor",
|
|
1197
|
+
"stroke-width": "2",
|
|
1198
|
+
"stroke-linecap": "round",
|
|
1199
|
+
"stroke-linejoin": "round"
|
|
1200
|
+
})
|
|
1201
|
+
], -1)
|
|
1202
|
+
])])
|
|
1203
|
+
])
|
|
1204
|
+
]),
|
|
1205
|
+
a("div", ho, [
|
|
1206
|
+
H(F(Ce, {
|
|
1207
|
+
ref_key: "chatRef",
|
|
1208
|
+
ref: h,
|
|
1209
|
+
class: "ai-assistant__view"
|
|
1210
|
+
}, null, 512), [
|
|
1211
|
+
[V, i.value === "chat"]
|
|
1212
|
+
]),
|
|
1213
|
+
H(F(Je, {
|
|
1214
|
+
active: i.value === "history",
|
|
1215
|
+
class: "ai-assistant__view",
|
|
1216
|
+
onSelect: y
|
|
1217
|
+
}, null, 8, ["active"]), [
|
|
1218
|
+
[V, i.value === "history"]
|
|
1219
|
+
])
|
|
1220
|
+
])
|
|
1221
|
+
]));
|
|
1222
|
+
}
|
|
1223
|
+
}), mo = ["src"], po = /* @__PURE__ */ U({
|
|
1224
|
+
__name: "AiAssistantTrigger",
|
|
1225
|
+
emits: ["open"],
|
|
1226
|
+
setup(t) {
|
|
1227
|
+
const e = pt();
|
|
1228
|
+
return (o, c) => (v(), k("button", {
|
|
1229
|
+
type: "button",
|
|
1230
|
+
class: "ai-assistant__trigger",
|
|
1231
|
+
onClick: c[0] || (c[0] = (l) => o.$emit("open"))
|
|
1232
|
+
}, [
|
|
1233
|
+
a("img", {
|
|
1234
|
+
class: "ai-assistant__trigger-avatar",
|
|
1235
|
+
src: m(e),
|
|
1236
|
+
alt: "",
|
|
1237
|
+
"aria-hidden": "true"
|
|
1238
|
+
}, null, 8, mo)
|
|
1239
|
+
]));
|
|
1240
|
+
}
|
|
1241
|
+
}), yo = /* @__PURE__ */ nt(po, [["__scopeId", "data-v-5097d725"]]), vo = 380;
|
|
1242
|
+
function fo(t = !1) {
|
|
1243
|
+
const e = C(t), o = C(!1);
|
|
1244
|
+
return {
|
|
1245
|
+
open: e,
|
|
1246
|
+
maximized: o,
|
|
1247
|
+
toggle: () => {
|
|
1248
|
+
e.value = !e.value, e.value || (o.value = !1);
|
|
1249
|
+
},
|
|
1250
|
+
toggleMaximize: () => {
|
|
1251
|
+
e.value && (o.value = !o.value);
|
|
1252
|
+
},
|
|
1253
|
+
close: () => {
|
|
1254
|
+
e.value = !1, o.value = !1;
|
|
1255
|
+
},
|
|
1256
|
+
show: () => {
|
|
1257
|
+
e.value = !0;
|
|
1258
|
+
},
|
|
1259
|
+
panelWidth: vo
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
const bo = /* @__PURE__ */ U({
|
|
1263
|
+
__name: "AiAssistant",
|
|
1264
|
+
props: {
|
|
1265
|
+
adapter: {},
|
|
1266
|
+
avatar: {},
|
|
1267
|
+
defaultOpen: { type: Boolean, default: !1 }
|
|
1268
|
+
},
|
|
1269
|
+
setup(t) {
|
|
1270
|
+
const e = t;
|
|
1271
|
+
e.adapter && Ft(e.adapter), Ht(S(() => {
|
|
1272
|
+
var p, g;
|
|
1273
|
+
return e.avatar ?? ((g = (p = e.adapter) == null ? void 0 : p.ui) == null ? void 0 : g.avatarUrl);
|
|
1274
|
+
}));
|
|
1275
|
+
const { open: o, maximized: c, close: l, show: i, toggleMaximize: h } = fo(e.defaultOpen);
|
|
1276
|
+
return (p, g) => (v(), k("div", {
|
|
1277
|
+
class: q(["ai-assistant", {
|
|
1278
|
+
"ai-assistant--open": m(o),
|
|
1279
|
+
"ai-assistant--maximized": m(c)
|
|
1280
|
+
}])
|
|
1281
|
+
}, [
|
|
1282
|
+
F(Ao, {
|
|
1283
|
+
"aria-hidden": !m(o),
|
|
1284
|
+
maximized: m(c),
|
|
1285
|
+
onToggleMaximize: m(h),
|
|
1286
|
+
onClose: m(l)
|
|
1287
|
+
}, null, 8, ["aria-hidden", "maximized", "onToggleMaximize", "onClose"]),
|
|
1288
|
+
F(xt, { name: "ai-trigger" }, {
|
|
1289
|
+
default: dt(() => [
|
|
1290
|
+
m(o) ? N("", !0) : (v(), tt(yo, {
|
|
1291
|
+
key: 0,
|
|
1292
|
+
onOpen: m(i)
|
|
1293
|
+
}, null, 8, ["onOpen"]))
|
|
1294
|
+
]),
|
|
1295
|
+
_: 1
|
|
1296
|
+
})
|
|
1297
|
+
], 2));
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
export {
|
|
1301
|
+
vo as AI_PANEL_WIDTH,
|
|
1302
|
+
bo as AiAssistant,
|
|
1303
|
+
de as CONVERSATION_ID_PATTERN,
|
|
1304
|
+
te as DEFAULT_CHAT_ENDPOINTS,
|
|
1305
|
+
Ut as DEFAULT_CONVERSATION_ENDPOINTS,
|
|
1306
|
+
Kt as DEFAULT_REQUEST_TIMEOUT_MS,
|
|
1307
|
+
Lt as DEFAULT_UI_CONFIG,
|
|
1308
|
+
$t as deleteConversation,
|
|
1309
|
+
gt as generateConversationId,
|
|
1310
|
+
Vt as getConversationMessages,
|
|
1311
|
+
Co as isConversationId,
|
|
1312
|
+
zt as listConversations,
|
|
1313
|
+
jt as mergeAiUiConfig,
|
|
1314
|
+
Ft as provideAiAdapter,
|
|
1315
|
+
Ht as provideAiAvatar,
|
|
1316
|
+
Xt as renameConversation,
|
|
1317
|
+
ie as streamChat,
|
|
1318
|
+
Ct as useAiAdapter,
|
|
1319
|
+
Dt as useAiAdapterOptional,
|
|
1320
|
+
pt as useAiAvatar,
|
|
1321
|
+
mt as useAiUi,
|
|
1322
|
+
fo as usePanel
|
|
1323
|
+
};
|