langgraph-vue3-chatbot 0.1.21 → 0.1.23
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 +106 -5
- package/dist-lib/components/ai-bot/AskAiBot.vue.d.ts +5 -1
- package/dist-lib/components/ai-bot/AskAiBot.vue.d.ts.map +1 -1
- package/dist-lib/components/ai-bot/ChatBot.vue.d.ts +5 -1
- package/dist-lib/components/ai-bot/ChatBot.vue.d.ts.map +1 -1
- package/dist-lib/components/ai-bot/ChatInput.vue.d.ts +6 -2
- package/dist-lib/components/ai-bot/ChatInput.vue.d.ts.map +1 -1
- package/dist-lib/components/ai-bot/chatbot.css +1 -1
- package/dist-lib/components/ai-bot/index.d.ts +2 -2
- package/dist-lib/components/ai-bot/index.d.ts.map +1 -1
- package/dist-lib/components/ai-bot/lib/input-types.d.ts +12 -0
- package/dist-lib/components/ai-bot/lib/input-types.d.ts.map +1 -1
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +1325 -1286
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { Client as
|
|
3
|
-
import { Minimize2Icon as
|
|
4
|
-
import { clsx as
|
|
5
|
-
import { twMerge as
|
|
6
|
-
import { reactiveOmit as
|
|
7
|
-
import { StickToBottom as
|
|
8
|
-
import { cva as
|
|
9
|
-
import { Primitive as
|
|
10
|
-
import
|
|
11
|
-
import { nanoid as
|
|
12
|
-
import { motion as
|
|
13
|
-
import './components/ai-bot/chatbot.css';async function
|
|
1
|
+
import { inject as Oe, computed as B, defineComponent as P, openBlock as r, createElementBlock as h, createElementVNode as b, toDisplayString as Y, createBlock as C, unref as a, createVNode as T, createCommentVNode as G, ref as S, Fragment as de, renderList as ve, withDirectives as Ie, normalizeClass as Z, resolveDynamicComponent as _e, vShow as Pe, mergeProps as ie, withCtx as A, renderSlot as W, createTextVNode as je, provide as Ee, watch as Be, onMounted as at, onBeforeUnmount as nt, Transition as ot, nextTick as rt, isRef as bt, vModelText as xt, normalizeProps as $e, guardReactiveProps as Ce, useModel as kt, mergeModels as Je, createStaticVNode as wt, useSlots as $t, normalizeStyle as it } from "vue";
|
|
2
|
+
import { Client as Ct } from "@langchain/langgraph-sdk";
|
|
3
|
+
import { Minimize2Icon as It, Maximize2Icon as zt, XIcon as lt, ChevronDownIcon as ut, PlayCircle as Xe, XCircle as At, CheckCircle as St, Loader as Mt, BookOpenCheck as Tt, ListTodoIcon as Bt, ZapIcon as Pt, FileSearch as Ot, FolderSearch as jt, SquarePen as Et, FileEditIcon as Rt, EyeIcon as Dt, FolderSearchIcon as Lt, FileTextIcon as ct, GlobeIcon as dt, BrainIcon as Ut, WrenchIcon as Wt, ArrowDownIcon as Ft, PaperclipIcon as pt, Music2Icon as Vt, VideoIcon as Nt, ImageIcon as Kt, Loader2Icon as Ht, CornerDownLeftIcon as Gt, CheckIcon as qt, ArrowUpRight as Jt, ChevronsDown as Xt, ChevronsUp as Yt, Circle as Zt, LoaderCircle as Qt, Ban as es, CircleCheckBig as ts, BotMessageSquare as ss, X as as } from "lucide-vue-next";
|
|
4
|
+
import { clsx as ns } from "clsx";
|
|
5
|
+
import { twMerge as os } from "tailwind-merge";
|
|
6
|
+
import { reactiveOmit as Ue, useVModel as rs } from "@vueuse/core";
|
|
7
|
+
import { StickToBottom as is, useStickToBottomContext as ls } from "vue-stick-to-bottom";
|
|
8
|
+
import { cva as We } from "class-variance-authority";
|
|
9
|
+
import { Primitive as us, useForwardPropsEmits as mt, DropdownMenuRoot as cs, DropdownMenuPortal as ds, DropdownMenuContent as ps, useForwardProps as ft, DropdownMenuItem as ms, DropdownMenuTrigger as fs } from "reka-ui";
|
|
10
|
+
import gs from "markstream-vue";
|
|
11
|
+
import { nanoid as Ye } from "nanoid";
|
|
12
|
+
import { motion as Ze } from "motion-v";
|
|
13
|
+
import './components/ai-bot/chatbot.css';async function vs(t) {
|
|
14
14
|
try {
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
} catch (
|
|
18
|
-
return console.error("Failed to fetch models:",
|
|
15
|
+
const s = await (await fetch(`${t}/webapp/models`)).json();
|
|
16
|
+
return s.success && s.data ? s.data : [];
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return console.error("Failed to fetch models:", e), [];
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function hs(t) {
|
|
22
|
+
return t.find((e) => e.is_default) || t[0];
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return
|
|
24
|
+
function Qe(t) {
|
|
25
|
+
const e = t.toLowerCase();
|
|
26
|
+
return e.startsWith("qwen") || e.includes("阿里") || e.includes("通义") ? "alibaba" : e.startsWith("glm") || e.includes("智谱") || e.includes("zhipuai") ? "zhipuai" : e.startsWith("deepseek") || e.includes("deepseek") ? "deepseek" : e.startsWith("minimax") || e.includes("minimax") ? "minimax" : e.includes("kimi") || e.includes("月之") ? "moonshotai" : e.includes("claude") || e.includes("anthropic") ? "anthropic" : e.includes("gpt") || e.includes("openai") ? "openai" : e.includes("gemini") || e.includes("google") ? "google" : e.includes("mistral") ? "mistral" : e.includes("llama") ? "llama" : "openai";
|
|
27
27
|
}
|
|
28
|
-
async function
|
|
28
|
+
async function ys(t, e, s) {
|
|
29
29
|
try {
|
|
30
|
-
return (await
|
|
31
|
-
...
|
|
30
|
+
return (await t.threads.create({
|
|
31
|
+
...e ? { threadId: e, ifExists: "do_nothing" } : {},
|
|
32
32
|
metadata: {
|
|
33
|
-
user_id:
|
|
33
|
+
user_id: s || "user001"
|
|
34
34
|
}
|
|
35
|
-
})).thread_id ||
|
|
36
|
-
} catch (
|
|
37
|
-
return console.error("Failed to create thread:",
|
|
35
|
+
})).thread_id || e || "";
|
|
36
|
+
} catch (n) {
|
|
37
|
+
return console.error("Failed to create thread:", n), e || "";
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
async function
|
|
41
|
-
var
|
|
42
|
-
if (!
|
|
40
|
+
async function _s(t, e, s, n) {
|
|
41
|
+
var o;
|
|
42
|
+
if (!e) return [];
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
45
|
-
if (!(
|
|
44
|
+
const i = (await t.threads.getState(e)).values;
|
|
45
|
+
if (!(i != null && i.messages) || !Array.isArray(i.messages))
|
|
46
46
|
return [];
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
for (;
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
key:
|
|
47
|
+
const l = [], p = i.messages;
|
|
48
|
+
let $ = 0;
|
|
49
|
+
for (; $ < p.length; ) {
|
|
50
|
+
const E = p[$], k = E.type, q = E.content;
|
|
51
|
+
if (k === "human" || k === "user") {
|
|
52
|
+
const oe = typeof q == "string" ? q : Array.isArray(q) ? q.filter((I) => I.type === "text").map((I) => I.text).join("") : "";
|
|
53
|
+
l.push({
|
|
54
|
+
key: E.id || `human-${Date.now()}-${Math.random()}`,
|
|
55
55
|
type: "human",
|
|
56
|
-
content:
|
|
57
|
-
}),
|
|
56
|
+
content: oe
|
|
57
|
+
}), $++;
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
id:
|
|
63
|
-
name:
|
|
64
|
-
args: JSON.stringify(
|
|
60
|
+
if (k === "ai") {
|
|
61
|
+
const oe = typeof q == "string" ? q : Array.isArray(q) ? q.filter((j) => j.type === "text").map((j) => j.text).join("") : "", I = ((o = E.tool_calls) == null ? void 0 : o.map((j) => ({
|
|
62
|
+
id: j.id,
|
|
63
|
+
name: j.name,
|
|
64
|
+
args: JSON.stringify(j.args, null, 2),
|
|
65
65
|
state: "completed",
|
|
66
66
|
result: ""
|
|
67
67
|
}))) || [];
|
|
68
|
-
if (
|
|
69
|
-
key:
|
|
68
|
+
if (l.push({
|
|
69
|
+
key: E.id || `ai-${Date.now()}-${Math.random()}`,
|
|
70
70
|
type: "ai",
|
|
71
|
-
content:
|
|
72
|
-
toolCalls:
|
|
73
|
-
}),
|
|
74
|
-
let
|
|
75
|
-
for (;
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
switch (
|
|
71
|
+
content: oe,
|
|
72
|
+
toolCalls: I.length > 0 ? I : void 0
|
|
73
|
+
}), I.length > 0) {
|
|
74
|
+
let j = $ + 1;
|
|
75
|
+
for (; j < p.length; ) {
|
|
76
|
+
const L = p[j];
|
|
77
|
+
if (L.type === "tool") {
|
|
78
|
+
const F = typeof L.content == "string" ? L.content : JSON.stringify(L.content), ee = L.tool_call_id, Q = L.status, u = ((v) => {
|
|
79
|
+
switch (v) {
|
|
80
80
|
case "success":
|
|
81
81
|
return "completed";
|
|
82
82
|
case "error":
|
|
@@ -84,66 +84,66 @@ async function fs(s, t, e, o) {
|
|
|
84
84
|
default:
|
|
85
85
|
return "completed";
|
|
86
86
|
}
|
|
87
|
-
})(
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
key:
|
|
87
|
+
})(Q), m = I.find((v) => v.id === ee);
|
|
88
|
+
if (m) {
|
|
89
|
+
m.result = F, m.state = u;
|
|
90
|
+
const v = `tool-${ee}-${Date.now()}`;
|
|
91
|
+
l.push({
|
|
92
|
+
key: v,
|
|
93
93
|
type: "tool",
|
|
94
|
-
content:
|
|
94
|
+
content: F,
|
|
95
95
|
toolCalls: [{
|
|
96
96
|
id: ee,
|
|
97
|
-
name:
|
|
98
|
-
args:
|
|
99
|
-
result:
|
|
100
|
-
state:
|
|
101
|
-
error:
|
|
97
|
+
name: m.name,
|
|
98
|
+
args: m.args,
|
|
99
|
+
result: F,
|
|
100
|
+
state: u,
|
|
101
|
+
error: Q === "error" ? F : void 0
|
|
102
102
|
}]
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
j++;
|
|
106
106
|
} else
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
$++;
|
|
111
111
|
continue;
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
$++;
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
115
|
+
const y = i.generated_files;
|
|
116
|
+
if (y && Array.isArray(y) && y.length > 0) {
|
|
117
|
+
const E = {
|
|
118
118
|
type: "generated_files",
|
|
119
|
-
content:
|
|
119
|
+
content: y
|
|
120
120
|
};
|
|
121
|
-
|
|
121
|
+
l.push({
|
|
122
122
|
key: `custom-generated_files-${Date.now()}-${Math.random()}`,
|
|
123
123
|
type: "custom",
|
|
124
124
|
content: "",
|
|
125
|
-
customContent:
|
|
125
|
+
customContent: E
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
return
|
|
132
|
-
} catch (
|
|
133
|
-
return console.error("Failed to load thread history:",
|
|
128
|
+
const R = i.suggested_questions;
|
|
129
|
+
R && Array.isArray(R) && R.length > 0 && s && s(R);
|
|
130
|
+
const M = i.todos;
|
|
131
|
+
return n && Array.isArray(M) && M.length > 0 && n(M), l;
|
|
132
|
+
} catch (d) {
|
|
133
|
+
return console.error("Failed to load thread history:", d), [];
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
function
|
|
138
|
-
const
|
|
139
|
-
return
|
|
140
|
-
portalHost:
|
|
136
|
+
const gt = Symbol("AiBotPortalHost");
|
|
137
|
+
function bs() {
|
|
138
|
+
const t = Oe(gt);
|
|
139
|
+
return t || {
|
|
140
|
+
portalHost: B(() => null)
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
const
|
|
143
|
+
const xs = { class: "chat-header" }, ks = { class: "chat-title" }, ws = { class: "title-text" }, $s = {
|
|
144
144
|
key: 0,
|
|
145
145
|
class: "header-actions"
|
|
146
|
-
},
|
|
146
|
+
}, Cs = ["title"], Is = /* @__PURE__ */ P({
|
|
147
147
|
__name: "ChatHeader",
|
|
148
148
|
props: {
|
|
149
149
|
title: {},
|
|
@@ -151,67 +151,67 @@ const vs = { class: "chat-header" }, hs = { class: "chat-title" }, ys = { class:
|
|
|
151
151
|
showHeaderActions: { type: Boolean, default: !0 }
|
|
152
152
|
},
|
|
153
153
|
emits: ["close", "toggleMaximize"],
|
|
154
|
-
setup(
|
|
155
|
-
const
|
|
156
|
-
return (
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
setup(t, { emit: e }) {
|
|
155
|
+
const s = t, n = e;
|
|
156
|
+
return (o, d) => (r(), h("div", xs, [
|
|
157
|
+
b("div", ks, [
|
|
158
|
+
b("span", ws, Y(t.title), 1)
|
|
159
159
|
]),
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
s.showHeaderActions ? (r(), h("div", $s, [
|
|
161
|
+
b("button", {
|
|
162
162
|
class: "action-btn",
|
|
163
|
-
onClick:
|
|
163
|
+
onClick: d[0] || (d[0] = (i) => n("toggleMaximize")),
|
|
164
164
|
type: "button",
|
|
165
|
-
title:
|
|
165
|
+
title: t.isMaximized ? "还原" : "最大化"
|
|
166
166
|
}, [
|
|
167
|
-
|
|
167
|
+
t.isMaximized ? (r(), C(a(It), {
|
|
168
168
|
key: 0,
|
|
169
169
|
class: "size-4"
|
|
170
|
-
})) : (
|
|
170
|
+
})) : (r(), C(a(zt), {
|
|
171
171
|
key: 1,
|
|
172
172
|
class: "size-4"
|
|
173
173
|
}))
|
|
174
|
-
], 8,
|
|
175
|
-
|
|
174
|
+
], 8, Cs),
|
|
175
|
+
b("button", {
|
|
176
176
|
class: "action-btn",
|
|
177
|
-
onClick:
|
|
177
|
+
onClick: d[1] || (d[1] = (i) => n("close")),
|
|
178
178
|
type: "button",
|
|
179
179
|
title: "关闭"
|
|
180
180
|
}, [
|
|
181
|
-
|
|
181
|
+
T(a(lt), { class: "size-4" })
|
|
182
182
|
])
|
|
183
|
-
])) :
|
|
183
|
+
])) : G("", !0)
|
|
184
184
|
]));
|
|
185
185
|
}
|
|
186
|
-
}),
|
|
187
|
-
const
|
|
188
|
-
for (const [
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
},
|
|
192
|
-
function
|
|
193
|
-
return
|
|
186
|
+
}), pe = (t, e) => {
|
|
187
|
+
const s = t.__vccOpts || t;
|
|
188
|
+
for (const [n, o] of e)
|
|
189
|
+
s[n] = o;
|
|
190
|
+
return s;
|
|
191
|
+
}, zs = /* @__PURE__ */ pe(Is, [["__scopeId", "data-v-f35439d8"]]);
|
|
192
|
+
function N(...t) {
|
|
193
|
+
return os(ns(t));
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const As = { class: "mb-3 text-xs max-w-full" }, Ss = ["onClick"], Ms = { class: "font-medium" }, Ts = { class: "text-muted-foreground truncate flex-1 min-w-0" }, Bs = { class: "mt-2 ml-6 flex flex-col gap-2" }, Ps = { class: "bg-muted p-2 rounded text-[10px] overflow-x-auto max-w-full" }, Os = { key: 0 }, js = { class: "text-muted-foreground mb-1" }, Es = /* @__PURE__ */ P({
|
|
196
196
|
__name: "ToolCall",
|
|
197
197
|
props: {
|
|
198
198
|
toolCalls: {}
|
|
199
199
|
},
|
|
200
|
-
setup(
|
|
201
|
-
const
|
|
202
|
-
switch (
|
|
200
|
+
setup(t) {
|
|
201
|
+
const e = (y) => {
|
|
202
|
+
switch (y) {
|
|
203
203
|
case "start":
|
|
204
|
-
return { icon:
|
|
204
|
+
return { icon: Xe, color: "text-blue-500" };
|
|
205
205
|
case "running":
|
|
206
|
-
return { icon:
|
|
206
|
+
return { icon: Mt, color: "text-yellow-500 animate-spin" };
|
|
207
207
|
case "completed":
|
|
208
|
-
return { icon:
|
|
208
|
+
return { icon: St, color: "text-green-500" };
|
|
209
209
|
case "error":
|
|
210
|
-
return { icon:
|
|
210
|
+
return { icon: At, color: "text-red-500" };
|
|
211
211
|
default:
|
|
212
|
-
return { icon:
|
|
212
|
+
return { icon: Xe, color: "text-muted-foreground" };
|
|
213
213
|
}
|
|
214
|
-
},
|
|
214
|
+
}, s = {
|
|
215
215
|
think_tool: "战略反思",
|
|
216
216
|
fetch_markdown: "获取网页",
|
|
217
217
|
convert_to_markdown: "文件转换",
|
|
@@ -224,66 +224,66 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
224
224
|
execute: "执行命令",
|
|
225
225
|
write_todos: "待办事项",
|
|
226
226
|
task: "子任务"
|
|
227
|
-
},
|
|
228
|
-
think_tool:
|
|
229
|
-
fetch_markdown:
|
|
230
|
-
convert_to_markdown:
|
|
231
|
-
ls:
|
|
232
|
-
read_file:
|
|
233
|
-
write_file:
|
|
234
|
-
edit_file:
|
|
235
|
-
glob:
|
|
236
|
-
grep:
|
|
237
|
-
execute:
|
|
238
|
-
write_todos:
|
|
239
|
-
task:
|
|
240
|
-
},
|
|
241
|
-
|
|
227
|
+
}, n = {
|
|
228
|
+
think_tool: Ut,
|
|
229
|
+
fetch_markdown: dt,
|
|
230
|
+
convert_to_markdown: ct,
|
|
231
|
+
ls: Lt,
|
|
232
|
+
read_file: Dt,
|
|
233
|
+
write_file: Rt,
|
|
234
|
+
edit_file: Et,
|
|
235
|
+
glob: jt,
|
|
236
|
+
grep: Ot,
|
|
237
|
+
execute: Pt,
|
|
238
|
+
write_todos: Bt,
|
|
239
|
+
task: Tt
|
|
240
|
+
}, o = (y) => s[y] || y, d = (y) => n[y] || Wt, i = (y) => y === "write_todos" || y.includes("todo"), l = (y) => y ? y.length > 50 ? y.slice(0, 100) + "..." : y : "", p = S({}), $ = (y) => {
|
|
241
|
+
p.value[y] = !p.value[y];
|
|
242
242
|
};
|
|
243
|
-
return (
|
|
244
|
-
(
|
|
245
|
-
key:
|
|
243
|
+
return (y, R) => (r(), h("div", As, [
|
|
244
|
+
(r(!0), h(de, null, ve(t.toolCalls, (M) => Ie((r(), h("div", {
|
|
245
|
+
key: M.id,
|
|
246
246
|
class: "overflow-hidden"
|
|
247
247
|
}, [
|
|
248
|
-
|
|
248
|
+
b("div", {
|
|
249
249
|
class: "flex items-center gap-2 w-full text-left hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer",
|
|
250
|
-
onClick: (
|
|
250
|
+
onClick: (E) => $(M.id)
|
|
251
251
|
}, [
|
|
252
|
-
|
|
253
|
-
class:
|
|
252
|
+
T(a(ut), {
|
|
253
|
+
class: Z(["h-4 w-4 shrink-0", p.value[M.id] ? "" : "-rotate-90"])
|
|
254
254
|
}, null, 8, ["class"]),
|
|
255
|
-
(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
(
|
|
259
|
-
class:
|
|
255
|
+
(r(), C(_e(d(M.name)), { class: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })),
|
|
256
|
+
b("span", Ms, Y(o(M.name)), 1),
|
|
257
|
+
b("span", Ts, Y(l(M.args)), 1),
|
|
258
|
+
(r(), C(_e(e(M.state).icon), {
|
|
259
|
+
class: Z(a(N)("h-3 w-3 shrink-0 ml-auto", e(M.state).color))
|
|
260
260
|
}, null, 8, ["class"]))
|
|
261
|
-
], 8,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
], 8, Ss),
|
|
262
|
+
Ie(b("div", Bs, [
|
|
263
|
+
b("div", null, [
|
|
264
|
+
R[0] || (R[0] = b("p", { class: "text-muted-foreground mb-1" }, "请求:", -1)),
|
|
265
|
+
b("pre", Ps, Y(M.args), 1)
|
|
266
266
|
]),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
class:
|
|
271
|
-
a(
|
|
267
|
+
M.result || M.error ? (r(), h("div", Os, [
|
|
268
|
+
b("p", js, Y(M.state === "error" ? "Error:" : "结果:"), 1),
|
|
269
|
+
b("pre", {
|
|
270
|
+
class: Z(
|
|
271
|
+
a(N)(
|
|
272
272
|
"bg-muted p-2 rounded text-[10px] overflow-x-auto max-w-full",
|
|
273
|
-
|
|
273
|
+
M.state === "error" && "text-red-500"
|
|
274
274
|
)
|
|
275
275
|
)
|
|
276
|
-
},
|
|
277
|
-
])) :
|
|
276
|
+
}, Y(M.error || M.result), 3)
|
|
277
|
+
])) : G("", !0)
|
|
278
278
|
], 512), [
|
|
279
|
-
[
|
|
279
|
+
[Pe, p.value[M.id]]
|
|
280
280
|
])
|
|
281
281
|
])), [
|
|
282
|
-
[
|
|
282
|
+
[Pe, !i(M.name)]
|
|
283
283
|
])), 128))
|
|
284
284
|
]));
|
|
285
285
|
}
|
|
286
|
-
}),
|
|
286
|
+
}), Rs = /* @__PURE__ */ P({
|
|
287
287
|
__name: "Conversation",
|
|
288
288
|
props: {
|
|
289
289
|
ariaLabel: { default: "Conversation" },
|
|
@@ -295,37 +295,37 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
295
295
|
mass: { default: 1.25 },
|
|
296
296
|
anchor: { default: "none" }
|
|
297
297
|
},
|
|
298
|
-
setup(
|
|
299
|
-
const
|
|
300
|
-
return (
|
|
301
|
-
class: a(
|
|
298
|
+
setup(t) {
|
|
299
|
+
const e = t, s = Ue(e, "class");
|
|
300
|
+
return (n, o) => (r(), C(a(is), ie(a(s), {
|
|
301
|
+
class: a(N)("relative flex-1 overflow-y-hidden", e.class),
|
|
302
302
|
role: "log"
|
|
303
303
|
}), {
|
|
304
|
-
default:
|
|
305
|
-
|
|
304
|
+
default: A(() => [
|
|
305
|
+
W(n.$slots, "default", {}, void 0, !0)
|
|
306
306
|
]),
|
|
307
307
|
_: 3
|
|
308
308
|
}, 16, ["class"]));
|
|
309
309
|
}
|
|
310
|
-
}),
|
|
310
|
+
}), Ds = /* @__PURE__ */ pe(Rs, [["__scopeId", "data-v-3b638d4b"]]), Ls = /* @__PURE__ */ P({
|
|
311
311
|
__name: "ConversationContent",
|
|
312
312
|
props: {
|
|
313
313
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
314
314
|
},
|
|
315
|
-
setup(
|
|
316
|
-
const
|
|
315
|
+
setup(t) {
|
|
316
|
+
const e = t, s = B(() => N(
|
|
317
317
|
// 'flex flex-col p-4 border border-border rounded-lg', //这里就是对话整个矩形区域增加边框
|
|
318
318
|
"flex flex-col p-4",
|
|
319
319
|
// 无边框
|
|
320
|
-
|
|
320
|
+
e.class
|
|
321
321
|
));
|
|
322
|
-
return (
|
|
323
|
-
class:
|
|
322
|
+
return (n, o) => (r(), h("div", {
|
|
323
|
+
class: Z(s.value)
|
|
324
324
|
}, [
|
|
325
|
-
|
|
325
|
+
W(n.$slots, "default")
|
|
326
326
|
], 2));
|
|
327
327
|
}
|
|
328
|
-
}),
|
|
328
|
+
}), Re = /* @__PURE__ */ P({
|
|
329
329
|
__name: "Button",
|
|
330
330
|
props: {
|
|
331
331
|
variant: {},
|
|
@@ -334,23 +334,23 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
334
334
|
asChild: { type: Boolean },
|
|
335
335
|
as: { default: "button" }
|
|
336
336
|
},
|
|
337
|
-
setup(
|
|
338
|
-
const
|
|
339
|
-
return (
|
|
337
|
+
setup(t) {
|
|
338
|
+
const e = t;
|
|
339
|
+
return (s, n) => (r(), C(a(us), {
|
|
340
340
|
"data-slot": "button",
|
|
341
|
-
"data-variant":
|
|
342
|
-
"data-size":
|
|
343
|
-
as:
|
|
344
|
-
"as-child":
|
|
345
|
-
class:
|
|
341
|
+
"data-variant": t.variant,
|
|
342
|
+
"data-size": t.size,
|
|
343
|
+
as: t.as,
|
|
344
|
+
"as-child": t.asChild,
|
|
345
|
+
class: Z(a(N)(a(Us)({ variant: t.variant, size: t.size }), e.class))
|
|
346
346
|
}, {
|
|
347
|
-
default:
|
|
348
|
-
|
|
347
|
+
default: A(() => [
|
|
348
|
+
W(s.$slots, "default")
|
|
349
349
|
]),
|
|
350
350
|
_: 3
|
|
351
351
|
}, 8, ["data-variant", "data-size", "as", "as-child", "class"]));
|
|
352
352
|
}
|
|
353
|
-
}),
|
|
353
|
+
}), Us = We(
|
|
354
354
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
355
355
|
{
|
|
356
356
|
variants: {
|
|
@@ -378,111 +378,111 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
378
378
|
size: "default"
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
),
|
|
381
|
+
), Ws = /* @__PURE__ */ P({
|
|
382
382
|
__name: "ConversationScrollButton",
|
|
383
383
|
props: {
|
|
384
384
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
385
385
|
},
|
|
386
|
-
setup(
|
|
387
|
-
const
|
|
388
|
-
function
|
|
389
|
-
|
|
386
|
+
setup(t) {
|
|
387
|
+
const e = t, { isAtBottom: s, scrollToBottom: n } = ls(), o = B(() => !s.value);
|
|
388
|
+
function d() {
|
|
389
|
+
n();
|
|
390
390
|
}
|
|
391
|
-
return (
|
|
391
|
+
return (i, l) => o.value ? (r(), C(a(Re), ie({
|
|
392
392
|
key: 0,
|
|
393
|
-
class: a(
|
|
393
|
+
class: a(N)(
|
|
394
394
|
"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full cursor-pointer dark:bg-background dark:hover:bg-muted",
|
|
395
|
-
|
|
395
|
+
e.class
|
|
396
396
|
),
|
|
397
397
|
"aria-label": "Scroll to bottom",
|
|
398
398
|
size: "icon",
|
|
399
399
|
type: "button",
|
|
400
400
|
variant: "outline"
|
|
401
|
-
},
|
|
402
|
-
default:
|
|
403
|
-
|
|
401
|
+
}, i.$attrs, { onClick: d }), {
|
|
402
|
+
default: A(() => [
|
|
403
|
+
T(a(Ft), { class: "size-4" })
|
|
404
404
|
]),
|
|
405
405
|
_: 1
|
|
406
|
-
}, 16, ["class"])) :
|
|
406
|
+
}, 16, ["class"])) : G("", !0);
|
|
407
407
|
}
|
|
408
|
-
}),
|
|
408
|
+
}), et = /* @__PURE__ */ P({
|
|
409
409
|
__name: "Message",
|
|
410
410
|
props: {
|
|
411
411
|
from: {},
|
|
412
412
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
413
413
|
},
|
|
414
|
-
setup(
|
|
415
|
-
const
|
|
416
|
-
return (
|
|
417
|
-
class: a(
|
|
414
|
+
setup(t) {
|
|
415
|
+
const e = t;
|
|
416
|
+
return (s, n) => (r(), h("div", ie({
|
|
417
|
+
class: a(N)(
|
|
418
418
|
"group flex w-full max-w-[80%]",
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
e.from === "user" ? "is-user ml-auto" : "is-assistant mr-auto",
|
|
420
|
+
e.class
|
|
421
421
|
)
|
|
422
|
-
},
|
|
423
|
-
|
|
422
|
+
}, s.$attrs), [
|
|
423
|
+
W(s.$slots, "default")
|
|
424
424
|
], 16));
|
|
425
425
|
}
|
|
426
|
-
}),
|
|
426
|
+
}), tt = /* @__PURE__ */ P({
|
|
427
427
|
__name: "MessageContent",
|
|
428
428
|
props: {
|
|
429
429
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
430
430
|
},
|
|
431
|
-
setup(
|
|
432
|
-
const
|
|
433
|
-
return (
|
|
434
|
-
class: a(
|
|
431
|
+
setup(t) {
|
|
432
|
+
const e = t;
|
|
433
|
+
return (s, n) => (r(), h("div", ie({
|
|
434
|
+
class: a(N)(
|
|
435
435
|
"is-user:dark flex w-fit flex-col overflow-hidden text-sm",
|
|
436
436
|
"group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-[var(--ai-user-bubble-bg)] group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-[var(--ai-user-bubble-text)]",
|
|
437
437
|
"group-[.is-assistant]:bg-transparent group-[.is-assistant]:p-0 group-[.is-assistant]:text-foreground",
|
|
438
|
-
|
|
438
|
+
e.class
|
|
439
439
|
)
|
|
440
|
-
},
|
|
441
|
-
|
|
440
|
+
}, s.$attrs), [
|
|
441
|
+
W(s.$slots, "default")
|
|
442
442
|
], 16));
|
|
443
443
|
}
|
|
444
|
-
}),
|
|
444
|
+
}), Fs = /* @__PURE__ */ P({
|
|
445
445
|
__name: "ChatMessages",
|
|
446
446
|
props: {
|
|
447
447
|
messages: {},
|
|
448
448
|
isStreaming: { type: Boolean, default: !1 },
|
|
449
449
|
theme: { default: "light" }
|
|
450
450
|
},
|
|
451
|
-
setup(
|
|
452
|
-
const
|
|
453
|
-
function o
|
|
454
|
-
return
|
|
451
|
+
setup(t) {
|
|
452
|
+
const e = t, s = ["vitesse-dark", "vitesse-light"];
|
|
453
|
+
function n(o) {
|
|
454
|
+
return o === 0 ? "" : e.messages[o].type === "human" ? "my-4" : "";
|
|
455
455
|
}
|
|
456
|
-
return (
|
|
457
|
-
default:
|
|
458
|
-
|
|
459
|
-
default:
|
|
460
|
-
(
|
|
461
|
-
key:
|
|
462
|
-
from:
|
|
463
|
-
class:
|
|
456
|
+
return (o, d) => (r(), C(a(Ds), null, {
|
|
457
|
+
default: A(() => [
|
|
458
|
+
T(a(Ls), null, {
|
|
459
|
+
default: A(() => [
|
|
460
|
+
(r(!0), h(de, null, ve(t.messages, (i, l) => (r(), C(a(et), {
|
|
461
|
+
key: i.key,
|
|
462
|
+
from: i.type === "tool" || i.type === "system" || i.type === "custom" ? "assistant" : i.type === "human" ? "user" : "assistant",
|
|
463
|
+
class: Z(n(l))
|
|
464
464
|
}, {
|
|
465
|
-
default:
|
|
466
|
-
|
|
465
|
+
default: A(() => [
|
|
466
|
+
i.type === "tool" ? (r(), C(Es, {
|
|
467
467
|
key: 0,
|
|
468
|
-
"tool-calls":
|
|
469
|
-
}, null, 8, ["tool-calls"])) :
|
|
470
|
-
default:
|
|
471
|
-
|
|
472
|
-
customContent:
|
|
468
|
+
"tool-calls": i.toolCalls
|
|
469
|
+
}, null, 8, ["tool-calls"])) : i.type === "custom" ? (r(), C(a(tt), { key: 1 }, {
|
|
470
|
+
default: A(() => [
|
|
471
|
+
W(o.$slots, "custom", {
|
|
472
|
+
customContent: i.customContent
|
|
473
473
|
}, void 0, !0)
|
|
474
474
|
]),
|
|
475
475
|
_: 2
|
|
476
|
-
}, 1024)) : (
|
|
477
|
-
default:
|
|
478
|
-
|
|
476
|
+
}, 1024)) : (r(), C(a(tt), { key: 2 }, {
|
|
477
|
+
default: A(() => [
|
|
478
|
+
i.type === "ai" || i.type === "system" ? (r(), C(a(gs), {
|
|
479
479
|
key: 0,
|
|
480
480
|
class: "markdown-body",
|
|
481
|
-
content:
|
|
482
|
-
"is-dark":
|
|
481
|
+
content: i.content || "",
|
|
482
|
+
"is-dark": e.theme === "dark",
|
|
483
483
|
"code-block-dark-theme": "vitesse-dark",
|
|
484
484
|
"code-block-light-theme": "vitesse-light",
|
|
485
|
-
themes:
|
|
485
|
+
themes: s,
|
|
486
486
|
typewriter: !0,
|
|
487
487
|
"initial-render-batch-size": 12,
|
|
488
488
|
"render-batch-size": 24,
|
|
@@ -490,8 +490,8 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
490
490
|
"max-live-nodes": 0,
|
|
491
491
|
"defer-nodes-until-visible": !0,
|
|
492
492
|
"viewport-priority": !0
|
|
493
|
-
}, null, 8, ["content", "is-dark"])) : (
|
|
494
|
-
|
|
493
|
+
}, null, 8, ["content", "is-dark"])) : (r(), h(de, { key: 1 }, [
|
|
494
|
+
je(Y(i.content), 1)
|
|
495
495
|
], 64))
|
|
496
496
|
]),
|
|
497
497
|
_: 2
|
|
@@ -499,259 +499,259 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
|
|
|
499
499
|
]),
|
|
500
500
|
_: 2
|
|
501
501
|
}, 1032, ["from", "class"]))), 128)),
|
|
502
|
-
|
|
502
|
+
t.isStreaming ? (r(), C(a(et), {
|
|
503
503
|
key: 0,
|
|
504
504
|
from: "assistant"
|
|
505
505
|
}, {
|
|
506
|
-
default:
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
default: A(() => [...d[0] || (d[0] = [
|
|
507
|
+
b("div", { class: "loading-indicator" }, [
|
|
508
|
+
b("span", { class: "dot" }),
|
|
509
|
+
b("span", { class: "dot" }),
|
|
510
|
+
b("span", { class: "dot" })
|
|
511
511
|
], -1)
|
|
512
512
|
])]),
|
|
513
513
|
_: 1
|
|
514
|
-
})) :
|
|
514
|
+
})) : G("", !0)
|
|
515
515
|
]),
|
|
516
516
|
_: 3
|
|
517
517
|
}),
|
|
518
|
-
|
|
518
|
+
T(a(Ws))
|
|
519
519
|
]),
|
|
520
520
|
_: 3
|
|
521
521
|
}));
|
|
522
522
|
}
|
|
523
|
-
}),
|
|
524
|
-
function
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
523
|
+
}), Vs = /* @__PURE__ */ pe(Fs, [["__scopeId", "data-v-5b2cc192"]]), vt = Symbol("PromptInputContext");
|
|
524
|
+
function Ns() {
|
|
525
|
+
const t = Oe(vt);
|
|
526
|
+
if (!t)
|
|
527
527
|
throw new Error("usePromptInput must be used within a PromptInput component");
|
|
528
|
-
return
|
|
528
|
+
return t;
|
|
529
529
|
}
|
|
530
|
-
const
|
|
531
|
-
function
|
|
532
|
-
const
|
|
533
|
-
return
|
|
534
|
-
variant:
|
|
530
|
+
const ht = Symbol("Attachments");
|
|
531
|
+
function Ks() {
|
|
532
|
+
const t = Oe(ht);
|
|
533
|
+
return t || {
|
|
534
|
+
variant: B(() => "grid")
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
|
-
const
|
|
538
|
-
function
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
537
|
+
const yt = Symbol("Attachment");
|
|
538
|
+
function Fe() {
|
|
539
|
+
const t = Oe(yt);
|
|
540
|
+
if (!t)
|
|
541
541
|
throw new Error("Attachment components must be used within <Attachment>");
|
|
542
|
-
return
|
|
542
|
+
return t;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
if (
|
|
544
|
+
function _t(t) {
|
|
545
|
+
if (t.type === "source-document")
|
|
546
546
|
return "source";
|
|
547
|
-
const
|
|
548
|
-
return
|
|
547
|
+
const e = t.mediaType ?? "";
|
|
548
|
+
return e.startsWith("image/") ? "image" : e.startsWith("video/") ? "video" : e.startsWith("audio/") ? "audio" : e.startsWith("application/") || e.startsWith("text/") ? "document" : "unknown";
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
if (
|
|
552
|
-
return
|
|
553
|
-
const
|
|
554
|
-
return
|
|
550
|
+
function Hs(t) {
|
|
551
|
+
if (t.type === "source-document")
|
|
552
|
+
return t.title || t.filename || "Source";
|
|
553
|
+
const e = _t(t);
|
|
554
|
+
return t.filename || (e === "image" ? "Image" : "Attachment");
|
|
555
555
|
}
|
|
556
|
-
const
|
|
556
|
+
const Gs = /* @__PURE__ */ P({
|
|
557
557
|
__name: "Attachment",
|
|
558
558
|
props: {
|
|
559
559
|
data: {},
|
|
560
560
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
561
561
|
},
|
|
562
562
|
emits: ["remove"],
|
|
563
|
-
setup(
|
|
564
|
-
const
|
|
565
|
-
function
|
|
566
|
-
|
|
563
|
+
setup(t, { emit: e }) {
|
|
564
|
+
const s = t, n = e, { variant: o } = Ks(), d = B(() => s.data), i = B(() => _t(s.data));
|
|
565
|
+
function l() {
|
|
566
|
+
n("remove");
|
|
567
567
|
}
|
|
568
|
-
return
|
|
569
|
-
data:
|
|
570
|
-
mediaCategory:
|
|
571
|
-
remove:
|
|
572
|
-
variant:
|
|
573
|
-
}), (
|
|
574
|
-
class: a(
|
|
568
|
+
return Ee(yt, {
|
|
569
|
+
data: d,
|
|
570
|
+
mediaCategory: i,
|
|
571
|
+
remove: l,
|
|
572
|
+
variant: o
|
|
573
|
+
}), (p, $) => (r(), h("div", ie({
|
|
574
|
+
class: a(N)(
|
|
575
575
|
"group relative",
|
|
576
|
-
a(
|
|
577
|
-
a(
|
|
576
|
+
a(o) === "grid" && "size-24 overflow-hidden rounded-lg",
|
|
577
|
+
a(o) === "inline" && [
|
|
578
578
|
"flex h-8 cursor-pointer select-none items-center gap-1",
|
|
579
579
|
"rounded-md border border-border px-1",
|
|
580
580
|
"font-medium text-sm transition-all",
|
|
581
581
|
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
582
582
|
],
|
|
583
|
-
a(
|
|
583
|
+
a(o) === "list" && [
|
|
584
584
|
"flex w-full items-center gap-3 rounded-lg border p-3",
|
|
585
585
|
"hover:bg-accent/50"
|
|
586
586
|
],
|
|
587
|
-
|
|
587
|
+
s.class
|
|
588
588
|
)
|
|
589
|
-
},
|
|
590
|
-
|
|
589
|
+
}, p.$attrs), [
|
|
590
|
+
W(p.$slots, "default")
|
|
591
591
|
], 16));
|
|
592
592
|
}
|
|
593
|
-
}),
|
|
593
|
+
}), qs = { class: "block truncate" }, Js = {
|
|
594
594
|
key: 0,
|
|
595
595
|
class: "block truncate text-muted-foreground text-xs"
|
|
596
|
-
},
|
|
596
|
+
}, Xs = /* @__PURE__ */ P({
|
|
597
597
|
__name: "AttachmentInfo",
|
|
598
598
|
props: {
|
|
599
599
|
showMediaType: { type: Boolean, default: !1 },
|
|
600
600
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
601
601
|
},
|
|
602
|
-
setup(
|
|
603
|
-
const
|
|
604
|
-
return (
|
|
602
|
+
setup(t) {
|
|
603
|
+
const e = t, { data: s, variant: n } = Fe(), o = B(() => Hs(s.value));
|
|
604
|
+
return (d, i) => a(n) !== "grid" ? (r(), h("div", ie({
|
|
605
605
|
key: 0,
|
|
606
|
-
class: a(
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
], 16)) :
|
|
606
|
+
class: a(N)("min-w-0 flex-1", e.class)
|
|
607
|
+
}, d.$attrs), [
|
|
608
|
+
b("span", qs, Y(o.value), 1),
|
|
609
|
+
e.showMediaType && a(s).mediaType ? (r(), h("span", Js, Y(a(s).mediaType), 1)) : G("", !0)
|
|
610
|
+
], 16)) : G("", !0);
|
|
611
611
|
}
|
|
612
|
-
}),
|
|
612
|
+
}), Ys = ["alt", "height", "src", "width"], Zs = ["src"], Qs = /* @__PURE__ */ P({
|
|
613
613
|
__name: "AttachmentPreview",
|
|
614
614
|
props: {
|
|
615
615
|
fallbackIcon: {},
|
|
616
616
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
617
617
|
},
|
|
618
|
-
setup(
|
|
619
|
-
const
|
|
620
|
-
() =>
|
|
621
|
-
),
|
|
622
|
-
() =>
|
|
623
|
-
),
|
|
624
|
-
image:
|
|
625
|
-
video:
|
|
626
|
-
audio:
|
|
627
|
-
source:
|
|
628
|
-
document:
|
|
629
|
-
unknown:
|
|
630
|
-
},
|
|
631
|
-
() => (
|
|
618
|
+
setup(t) {
|
|
619
|
+
const e = t, { data: s, mediaCategory: n, variant: o } = Fe(), d = B(() => o.value === "grid"), i = B(() => o.value === "inline" ? "size-3" : "size-4"), l = B(() => s.value.type === "file" ? s.value.url : void 0), p = B(
|
|
620
|
+
() => n.value === "image" && s.value.type === "file" && !!l.value
|
|
621
|
+
), $ = B(
|
|
622
|
+
() => n.value === "video" && s.value.type === "file" && !!l.value
|
|
623
|
+
), y = {
|
|
624
|
+
image: Kt,
|
|
625
|
+
video: Nt,
|
|
626
|
+
audio: Vt,
|
|
627
|
+
source: dt,
|
|
628
|
+
document: ct,
|
|
629
|
+
unknown: pt
|
|
630
|
+
}, R = B(() => y[n.value]), M = B(
|
|
631
|
+
() => (s.value.type === "file" ? s.value.filename : void 0) || "Image"
|
|
632
632
|
);
|
|
633
|
-
return (
|
|
634
|
-
class: a(
|
|
633
|
+
return (E, k) => (r(), h("div", ie({
|
|
634
|
+
class: a(N)(
|
|
635
635
|
"flex shrink-0 items-center justify-center overflow-hidden",
|
|
636
|
-
a(
|
|
637
|
-
a(
|
|
638
|
-
a(
|
|
639
|
-
|
|
636
|
+
a(o) === "grid" && "size-full bg-muted",
|
|
637
|
+
a(o) === "inline" && "size-5 rounded bg-background",
|
|
638
|
+
a(o) === "list" && "size-12 rounded bg-muted",
|
|
639
|
+
e.class
|
|
640
640
|
)
|
|
641
|
-
},
|
|
642
|
-
|
|
641
|
+
}, E.$attrs), [
|
|
642
|
+
p.value ? (r(), h("img", {
|
|
643
643
|
key: 0,
|
|
644
|
-
alt:
|
|
645
|
-
class:
|
|
646
|
-
height:
|
|
647
|
-
src:
|
|
648
|
-
width:
|
|
649
|
-
}, null, 10,
|
|
644
|
+
alt: M.value,
|
|
645
|
+
class: Z(d.value ? "size-full object-cover" : "size-full rounded object-cover"),
|
|
646
|
+
height: d.value ? 96 : 20,
|
|
647
|
+
src: l.value,
|
|
648
|
+
width: d.value ? 96 : 20
|
|
649
|
+
}, null, 10, Ys)) : $.value ? (r(), h("video", {
|
|
650
650
|
key: 1,
|
|
651
651
|
class: "size-full object-cover",
|
|
652
652
|
muted: "",
|
|
653
|
-
src:
|
|
654
|
-
}, null, 8,
|
|
653
|
+
src: l.value
|
|
654
|
+
}, null, 8, Zs)) : e.fallbackIcon ? (r(), C(_e(e.fallbackIcon), { key: 2 })) : (r(), C(_e(R.value), {
|
|
655
655
|
key: 3,
|
|
656
|
-
class:
|
|
656
|
+
class: Z(a(N)(i.value, "text-muted-foreground"))
|
|
657
657
|
}, null, 8, ["class"]))
|
|
658
658
|
], 16));
|
|
659
659
|
}
|
|
660
|
-
}),
|
|
660
|
+
}), ea = { class: "sr-only" }, ta = /* @__PURE__ */ P({
|
|
661
661
|
__name: "AttachmentRemove",
|
|
662
662
|
props: {
|
|
663
663
|
label: { default: "Remove" },
|
|
664
664
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
665
665
|
},
|
|
666
|
-
setup(
|
|
667
|
-
const
|
|
668
|
-
function l
|
|
669
|
-
|
|
666
|
+
setup(t) {
|
|
667
|
+
const e = t, { remove: s, variant: n } = Fe(), { variant: o, ...d } = e;
|
|
668
|
+
function i(l) {
|
|
669
|
+
l.stopPropagation(), s == null || s();
|
|
670
670
|
}
|
|
671
|
-
return (
|
|
671
|
+
return (l, p) => a(s) ? (r(), C(a(Re), ie({
|
|
672
672
|
key: 0,
|
|
673
|
-
"aria-label":
|
|
674
|
-
class: a(
|
|
675
|
-
a(
|
|
673
|
+
"aria-label": e.label,
|
|
674
|
+
class: a(N)(
|
|
675
|
+
a(n) === "grid" && [
|
|
676
676
|
"absolute top-2 right-2 size-6 rounded-full p-0",
|
|
677
677
|
"bg-background/80 backdrop-blur-sm",
|
|
678
678
|
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
679
679
|
"hover:bg-background",
|
|
680
680
|
"[&>svg]:size-3"
|
|
681
681
|
],
|
|
682
|
-
a(
|
|
682
|
+
a(n) === "inline" && [
|
|
683
683
|
"size-5 rounded-sm p-0 cursor-pointer min-w-0",
|
|
684
684
|
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
685
685
|
"[&>svg]:size-2.5"
|
|
686
686
|
],
|
|
687
|
-
a(
|
|
688
|
-
|
|
687
|
+
a(n) === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"],
|
|
688
|
+
e.class
|
|
689
689
|
),
|
|
690
690
|
type: "button",
|
|
691
691
|
variant: "ghost"
|
|
692
|
-
},
|
|
693
|
-
default:
|
|
694
|
-
|
|
695
|
-
|
|
692
|
+
}, d, { onClick: i }), {
|
|
693
|
+
default: A(() => [
|
|
694
|
+
W(l.$slots, "default", {}, () => [
|
|
695
|
+
T(a(lt))
|
|
696
696
|
]),
|
|
697
|
-
|
|
697
|
+
b("span", ea, Y(e.label), 1)
|
|
698
698
|
]),
|
|
699
699
|
_: 3
|
|
700
|
-
}, 16, ["aria-label", "class"])) :
|
|
700
|
+
}, 16, ["aria-label", "class"])) : G("", !0);
|
|
701
701
|
}
|
|
702
|
-
}),
|
|
702
|
+
}), sa = /* @__PURE__ */ P({
|
|
703
703
|
__name: "Attachments",
|
|
704
704
|
props: {
|
|
705
705
|
variant: { default: "grid" },
|
|
706
706
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
707
707
|
},
|
|
708
|
-
setup(
|
|
709
|
-
const
|
|
710
|
-
return
|
|
711
|
-
class: a(
|
|
708
|
+
setup(t) {
|
|
709
|
+
const e = t, s = B(() => e.variant);
|
|
710
|
+
return Ee(ht, { variant: s }), (n, o) => (r(), h("div", ie({
|
|
711
|
+
class: a(N)(
|
|
712
712
|
"flex items-start",
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
713
|
+
s.value === "list" ? "flex-col gap-2" : "flex-wrap gap-2",
|
|
714
|
+
s.value === "grid" && "ml-auto w-fit",
|
|
715
|
+
e.class
|
|
716
716
|
)
|
|
717
|
-
},
|
|
718
|
-
|
|
717
|
+
}, n.$attrs), [
|
|
718
|
+
W(n.$slots, "default")
|
|
719
719
|
], 16));
|
|
720
720
|
}
|
|
721
|
-
}),
|
|
721
|
+
}), aa = /* @__PURE__ */ P({
|
|
722
722
|
__name: "InputAttachmentsDisplay",
|
|
723
|
-
setup(
|
|
724
|
-
const { files:
|
|
725
|
-
function o
|
|
726
|
-
return
|
|
723
|
+
setup(t) {
|
|
724
|
+
const { files: e, removeFile: s } = Ns();
|
|
725
|
+
function n(o) {
|
|
726
|
+
return o;
|
|
727
727
|
}
|
|
728
|
-
return (
|
|
728
|
+
return (o, d) => a(e).length > 0 ? (r(), C(a(sa), {
|
|
729
729
|
key: 0,
|
|
730
730
|
variant: "inline",
|
|
731
731
|
class: "attachments-inline"
|
|
732
732
|
}, {
|
|
733
|
-
default:
|
|
734
|
-
(
|
|
735
|
-
key:
|
|
736
|
-
data:
|
|
737
|
-
title:
|
|
738
|
-
onRemove: (
|
|
733
|
+
default: A(() => [
|
|
734
|
+
(r(!0), h(de, null, ve(a(e), (i) => (r(), C(a(Gs), {
|
|
735
|
+
key: i.id,
|
|
736
|
+
data: i,
|
|
737
|
+
title: i.filename,
|
|
738
|
+
onRemove: (l) => a(s)(i.id)
|
|
739
739
|
}, {
|
|
740
|
-
default:
|
|
741
|
-
|
|
742
|
-
|
|
740
|
+
default: A(() => [
|
|
741
|
+
T(a(Qs)),
|
|
742
|
+
T(a(Xs), {
|
|
743
743
|
class: "attachment-info",
|
|
744
|
-
title:
|
|
744
|
+
title: i.filename
|
|
745
745
|
}, null, 8, ["title"]),
|
|
746
|
-
|
|
746
|
+
T(a(ta))
|
|
747
747
|
]),
|
|
748
748
|
_: 2
|
|
749
749
|
}, 1032, ["data", "title", "onRemove"]))), 128))
|
|
750
750
|
]),
|
|
751
751
|
_: 1
|
|
752
|
-
})) :
|
|
752
|
+
})) : G("", !0);
|
|
753
753
|
}
|
|
754
|
-
}),
|
|
754
|
+
}), na = /* @__PURE__ */ pe(aa, [["__scopeId", "data-v-26befc49"]]), st = /* @__PURE__ */ P({
|
|
755
755
|
__name: "Suggestion",
|
|
756
756
|
props: {
|
|
757
757
|
suggestion: {},
|
|
@@ -760,151 +760,151 @@ const Fs = /* @__PURE__ */ S({
|
|
|
760
760
|
size: { default: "sm" }
|
|
761
761
|
},
|
|
762
762
|
emits: ["click"],
|
|
763
|
-
setup(
|
|
764
|
-
const
|
|
765
|
-
function
|
|
766
|
-
|
|
763
|
+
setup(t, { emit: e }) {
|
|
764
|
+
const s = t, n = e;
|
|
765
|
+
function o() {
|
|
766
|
+
n("click", s.suggestion);
|
|
767
767
|
}
|
|
768
|
-
return (
|
|
769
|
-
class: a(
|
|
770
|
-
size:
|
|
768
|
+
return (d, i) => (r(), C(a(Re), ie({
|
|
769
|
+
class: a(N)("cursor-pointer rounded-full px-4", s.class),
|
|
770
|
+
size: s.size,
|
|
771
771
|
type: "button",
|
|
772
|
-
variant:
|
|
773
|
-
},
|
|
774
|
-
default:
|
|
775
|
-
|
|
776
|
-
|
|
772
|
+
variant: s.variant
|
|
773
|
+
}, d.$attrs, { onClick: o }), {
|
|
774
|
+
default: A(() => [
|
|
775
|
+
W(d.$slots, "default", {}, () => [
|
|
776
|
+
je(Y(s.suggestion), 1)
|
|
777
777
|
])
|
|
778
778
|
]),
|
|
779
779
|
_: 3
|
|
780
780
|
}, 16, ["class", "size", "variant"]));
|
|
781
781
|
}
|
|
782
|
-
}),
|
|
782
|
+
}), oa = {
|
|
783
783
|
class: "suggestions-measurements",
|
|
784
784
|
"aria-hidden": "true"
|
|
785
|
-
},
|
|
785
|
+
}, ra = 3200, ia = 5, la = /* @__PURE__ */ P({
|
|
786
786
|
__name: "ChatSuggestions",
|
|
787
787
|
props: {
|
|
788
788
|
suggestions: {}
|
|
789
789
|
},
|
|
790
790
|
emits: ["select"],
|
|
791
|
-
setup(
|
|
792
|
-
const
|
|
793
|
-
let
|
|
794
|
-
const
|
|
795
|
-
const
|
|
796
|
-
return
|
|
791
|
+
setup(t, { emit: e }) {
|
|
792
|
+
const s = t, n = e, o = S(null), d = S([]), i = S([]), l = S(0), p = S(!1);
|
|
793
|
+
let $ = null, y = null;
|
|
794
|
+
const R = B(() => i.value.length > 1), M = B(() => {
|
|
795
|
+
const F = i.value[l.value];
|
|
796
|
+
return F ? s.suggestions.slice(F.start, F.end) : s.suggestions;
|
|
797
797
|
});
|
|
798
|
-
function
|
|
799
|
-
|
|
798
|
+
function E(F, ee) {
|
|
799
|
+
d.value[ee] = F;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
802
|
-
|
|
801
|
+
function k() {
|
|
802
|
+
$ && (clearInterval($), $ = null);
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
},
|
|
804
|
+
function q() {
|
|
805
|
+
k(), !(!R.value || p.value) && ($ = setInterval(() => {
|
|
806
|
+
l.value = (l.value + 1) % i.value.length;
|
|
807
|
+
}, ra));
|
|
808
808
|
}
|
|
809
|
-
function
|
|
810
|
-
|
|
809
|
+
function oe() {
|
|
810
|
+
p.value = !0, k();
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
|
|
812
|
+
function I() {
|
|
813
|
+
p.value = !1, q();
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
var
|
|
817
|
-
const
|
|
818
|
-
var
|
|
819
|
-
return ((
|
|
815
|
+
function j() {
|
|
816
|
+
var m;
|
|
817
|
+
const F = ((m = o.value) == null ? void 0 : m.clientWidth) ?? 0, ee = s.suggestions.map((v, se) => {
|
|
818
|
+
var me;
|
|
819
|
+
return ((me = d.value[se]) == null ? void 0 : me.offsetWidth) ?? 0;
|
|
820
820
|
});
|
|
821
|
-
if (!
|
|
822
|
-
|
|
821
|
+
if (!s.suggestions.length) {
|
|
822
|
+
i.value = [], l.value = 0, k();
|
|
823
823
|
return;
|
|
824
824
|
}
|
|
825
|
-
if (!
|
|
826
|
-
|
|
825
|
+
if (!F || ee.some((v) => v === 0)) {
|
|
826
|
+
i.value = [{ start: 0, end: s.suggestions.length }], l.value = 0, k();
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
|
-
const
|
|
830
|
-
let
|
|
831
|
-
|
|
832
|
-
const
|
|
833
|
-
if (
|
|
834
|
-
|
|
829
|
+
const Q = [];
|
|
830
|
+
let K = 0, u = 0;
|
|
831
|
+
s.suggestions.forEach((v, se) => {
|
|
832
|
+
const me = ee[se], be = K === se ? me : u + ia + me;
|
|
833
|
+
if (K !== se && be > F) {
|
|
834
|
+
Q.push({ start: K, end: se }), K = se, u = me;
|
|
835
835
|
return;
|
|
836
836
|
}
|
|
837
|
-
|
|
838
|
-
}),
|
|
837
|
+
u = be;
|
|
838
|
+
}), Q.push({ start: K, end: s.suggestions.length }), i.value = Q, l.value = Math.min(l.value, Math.max(Q.length - 1, 0)), q();
|
|
839
839
|
}
|
|
840
|
-
async function
|
|
841
|
-
await
|
|
840
|
+
async function L() {
|
|
841
|
+
await rt(), j();
|
|
842
842
|
}
|
|
843
|
-
return
|
|
844
|
-
() =>
|
|
843
|
+
return Be(
|
|
844
|
+
() => s.suggestions,
|
|
845
845
|
async () => {
|
|
846
|
-
|
|
846
|
+
d.value = [], l.value = 0, k(), await L();
|
|
847
847
|
},
|
|
848
848
|
{ immediate: !0 }
|
|
849
|
-
),
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
}),
|
|
853
|
-
}),
|
|
854
|
-
|
|
855
|
-
}), (
|
|
849
|
+
), at(() => {
|
|
850
|
+
y = new ResizeObserver(() => {
|
|
851
|
+
l.value = 0, L();
|
|
852
|
+
}), o.value && y.observe(o.value);
|
|
853
|
+
}), nt(() => {
|
|
854
|
+
k(), y == null || y.disconnect();
|
|
855
|
+
}), (F, ee) => (r(), h("div", {
|
|
856
856
|
class: "suggestions-wrapper",
|
|
857
|
-
onMouseenter:
|
|
858
|
-
onMouseleave:
|
|
857
|
+
onMouseenter: oe,
|
|
858
|
+
onMouseleave: I
|
|
859
859
|
}, [
|
|
860
|
-
|
|
860
|
+
b("div", {
|
|
861
861
|
ref_key: "viewportRef",
|
|
862
|
-
ref:
|
|
863
|
-
class:
|
|
862
|
+
ref: o,
|
|
863
|
+
class: Z(["suggestions-viewport", { "has-fade": R.value }])
|
|
864
864
|
}, [
|
|
865
|
-
|
|
865
|
+
T(ot, {
|
|
866
866
|
name: "suggestion-slide",
|
|
867
867
|
mode: "out-in"
|
|
868
868
|
}, {
|
|
869
|
-
default:
|
|
870
|
-
(
|
|
871
|
-
key:
|
|
869
|
+
default: A(() => [
|
|
870
|
+
(r(), h("div", {
|
|
871
|
+
key: l.value,
|
|
872
872
|
class: "suggestions-row"
|
|
873
873
|
}, [
|
|
874
|
-
(
|
|
875
|
-
key:
|
|
876
|
-
suggestion:
|
|
874
|
+
(r(!0), h(de, null, ve(M.value, (Q) => (r(), C(a(st), {
|
|
875
|
+
key: Q,
|
|
876
|
+
suggestion: Q,
|
|
877
877
|
class: "suggestion-chip",
|
|
878
|
-
onClick: (
|
|
878
|
+
onClick: (K) => n("select", Q)
|
|
879
879
|
}, null, 8, ["suggestion", "onClick"]))), 128))
|
|
880
880
|
]))
|
|
881
881
|
]),
|
|
882
882
|
_: 1
|
|
883
883
|
})
|
|
884
884
|
], 2),
|
|
885
|
-
|
|
886
|
-
(
|
|
887
|
-
key: `measure-${
|
|
885
|
+
b("div", oa, [
|
|
886
|
+
(r(!0), h(de, null, ve(t.suggestions, (Q, K) => (r(), C(a(st), {
|
|
887
|
+
key: `measure-${Q}-${K}`,
|
|
888
888
|
ref_for: !0,
|
|
889
|
-
ref: (
|
|
890
|
-
suggestion:
|
|
889
|
+
ref: (u) => E((u == null ? void 0 : u.$el) || u, K),
|
|
890
|
+
suggestion: Q,
|
|
891
891
|
class: "suggestion-chip",
|
|
892
892
|
tabindex: "-1"
|
|
893
893
|
}, null, 8, ["suggestion"]))), 128))
|
|
894
894
|
])
|
|
895
895
|
], 32));
|
|
896
896
|
}
|
|
897
|
-
}),
|
|
897
|
+
}), ua = /* @__PURE__ */ pe(la, [["__scopeId", "data-v-7c935d5c"]]), ca = /* @__PURE__ */ P({
|
|
898
898
|
__name: "InputGroup",
|
|
899
899
|
props: {
|
|
900
900
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
901
901
|
},
|
|
902
|
-
setup(
|
|
903
|
-
const
|
|
904
|
-
return (
|
|
902
|
+
setup(t) {
|
|
903
|
+
const e = t;
|
|
904
|
+
return (s, n) => (r(), h("div", {
|
|
905
905
|
"data-slot": "input-group",
|
|
906
906
|
role: "group",
|
|
907
|
-
class:
|
|
907
|
+
class: Z(a(N)(
|
|
908
908
|
"group/input-group relative flex w-full items-center rounded-md border border-[var(--ai-input-border)] bg-[var(--ai-input-bg)] shadow-xs transition-[color,box-shadow,border-color] outline-none",
|
|
909
909
|
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
910
910
|
// Variants based on alignment.
|
|
@@ -916,56 +916,56 @@ const Fs = /* @__PURE__ */ S({
|
|
|
916
916
|
"has-[[data-slot=input-group-control]:focus-visible]:border-[var(--ai-input-border-focus)] has-[[data-slot=input-group-control]:focus-visible]:ring-[var(--ai-input-ring)] has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
917
917
|
// Error state.
|
|
918
918
|
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
919
|
-
|
|
919
|
+
e.class
|
|
920
920
|
))
|
|
921
921
|
}, [
|
|
922
|
-
|
|
922
|
+
W(s.$slots, "default")
|
|
923
923
|
], 2));
|
|
924
924
|
}
|
|
925
|
-
}),
|
|
925
|
+
}), da = ["data-align"], pa = /* @__PURE__ */ P({
|
|
926
926
|
__name: "InputGroupAddon",
|
|
927
927
|
props: {
|
|
928
928
|
align: { default: "inline-start" },
|
|
929
929
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
930
930
|
},
|
|
931
|
-
setup(
|
|
932
|
-
const
|
|
933
|
-
function
|
|
934
|
-
var
|
|
935
|
-
const
|
|
936
|
-
|
|
931
|
+
setup(t) {
|
|
932
|
+
const e = t;
|
|
933
|
+
function s(n) {
|
|
934
|
+
var i, l;
|
|
935
|
+
const o = n.currentTarget, d = n.target;
|
|
936
|
+
d && d.closest("button") || o && (o != null && o.parentElement) && ((l = (i = o.parentElement) == null ? void 0 : i.querySelector("input")) == null || l.focus());
|
|
937
937
|
}
|
|
938
|
-
return (
|
|
938
|
+
return (n, o) => (r(), h("div", {
|
|
939
939
|
role: "group",
|
|
940
940
|
"data-slot": "input-group-addon",
|
|
941
|
-
"data-align":
|
|
942
|
-
class:
|
|
943
|
-
onClick:
|
|
941
|
+
"data-align": e.align,
|
|
942
|
+
class: Z(a(N)(a(ga)({ align: e.align }), e.class)),
|
|
943
|
+
onClick: s
|
|
944
944
|
}, [
|
|
945
|
-
|
|
946
|
-
], 10,
|
|
945
|
+
W(n.$slots, "default")
|
|
946
|
+
], 10, da));
|
|
947
947
|
}
|
|
948
|
-
}), Le = /* @__PURE__ */
|
|
948
|
+
}), Le = /* @__PURE__ */ P({
|
|
949
949
|
__name: "InputGroupButton",
|
|
950
950
|
props: {
|
|
951
951
|
variant: { default: "ghost" },
|
|
952
952
|
size: { default: "xs" },
|
|
953
953
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
954
954
|
},
|
|
955
|
-
setup(
|
|
956
|
-
const
|
|
957
|
-
return (
|
|
958
|
-
"data-size":
|
|
959
|
-
variant:
|
|
960
|
-
class:
|
|
955
|
+
setup(t) {
|
|
956
|
+
const e = t;
|
|
957
|
+
return (s, n) => (r(), C(a(Re), {
|
|
958
|
+
"data-size": e.size,
|
|
959
|
+
variant: e.variant,
|
|
960
|
+
class: Z(a(N)(a(va)({ size: e.size }), e.class))
|
|
961
961
|
}, {
|
|
962
|
-
default:
|
|
963
|
-
|
|
962
|
+
default: A(() => [
|
|
963
|
+
W(s.$slots, "default")
|
|
964
964
|
]),
|
|
965
965
|
_: 3
|
|
966
966
|
}, 8, ["data-size", "variant", "class"]));
|
|
967
967
|
}
|
|
968
|
-
}),
|
|
968
|
+
}), ma = /* @__PURE__ */ P({
|
|
969
969
|
__name: "Textarea",
|
|
970
970
|
props: {
|
|
971
971
|
class: { type: [Boolean, null, String, Object, Array] },
|
|
@@ -973,35 +973,35 @@ const Fs = /* @__PURE__ */ S({
|
|
|
973
973
|
modelValue: {}
|
|
974
974
|
},
|
|
975
975
|
emits: ["update:modelValue"],
|
|
976
|
-
setup(
|
|
977
|
-
const
|
|
976
|
+
setup(t, { emit: e }) {
|
|
977
|
+
const s = t, o = rs(s, "modelValue", e, {
|
|
978
978
|
passive: !0,
|
|
979
|
-
defaultValue:
|
|
979
|
+
defaultValue: s.defaultValue
|
|
980
980
|
});
|
|
981
|
-
return (
|
|
982
|
-
"onUpdate:modelValue":
|
|
981
|
+
return (d, i) => Ie((r(), h("textarea", {
|
|
982
|
+
"onUpdate:modelValue": i[0] || (i[0] = (l) => bt(o) ? o.value = l : null),
|
|
983
983
|
"data-slot": "textarea",
|
|
984
|
-
class:
|
|
984
|
+
class: Z(a(N)("border-input text-[var(--ai-input-text)] placeholder:text-[var(--ai-input-placeholder)] focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", s.class))
|
|
985
985
|
}, null, 2)), [
|
|
986
|
-
[
|
|
986
|
+
[xt, a(o)]
|
|
987
987
|
]);
|
|
988
988
|
}
|
|
989
|
-
}),
|
|
989
|
+
}), fa = /* @__PURE__ */ P({
|
|
990
990
|
__name: "InputGroupTextarea",
|
|
991
991
|
props: {
|
|
992
992
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
993
993
|
},
|
|
994
|
-
setup(
|
|
995
|
-
const
|
|
996
|
-
return (
|
|
994
|
+
setup(t) {
|
|
995
|
+
const e = t;
|
|
996
|
+
return (s, n) => (r(), C(a(ma), {
|
|
997
997
|
"data-slot": "input-group-control",
|
|
998
|
-
class:
|
|
998
|
+
class: Z(a(N)(
|
|
999
999
|
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
1000
|
-
|
|
1000
|
+
e.class
|
|
1001
1001
|
))
|
|
1002
1002
|
}, null, 8, ["class"]));
|
|
1003
1003
|
}
|
|
1004
|
-
}),
|
|
1004
|
+
}), ga = We(
|
|
1005
1005
|
"text-[var(--ai-control-muted)] flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
1006
1006
|
{
|
|
1007
1007
|
variants: {
|
|
@@ -1016,7 +1016,7 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1016
1016
|
align: "inline-start"
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
|
-
),
|
|
1019
|
+
), va = We(
|
|
1020
1020
|
"text-sm shadow-none flex gap-2 items-center",
|
|
1021
1021
|
{
|
|
1022
1022
|
variants: {
|
|
@@ -1031,7 +1031,7 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1031
1031
|
size: "xs"
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
1034
|
-
),
|
|
1034
|
+
), ha = /* @__PURE__ */ P({
|
|
1035
1035
|
__name: "DropdownMenu",
|
|
1036
1036
|
props: {
|
|
1037
1037
|
defaultOpen: { type: Boolean },
|
|
@@ -1040,16 +1040,16 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1040
1040
|
modal: { type: Boolean }
|
|
1041
1041
|
},
|
|
1042
1042
|
emits: ["update:open"],
|
|
1043
|
-
setup(
|
|
1044
|
-
const
|
|
1045
|
-
return (
|
|
1046
|
-
default:
|
|
1047
|
-
|
|
1043
|
+
setup(t, { emit: e }) {
|
|
1044
|
+
const o = mt(t, e);
|
|
1045
|
+
return (d, i) => (r(), C(a(cs), ie({ "data-slot": "dropdown-menu" }, a(o)), {
|
|
1046
|
+
default: A((l) => [
|
|
1047
|
+
W(d.$slots, "default", $e(Ce(l)))
|
|
1048
1048
|
]),
|
|
1049
1049
|
_: 3
|
|
1050
1050
|
}, 16));
|
|
1051
1051
|
}
|
|
1052
|
-
}),
|
|
1052
|
+
}), ya = /* @__PURE__ */ P({
|
|
1053
1053
|
inheritAttrs: !1,
|
|
1054
1054
|
__name: "DropdownMenuContent",
|
|
1055
1055
|
props: {
|
|
@@ -1078,17 +1078,17 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1078
1078
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
1079
1079
|
},
|
|
1080
1080
|
emits: ["escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "closeAutoFocus"],
|
|
1081
|
-
setup(
|
|
1082
|
-
const
|
|
1083
|
-
return (
|
|
1084
|
-
to: a(
|
|
1081
|
+
setup(t, { emit: e }) {
|
|
1082
|
+
const s = t, n = e, o = Ue(s, "class"), d = mt(o, n), { portalHost: i } = bs();
|
|
1083
|
+
return (l, p) => (r(), C(a(ds), {
|
|
1084
|
+
to: a(i) || void 0
|
|
1085
1085
|
}, {
|
|
1086
|
-
default:
|
|
1087
|
-
|
|
1088
|
-
class: a(
|
|
1086
|
+
default: A(() => [
|
|
1087
|
+
T(a(ps), ie({ "data-slot": "dropdown-menu-content" }, { ...l.$attrs, ...a(d) }, {
|
|
1088
|
+
class: a(N)("bg-[var(--ai-layer-bg)] text-[var(--ai-layer-text)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--reka-dropdown-menu-content-available-height) min-w-[8rem] origin-(--reka-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-[var(--ai-layer-border)] p-1 shadow-[var(--ai-layer-shadow)]", s.class)
|
|
1089
1089
|
}), {
|
|
1090
|
-
default:
|
|
1091
|
-
|
|
1090
|
+
default: A(() => [
|
|
1091
|
+
W(l.$slots, "default")
|
|
1092
1092
|
]),
|
|
1093
1093
|
_: 3
|
|
1094
1094
|
}, 16, ["class"])
|
|
@@ -1096,7 +1096,7 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1096
1096
|
_: 3
|
|
1097
1097
|
}, 8, ["to"]));
|
|
1098
1098
|
}
|
|
1099
|
-
}),
|
|
1099
|
+
}), _a = /* @__PURE__ */ P({
|
|
1100
1100
|
__name: "DropdownMenuItem",
|
|
1101
1101
|
props: {
|
|
1102
1102
|
disabled: { type: Boolean },
|
|
@@ -1107,58 +1107,58 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1107
1107
|
inset: { type: Boolean },
|
|
1108
1108
|
variant: { default: "default" }
|
|
1109
1109
|
},
|
|
1110
|
-
setup(
|
|
1111
|
-
const
|
|
1112
|
-
return (
|
|
1110
|
+
setup(t) {
|
|
1111
|
+
const e = t, s = Ue(e, "inset", "variant", "class"), n = ft(s);
|
|
1112
|
+
return (o, d) => (r(), C(a(ms), ie({
|
|
1113
1113
|
"data-slot": "dropdown-menu-item",
|
|
1114
|
-
"data-inset":
|
|
1115
|
-
"data-variant":
|
|
1116
|
-
}, a(
|
|
1117
|
-
class: a(
|
|
1114
|
+
"data-inset": t.inset ? "" : void 0,
|
|
1115
|
+
"data-variant": t.variant
|
|
1116
|
+
}, a(n), {
|
|
1117
|
+
class: a(N)("focus:bg-[var(--ai-control-hover-bg)] focus:text-[var(--ai-control-hover-text)] data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-[var(--ai-control-muted)] relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e.class)
|
|
1118
1118
|
}), {
|
|
1119
|
-
default:
|
|
1120
|
-
|
|
1119
|
+
default: A(() => [
|
|
1120
|
+
W(o.$slots, "default")
|
|
1121
1121
|
]),
|
|
1122
1122
|
_: 3
|
|
1123
1123
|
}, 16, ["data-inset", "data-variant", "class"]));
|
|
1124
1124
|
}
|
|
1125
|
-
}),
|
|
1125
|
+
}), ba = /* @__PURE__ */ P({
|
|
1126
1126
|
__name: "DropdownMenuTrigger",
|
|
1127
1127
|
props: {
|
|
1128
1128
|
disabled: { type: Boolean },
|
|
1129
1129
|
asChild: { type: Boolean },
|
|
1130
1130
|
as: {}
|
|
1131
1131
|
},
|
|
1132
|
-
setup(
|
|
1133
|
-
const
|
|
1134
|
-
return (
|
|
1135
|
-
default:
|
|
1136
|
-
|
|
1132
|
+
setup(t) {
|
|
1133
|
+
const s = ft(t);
|
|
1134
|
+
return (n, o) => (r(), C(a(fs), ie({ "data-slot": "dropdown-menu-trigger" }, a(s)), {
|
|
1135
|
+
default: A(() => [
|
|
1136
|
+
W(n.$slots, "default")
|
|
1137
1137
|
]),
|
|
1138
1138
|
_: 3
|
|
1139
1139
|
}, 16));
|
|
1140
1140
|
}
|
|
1141
|
-
}),
|
|
1141
|
+
}), xa = { class: "input-wrapper" }, ka = { class: "w-full" }, wa = { class: "input-top" }, $a = {
|
|
1142
1142
|
key: 0,
|
|
1143
1143
|
class: "input-suggestions"
|
|
1144
|
-
},
|
|
1144
|
+
}, Ca = {
|
|
1145
1145
|
key: 1,
|
|
1146
1146
|
class: "attachments-divider"
|
|
1147
|
-
},
|
|
1147
|
+
}, Ia = {
|
|
1148
1148
|
key: 2,
|
|
1149
1149
|
class: "input-attachments"
|
|
1150
|
-
},
|
|
1150
|
+
}, za = { class: "contents" }, Aa = { class: "flex items-center gap-1" }, Sa = { class: "flex items-center gap-1" }, Ma = ["src", "alt"], Ta = {
|
|
1151
1151
|
key: 1,
|
|
1152
1152
|
class: "whitespace-nowrap"
|
|
1153
|
-
},
|
|
1153
|
+
}, Ba = {
|
|
1154
1154
|
key: 2,
|
|
1155
1155
|
class: "text-muted-foreground"
|
|
1156
|
-
},
|
|
1156
|
+
}, Pa = ["src", "alt"], Oa = { class: "flex-1 truncate" }, ja = {
|
|
1157
1157
|
key: 0,
|
|
1158
1158
|
class: "ml-1.5 rounded bg-[var(--ai-muted-surface)] px-1.5 py-0.5 text-[11px] text-[var(--ai-menu-heading)]"
|
|
1159
|
-
},
|
|
1159
|
+
}, Ea = /* @__PURE__ */ P({
|
|
1160
1160
|
__name: "ChatInput",
|
|
1161
|
-
props: /* @__PURE__ */
|
|
1161
|
+
props: /* @__PURE__ */ Je({
|
|
1162
1162
|
status: {},
|
|
1163
1163
|
currentModel: {},
|
|
1164
1164
|
models: {},
|
|
@@ -1168,274 +1168,280 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1168
1168
|
modelSelectorOpen: { type: Boolean, default: !1 },
|
|
1169
1169
|
modelSelectorOpenModifiers: {}
|
|
1170
1170
|
}),
|
|
1171
|
-
emits: /* @__PURE__ */
|
|
1172
|
-
setup(
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1171
|
+
emits: /* @__PURE__ */ Je(["submit", "stop", "selectSuggestion", "update:currentModel", "update:useWebSearch"], ["update:modelSelectorOpen"]),
|
|
1172
|
+
setup(t, { expose: e, emit: s }) {
|
|
1173
|
+
const n = t, o = s, d = kt(t, "modelSelectorOpen"), i = S(""), l = S(!1), p = S([]), $ = S(null), y = S(!1);
|
|
1174
|
+
nt(() => {
|
|
1175
|
+
p.value.forEach((f) => {
|
|
1176
|
+
f.url && f.url.startsWith("blob:") && URL.revokeObjectURL(f.url);
|
|
1177
1177
|
});
|
|
1178
1178
|
});
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1179
|
+
const R = (f) => {
|
|
1180
|
+
i.value = f;
|
|
1181
1181
|
};
|
|
1182
|
-
function
|
|
1183
|
-
return
|
|
1182
|
+
function M(f, _, x) {
|
|
1183
|
+
return f.type === "file_url" ? "file_url" : f.type === "image" ? "image" : f.type === "file" ? "file" : x && !x.startsWith("blob:") && !x.startsWith("data:") ? "file_url" : ((_ == null ? void 0 : _.type) || "").startsWith("image/") ? "image" : "file";
|
|
1184
1184
|
}
|
|
1185
|
-
const
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1188
|
-
var
|
|
1189
|
-
return (
|
|
1190
|
-
}).filter((
|
|
1191
|
-
),
|
|
1192
|
-
var ce,
|
|
1193
|
-
const
|
|
1194
|
-
...
|
|
1195
|
-
id:
|
|
1185
|
+
const E = (f) => {
|
|
1186
|
+
const _ = new Set(
|
|
1187
|
+
p.value.map((z) => {
|
|
1188
|
+
var w;
|
|
1189
|
+
return (w = z.filename) == null ? void 0 : w.trim();
|
|
1190
|
+
}).filter((z) => !!z)
|
|
1191
|
+
), x = f.flatMap((z) => {
|
|
1192
|
+
var ce, J;
|
|
1193
|
+
const w = z.type === "file_url" ? {
|
|
1194
|
+
...z,
|
|
1195
|
+
id: z.id || Ye(),
|
|
1196
1196
|
type: "file_url",
|
|
1197
|
-
url:
|
|
1198
|
-
mediaType:
|
|
1199
|
-
filename:
|
|
1197
|
+
url: z.url,
|
|
1198
|
+
mediaType: z.mediaType || "application/octet-stream",
|
|
1199
|
+
filename: z.filename
|
|
1200
1200
|
} : (() => {
|
|
1201
|
-
const
|
|
1201
|
+
const te = z.file, ne = z.url || (te ? URL.createObjectURL(te) : void 0), fe = M(z, te, ne);
|
|
1202
1202
|
return {
|
|
1203
|
-
...
|
|
1204
|
-
id:
|
|
1205
|
-
type:
|
|
1206
|
-
url:
|
|
1207
|
-
mediaType:
|
|
1208
|
-
filename:
|
|
1209
|
-
file:
|
|
1203
|
+
...z,
|
|
1204
|
+
id: z.id || Ye(),
|
|
1205
|
+
type: fe,
|
|
1206
|
+
url: ne,
|
|
1207
|
+
mediaType: z.mediaType || (te == null ? void 0 : te.type) || "",
|
|
1208
|
+
filename: z.filename || (te == null ? void 0 : te.name),
|
|
1209
|
+
file: te
|
|
1210
1210
|
};
|
|
1211
|
-
})(),
|
|
1212
|
-
return
|
|
1211
|
+
})(), U = (ce = w.filename) == null ? void 0 : ce.trim();
|
|
1212
|
+
return U && _.has(U) ? ((J = w.url) != null && J.startsWith("blob:") && URL.revokeObjectURL(w.url), []) : (U && _.add(U), [w]);
|
|
1213
1213
|
});
|
|
1214
|
-
|
|
1215
|
-
},
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
type:
|
|
1219
|
-
file:
|
|
1214
|
+
p.value = [...p.value, ...x], l.value = p.value.length > 0;
|
|
1215
|
+
}, k = (f) => {
|
|
1216
|
+
const _ = Array.from(f);
|
|
1217
|
+
E(_.map((x) => ({
|
|
1218
|
+
type: x.type.startsWith("image/") ? "image" : "file",
|
|
1219
|
+
file: x
|
|
1220
1220
|
})));
|
|
1221
|
-
}, q = (
|
|
1222
|
-
const
|
|
1223
|
-
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
}),
|
|
1228
|
-
},
|
|
1229
|
-
|
|
1230
|
-
},
|
|
1231
|
-
var
|
|
1232
|
-
(
|
|
1233
|
-
},
|
|
1221
|
+
}, q = (f) => {
|
|
1222
|
+
const _ = p.value.find((x) => x.id === f);
|
|
1223
|
+
_ != null && _.url && _.url.startsWith("blob:") && URL.revokeObjectURL(_.url), p.value = p.value.filter((x) => x.id !== f), l.value = p.value.length > 0;
|
|
1224
|
+
}, oe = () => {
|
|
1225
|
+
p.value.forEach((f) => {
|
|
1226
|
+
f.url && f.url.startsWith("blob:") && URL.revokeObjectURL(f.url);
|
|
1227
|
+
}), p.value = [], l.value = !1;
|
|
1228
|
+
}, I = () => {
|
|
1229
|
+
i.value = "";
|
|
1230
|
+
}, j = () => {
|
|
1231
|
+
var f;
|
|
1232
|
+
(f = $.value) == null || f.click();
|
|
1233
|
+
}, L = async (f) => {
|
|
1234
1234
|
try {
|
|
1235
|
-
const
|
|
1236
|
-
return new Promise((
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1235
|
+
const x = await (await fetch(f)).blob();
|
|
1236
|
+
return new Promise((z) => {
|
|
1237
|
+
const w = new FileReader();
|
|
1238
|
+
w.onloadend = () => z(w.result), w.onerror = () => z(null), w.readAsDataURL(x);
|
|
1239
1239
|
});
|
|
1240
1240
|
} catch {
|
|
1241
1241
|
return null;
|
|
1242
1242
|
}
|
|
1243
|
-
},
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1243
|
+
}, F = async () => {
|
|
1244
|
+
if (n.status === "streaming")
|
|
1245
|
+
return;
|
|
1246
|
+
const f = await Promise.all(
|
|
1247
|
+
p.value.map(async (x) => {
|
|
1248
|
+
if (x.url && x.url.startsWith("blob:")) {
|
|
1249
|
+
const z = await L(x.url);
|
|
1248
1250
|
return {
|
|
1249
|
-
...
|
|
1250
|
-
type:
|
|
1251
|
-
data:
|
|
1252
|
-
url:
|
|
1251
|
+
...x,
|
|
1252
|
+
type: x.type === "file_url" ? "file" : x.type,
|
|
1253
|
+
data: z ?? x.data,
|
|
1254
|
+
url: z ?? x.url
|
|
1253
1255
|
};
|
|
1254
1256
|
}
|
|
1255
|
-
return
|
|
1257
|
+
return x;
|
|
1256
1258
|
})
|
|
1257
|
-
),
|
|
1258
|
-
text:
|
|
1259
|
-
files:
|
|
1259
|
+
), _ = {
|
|
1260
|
+
text: i.value,
|
|
1261
|
+
files: f
|
|
1260
1262
|
};
|
|
1261
|
-
o("submit",
|
|
1263
|
+
o("submit", _), I(), oe();
|
|
1262
1264
|
};
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1265
|
+
e({
|
|
1266
|
+
setTextInput: R,
|
|
1267
|
+
addAttachments: E,
|
|
1268
|
+
sendMessage: F
|
|
1269
|
+
}), Ee(vt, {
|
|
1270
|
+
textInput: i,
|
|
1271
|
+
files: p,
|
|
1272
|
+
fileInputRef: $,
|
|
1273
|
+
isLoading: y,
|
|
1274
|
+
setTextInput: R,
|
|
1275
|
+
addAttachments: E,
|
|
1276
|
+
addFiles: k,
|
|
1271
1277
|
removeFile: q,
|
|
1272
|
-
clearFiles:
|
|
1273
|
-
clearInput:
|
|
1274
|
-
openFileDialog:
|
|
1275
|
-
sendMessage:
|
|
1278
|
+
clearFiles: oe,
|
|
1279
|
+
clearInput: I,
|
|
1280
|
+
openFileDialog: j,
|
|
1281
|
+
sendMessage: F
|
|
1276
1282
|
});
|
|
1277
|
-
const
|
|
1278
|
-
const
|
|
1279
|
-
return
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1282
|
-
}),
|
|
1283
|
-
}),
|
|
1284
|
-
function
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1283
|
+
const Q = B(() => !i.value.trim() && !l.value), K = B(() => n.currentModel || n.models.find((f) => f.is_default) || n.models[0]), u = B(() => {
|
|
1284
|
+
const f = {};
|
|
1285
|
+
return n.models.forEach((_) => {
|
|
1286
|
+
const x = _.provider || "Other";
|
|
1287
|
+
f[x] || (f[x] = []), f[x].push(_);
|
|
1288
|
+
}), f;
|
|
1289
|
+
}), m = B(() => Object.keys(u.value));
|
|
1290
|
+
function v(f) {
|
|
1291
|
+
const _ = n.models.find((x) => x.name === f);
|
|
1292
|
+
_ && o("update:currentModel", _), d.value = !1;
|
|
1287
1293
|
}
|
|
1288
|
-
const
|
|
1289
|
-
function
|
|
1290
|
-
if (
|
|
1291
|
-
if (
|
|
1292
|
-
|
|
1294
|
+
const se = S(!1);
|
|
1295
|
+
function me(f) {
|
|
1296
|
+
if (f.key === "Enter") {
|
|
1297
|
+
if (O.value) {
|
|
1298
|
+
f.shiftKey || f.preventDefault();
|
|
1293
1299
|
return;
|
|
1294
1300
|
}
|
|
1295
|
-
if (
|
|
1301
|
+
if (se.value || f.shiftKey)
|
|
1296
1302
|
return;
|
|
1297
|
-
|
|
1303
|
+
f.preventDefault(), F();
|
|
1298
1304
|
}
|
|
1299
|
-
if (
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1305
|
+
if (f.key === "Backspace" && i.value === "" && p.value.length > 0) {
|
|
1306
|
+
const _ = p.value[p.value.length - 1];
|
|
1307
|
+
_ && q(_.id);
|
|
1302
1308
|
}
|
|
1303
1309
|
}
|
|
1304
|
-
function
|
|
1305
|
-
var
|
|
1306
|
-
const
|
|
1307
|
-
if (!
|
|
1310
|
+
function be(f) {
|
|
1311
|
+
var z;
|
|
1312
|
+
const _ = (z = f.clipboardData) == null ? void 0 : z.items;
|
|
1313
|
+
if (!_)
|
|
1308
1314
|
return;
|
|
1309
|
-
const
|
|
1310
|
-
for (const
|
|
1311
|
-
if (
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1315
|
+
const x = [];
|
|
1316
|
+
for (const w of Array.from(_))
|
|
1317
|
+
if (w.kind === "file") {
|
|
1318
|
+
const U = w.getAsFile();
|
|
1319
|
+
U && x.push(U);
|
|
1314
1320
|
}
|
|
1315
|
-
|
|
1321
|
+
x.length > 0 && (f.preventDefault(), k(x));
|
|
1316
1322
|
}
|
|
1317
|
-
const
|
|
1318
|
-
function
|
|
1319
|
-
|
|
1323
|
+
const Ve = B(() => n.status === "streaming" ? "destructive" : "submit"), Ne = B(() => n.status === "streaming" ? Ht : Gt), Ke = B(() => n.status === "streaming" ? "size-4 animate-spin" : "size-4"), g = B(() => O.value ? !1 : Q.value), O = B(() => n.status === "streaming");
|
|
1324
|
+
function H() {
|
|
1325
|
+
O.value ? o("stop") : F();
|
|
1320
1326
|
}
|
|
1321
|
-
function
|
|
1322
|
-
const
|
|
1323
|
-
|
|
1327
|
+
function xe(f) {
|
|
1328
|
+
const _ = f.target;
|
|
1329
|
+
_.src = "https://models.dev/logos/openai.svg";
|
|
1324
1330
|
}
|
|
1325
|
-
function
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1331
|
+
function he(f) {
|
|
1332
|
+
const _ = f.target;
|
|
1333
|
+
_.files && k(_.files), _.value = "";
|
|
1328
1334
|
}
|
|
1329
|
-
return (
|
|
1330
|
-
|
|
1335
|
+
return (f, _) => (r(), h("div", xa, [
|
|
1336
|
+
b("input", {
|
|
1331
1337
|
ref_key: "fileInputRef",
|
|
1332
|
-
ref:
|
|
1338
|
+
ref: $,
|
|
1333
1339
|
type: "file",
|
|
1334
1340
|
class: "hidden",
|
|
1335
1341
|
multiple: "",
|
|
1336
1342
|
accept: "image/*,.pdf,.doc,.docx,.txt",
|
|
1337
|
-
onChange:
|
|
1343
|
+
onChange: he
|
|
1338
1344
|
}, null, 544),
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
default:
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
suggestions:
|
|
1346
|
-
onSelect:
|
|
1345
|
+
b("div", ka, [
|
|
1346
|
+
T(a(ca), { class: "input-group-shell overflow-hidden" }, {
|
|
1347
|
+
default: A(() => [
|
|
1348
|
+
b("div", wa, [
|
|
1349
|
+
n.suggestions.length > 0 ? (r(), h("div", $a, [
|
|
1350
|
+
T(ua, {
|
|
1351
|
+
suggestions: n.suggestions,
|
|
1352
|
+
onSelect: _[0] || (_[0] = (x) => o("selectSuggestion", x))
|
|
1347
1353
|
}, null, 8, ["suggestions"])
|
|
1348
|
-
])) :
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
])) :
|
|
1354
|
+
])) : G("", !0),
|
|
1355
|
+
n.suggestions.length > 0 ? (r(), h("div", Ca)) : G("", !0),
|
|
1356
|
+
p.value.length > 0 ? (r(), h("div", Ia, [
|
|
1357
|
+
T(na)
|
|
1358
|
+
])) : G("", !0)
|
|
1353
1359
|
]),
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
modelValue:
|
|
1357
|
-
"onUpdate:modelValue":
|
|
1360
|
+
b("div", za, [
|
|
1361
|
+
T(a(fa), {
|
|
1362
|
+
modelValue: i.value,
|
|
1363
|
+
"onUpdate:modelValue": _[1] || (_[1] = (x) => i.value = x),
|
|
1358
1364
|
placeholder: "有什么我能帮您的?",
|
|
1359
1365
|
name: "message",
|
|
1360
1366
|
class: "field-sizing-content max-h-48 min-h-16 pt-2 pb-3",
|
|
1361
|
-
onKeydown:
|
|
1362
|
-
onPaste:
|
|
1363
|
-
onCompositionstart:
|
|
1364
|
-
onCompositionend:
|
|
1367
|
+
onKeydown: me,
|
|
1368
|
+
onPaste: be,
|
|
1369
|
+
onCompositionstart: _[2] || (_[2] = (x) => se.value = !0),
|
|
1370
|
+
onCompositionend: _[3] || (_[3] = (x) => se.value = !1)
|
|
1365
1371
|
}, null, 8, ["modelValue"])
|
|
1366
1372
|
]),
|
|
1367
|
-
|
|
1373
|
+
T(a(pa), {
|
|
1368
1374
|
align: "block-end",
|
|
1369
1375
|
class: "justify-between gap-1"
|
|
1370
1376
|
}, {
|
|
1371
|
-
default:
|
|
1372
|
-
|
|
1373
|
-
|
|
1377
|
+
default: A(() => [
|
|
1378
|
+
b("div", Aa, [
|
|
1379
|
+
T(a(Le), {
|
|
1374
1380
|
type: "button",
|
|
1375
1381
|
class: "attachment-button cursor-pointer text-muted-foreground",
|
|
1376
|
-
onClick:
|
|
1382
|
+
onClick: j
|
|
1377
1383
|
}, {
|
|
1378
|
-
default:
|
|
1379
|
-
|
|
1384
|
+
default: A(() => [
|
|
1385
|
+
T(a(pt), { class: "size-4" })
|
|
1380
1386
|
]),
|
|
1381
1387
|
_: 1
|
|
1382
1388
|
}),
|
|
1383
|
-
|
|
1389
|
+
W(f.$slots, "attachment-trigger", { addAttachments: E }, void 0, !0)
|
|
1384
1390
|
]),
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
open:
|
|
1388
|
-
"onUpdate:open":
|
|
1391
|
+
b("div", Sa, [
|
|
1392
|
+
T(a(ha), {
|
|
1393
|
+
open: d.value,
|
|
1394
|
+
"onUpdate:open": _[4] || (_[4] = (x) => d.value = x)
|
|
1389
1395
|
}, {
|
|
1390
|
-
default:
|
|
1391
|
-
|
|
1392
|
-
default:
|
|
1393
|
-
|
|
1396
|
+
default: A(() => [
|
|
1397
|
+
T(a(ba), { "as-child": "" }, {
|
|
1398
|
+
default: A(() => [
|
|
1399
|
+
T(a(Le), {
|
|
1394
1400
|
type: "button",
|
|
1395
1401
|
class: "flex items-center gap-1 cursor-pointer"
|
|
1396
1402
|
}, {
|
|
1397
|
-
default:
|
|
1398
|
-
|
|
1403
|
+
default: A(() => [
|
|
1404
|
+
K.value ? (r(), h("img", {
|
|
1399
1405
|
key: 0,
|
|
1400
|
-
src: `https://models.dev/logos/${a(
|
|
1406
|
+
src: `https://models.dev/logos/${a(Qe)(K.value.name)}.svg`,
|
|
1401
1407
|
class: "size-4 rounded-sm object-contain",
|
|
1402
|
-
alt:
|
|
1403
|
-
onError:
|
|
1404
|
-
}, null, 40,
|
|
1405
|
-
|
|
1406
|
-
|
|
1408
|
+
alt: K.value.name,
|
|
1409
|
+
onError: xe
|
|
1410
|
+
}, null, 40, Ma)) : G("", !0),
|
|
1411
|
+
K.value ? (r(), h("span", Ta, Y(K.value.name), 1)) : (r(), h("span", Ba, "选择模型")),
|
|
1412
|
+
T(a(ut), { class: "size-4 opacity-50 shrink-0" })
|
|
1407
1413
|
]),
|
|
1408
1414
|
_: 1
|
|
1409
1415
|
})
|
|
1410
1416
|
]),
|
|
1411
1417
|
_: 1
|
|
1412
1418
|
}),
|
|
1413
|
-
|
|
1414
|
-
default:
|
|
1415
|
-
(
|
|
1416
|
-
|
|
1417
|
-
(
|
|
1418
|
-
key:
|
|
1419
|
-
onSelect: () =>
|
|
1419
|
+
T(a(ya), { align: "start" }, {
|
|
1420
|
+
default: A(() => [
|
|
1421
|
+
(r(!0), h(de, null, ve(m.value, (x) => (r(), h(de, { key: x }, [
|
|
1422
|
+
_[5] || (_[5] = b("div", { class: "px-2 py-1.5 text-xs font-semibold text-[var(--ai-menu-heading)]" }, " 请选择模型 ", -1)),
|
|
1423
|
+
(r(!0), h(de, null, ve(u.value[x], (z) => (r(), C(a(_a), {
|
|
1424
|
+
key: z.name,
|
|
1425
|
+
onSelect: () => v(z.name),
|
|
1420
1426
|
class: "cursor-pointer gap-1 text-[13px] text-[var(--ai-menu-text)]"
|
|
1421
1427
|
}, {
|
|
1422
|
-
default:
|
|
1423
|
-
var
|
|
1428
|
+
default: A(() => {
|
|
1429
|
+
var w;
|
|
1424
1430
|
return [
|
|
1425
|
-
|
|
1426
|
-
src: `https://models.dev/logos/${a(
|
|
1431
|
+
b("img", {
|
|
1432
|
+
src: `https://models.dev/logos/${a(Qe)(z.name)}.svg`,
|
|
1427
1433
|
class: "size-4 rounded-sm object-contain",
|
|
1428
|
-
alt:
|
|
1429
|
-
onError:
|
|
1430
|
-
}, null, 40,
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
+
alt: z.name,
|
|
1435
|
+
onError: xe
|
|
1436
|
+
}, null, 40, Pa),
|
|
1437
|
+
b("span", Oa, [
|
|
1438
|
+
je(Y(z.name) + " ", 1),
|
|
1439
|
+
z.is_default ? (r(), h("span", ja, " 默认 ")) : G("", !0)
|
|
1434
1440
|
]),
|
|
1435
|
-
((
|
|
1441
|
+
((w = K.value) == null ? void 0 : w.name) === z.name ? (r(), C(a(qt), {
|
|
1436
1442
|
key: 0,
|
|
1437
1443
|
class: "size-4"
|
|
1438
|
-
})) :
|
|
1444
|
+
})) : G("", !0)
|
|
1439
1445
|
];
|
|
1440
1446
|
}),
|
|
1441
1447
|
_: 2
|
|
@@ -1447,18 +1453,18 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1447
1453
|
]),
|
|
1448
1454
|
_: 1
|
|
1449
1455
|
}, 8, ["open"]),
|
|
1450
|
-
|
|
1456
|
+
T(a(Le), {
|
|
1451
1457
|
"aria-label": "Submit",
|
|
1452
1458
|
type: "button",
|
|
1453
1459
|
size: "icon-sm",
|
|
1454
|
-
variant:
|
|
1460
|
+
variant: Ve.value,
|
|
1455
1461
|
class: "cursor-pointer disabled:cursor-not-allowed",
|
|
1456
|
-
disabled:
|
|
1457
|
-
onClick:
|
|
1462
|
+
disabled: g.value,
|
|
1463
|
+
onClick: H
|
|
1458
1464
|
}, {
|
|
1459
|
-
default:
|
|
1460
|
-
(
|
|
1461
|
-
class:
|
|
1465
|
+
default: A(() => [
|
|
1466
|
+
(r(), C(_e(Ne.value), {
|
|
1467
|
+
class: Z(Ke.value)
|
|
1462
1468
|
}, null, 8, ["class"]))
|
|
1463
1469
|
]),
|
|
1464
1470
|
_: 1
|
|
@@ -1473,68 +1479,68 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1473
1479
|
])
|
|
1474
1480
|
]));
|
|
1475
1481
|
}
|
|
1476
|
-
}),
|
|
1482
|
+
}), Ra = /* @__PURE__ */ pe(Ea, [["__scopeId", "data-v-8fccc712"]]), Da = ["height", "width"], La = /* @__PURE__ */ P({
|
|
1477
1483
|
__name: "LoaderIcon",
|
|
1478
1484
|
props: {
|
|
1479
1485
|
size: { default: 16 }
|
|
1480
1486
|
},
|
|
1481
|
-
setup(
|
|
1482
|
-
return (
|
|
1483
|
-
height:
|
|
1487
|
+
setup(t) {
|
|
1488
|
+
return (e, s) => (r(), h("svg", {
|
|
1489
|
+
height: t.size,
|
|
1484
1490
|
"stroke-linejoin": "round",
|
|
1485
1491
|
style: { color: "currentcolor" },
|
|
1486
1492
|
viewBox: "0 0 16 16",
|
|
1487
|
-
width:
|
|
1488
|
-
}, [...
|
|
1489
|
-
|
|
1490
|
-
])], 8,
|
|
1493
|
+
width: t.size
|
|
1494
|
+
}, [...s[0] || (s[0] = [
|
|
1495
|
+
wt('<title>Loader</title><g clip-path="url(#clip0_2393_1490)"><path d="M8 0V4" stroke="currentColor" stroke-width="1.5"></path><path d="M8 16V12" opacity="0.5" stroke="currentColor" stroke-width="1.5"></path><path d="M3.29773 1.52783L5.64887 4.7639" opacity="0.9" stroke="currentColor" stroke-width="1.5"></path><path d="M12.7023 1.52783L10.3511 4.7639" opacity="0.1" stroke="currentColor" stroke-width="1.5"></path><path d="M12.7023 14.472L10.3511 11.236" opacity="0.4" stroke="currentColor" stroke-width="1.5"></path><path d="M3.29773 14.472L5.64887 11.236" opacity="0.6" stroke="currentColor" stroke-width="1.5"></path><path d="M15.6085 5.52783L11.8043 6.7639" opacity="0.2" stroke="currentColor" stroke-width="1.5"></path><path d="M0.391602 10.472L4.19583 9.23598" opacity="0.7" stroke="currentColor" stroke-width="1.5"></path><path d="M15.6085 10.4722L11.8043 9.2361" opacity="0.3" stroke="currentColor" stroke-width="1.5"></path><path d="M0.391602 5.52783L4.19583 6.7639" opacity="0.8" stroke="currentColor" stroke-width="1.5"></path></g><defs><clipPath id="clip0_2393_1490"><rect fill="white" height="16" width="16"></rect></clipPath></defs>', 3)
|
|
1496
|
+
])], 8, Da));
|
|
1491
1497
|
}
|
|
1492
|
-
}),
|
|
1498
|
+
}), Ua = /* @__PURE__ */ P({
|
|
1493
1499
|
__name: "Loader",
|
|
1494
1500
|
props: {
|
|
1495
1501
|
size: { default: 16 },
|
|
1496
1502
|
class: { type: [Boolean, null, String, Object, Array] }
|
|
1497
1503
|
},
|
|
1498
|
-
setup(
|
|
1499
|
-
const
|
|
1500
|
-
return (
|
|
1501
|
-
class: a(
|
|
1504
|
+
setup(t) {
|
|
1505
|
+
const e = t;
|
|
1506
|
+
return (s, n) => (r(), h("div", ie({
|
|
1507
|
+
class: a(N)("inline-flex animate-spin items-center justify-center", e.class),
|
|
1502
1508
|
"aria-label": "Loading",
|
|
1503
1509
|
"aria-live": "polite",
|
|
1504
1510
|
role: "status"
|
|
1505
|
-
},
|
|
1506
|
-
|
|
1507
|
-
size:
|
|
1511
|
+
}, s.$attrs), [
|
|
1512
|
+
T(La, {
|
|
1513
|
+
size: e.size
|
|
1508
1514
|
}, null, 8, ["size"])
|
|
1509
1515
|
], 16));
|
|
1510
1516
|
}
|
|
1511
|
-
}),
|
|
1517
|
+
}), Wa = {
|
|
1512
1518
|
key: 0,
|
|
1513
1519
|
class: "generated-files"
|
|
1514
|
-
},
|
|
1520
|
+
}, Fa = ["href"], Va = /* @__PURE__ */ P({
|
|
1515
1521
|
__name: "GeneratedFiles",
|
|
1516
1522
|
props: {
|
|
1517
1523
|
customContent: {},
|
|
1518
1524
|
apiUrl: {},
|
|
1519
1525
|
threadId: {}
|
|
1520
1526
|
},
|
|
1521
|
-
setup(
|
|
1522
|
-
var
|
|
1523
|
-
const
|
|
1524
|
-
return (
|
|
1525
|
-
(
|
|
1526
|
-
key:
|
|
1527
|
+
setup(t) {
|
|
1528
|
+
var n;
|
|
1529
|
+
const e = t, s = ((n = e.customContent) == null ? void 0 : n.type) === "generated_files" ? e.customContent.content : null;
|
|
1530
|
+
return (o, d) => a(s) && Array.isArray(a(s)) ? (r(), h("div", Wa, [
|
|
1531
|
+
(r(!0), h(de, null, ve(a(s), (i, l) => (r(), h("a", {
|
|
1532
|
+
key: l,
|
|
1527
1533
|
class: "file-item",
|
|
1528
|
-
href: `${
|
|
1534
|
+
href: `${e.apiUrl}/webapp/download/${e.threadId}?path=${encodeURIComponent(i)}`,
|
|
1529
1535
|
target: "_blank",
|
|
1530
1536
|
rel: "noopener noreferrer"
|
|
1531
1537
|
}, [
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
], 8,
|
|
1535
|
-
])) :
|
|
1538
|
+
b("span", null, Y(i), 1),
|
|
1539
|
+
T(a(Jt), { class: "file-icon" })
|
|
1540
|
+
], 8, Fa))), 128))
|
|
1541
|
+
])) : G("", !0);
|
|
1536
1542
|
}
|
|
1537
|
-
}),
|
|
1543
|
+
}), Na = /* @__PURE__ */ pe(Va, [["__scopeId", "data-v-bb033040"]]), Ka = /* @__PURE__ */ P({
|
|
1538
1544
|
__name: "Shimmer",
|
|
1539
1545
|
props: {
|
|
1540
1546
|
as: { default: "p" },
|
|
@@ -1542,233 +1548,233 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1542
1548
|
duration: { default: 2 },
|
|
1543
1549
|
spread: { default: 2 }
|
|
1544
1550
|
},
|
|
1545
|
-
setup(
|
|
1546
|
-
const
|
|
1547
|
-
var
|
|
1548
|
-
const
|
|
1549
|
-
return !
|
|
1550
|
-
}),
|
|
1551
|
-
var
|
|
1552
|
-
return (((
|
|
1553
|
-
}),
|
|
1554
|
-
"--spread": `${
|
|
1551
|
+
setup(t) {
|
|
1552
|
+
const e = t, s = $t(), n = B(() => {
|
|
1553
|
+
var $;
|
|
1554
|
+
const p = ($ = s.default) == null ? void 0 : $.call(s);
|
|
1555
|
+
return !p || p.length === 0 ? "" : p.map((y) => typeof y.children == "string" ? y.children : "").join("");
|
|
1556
|
+
}), o = B(() => {
|
|
1557
|
+
var p;
|
|
1558
|
+
return (((p = n.value) == null ? void 0 : p.length) ?? 0) * e.spread;
|
|
1559
|
+
}), d = B(() => N("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", e.class)), i = B(() => ({
|
|
1560
|
+
"--spread": `${o.value}px`,
|
|
1555
1561
|
backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
|
|
1556
|
-
})),
|
|
1557
|
-
return (
|
|
1558
|
-
class:
|
|
1559
|
-
style:
|
|
1562
|
+
})), l = B(() => Ze[e.as] || Ze.p);
|
|
1563
|
+
return (p, $) => (r(), C(_e(l.value), {
|
|
1564
|
+
class: Z(d.value),
|
|
1565
|
+
style: it(i.value),
|
|
1560
1566
|
initial: { backgroundPosition: "100% center" },
|
|
1561
1567
|
animate: { backgroundPosition: "0% center" },
|
|
1562
1568
|
transition: {
|
|
1563
1569
|
repeat: Number.POSITIVE_INFINITY,
|
|
1564
|
-
duration:
|
|
1570
|
+
duration: t.duration,
|
|
1565
1571
|
ease: "linear"
|
|
1566
1572
|
}
|
|
1567
1573
|
}, {
|
|
1568
|
-
default:
|
|
1569
|
-
|
|
1574
|
+
default: A(() => [
|
|
1575
|
+
W(p.$slots, "default")
|
|
1570
1576
|
]),
|
|
1571
1577
|
_: 3
|
|
1572
1578
|
}, 8, ["class", "style", "transition"]));
|
|
1573
1579
|
}
|
|
1574
|
-
}),
|
|
1580
|
+
}), Ha = {
|
|
1575
1581
|
key: 0,
|
|
1576
1582
|
class: "todo-section"
|
|
1577
|
-
},
|
|
1583
|
+
}, Ga = { class: "todo-card" }, qa = { class: "title" }, Ja = { class: "title-summary" }, Xa = { class: "title-meta" }, Ya = { class: "todo-list" }, Za = { class: "todo-row" }, Qa = { class: "todo-index" }, en = {
|
|
1578
1584
|
class: "indicator",
|
|
1579
1585
|
"aria-hidden": "true"
|
|
1580
|
-
},
|
|
1586
|
+
}, tn = {
|
|
1581
1587
|
key: 1,
|
|
1582
1588
|
class: "title-text-base title-text"
|
|
1583
|
-
},
|
|
1589
|
+
}, sn = /* @__PURE__ */ P({
|
|
1584
1590
|
__name: "TodoList",
|
|
1585
1591
|
props: {
|
|
1586
1592
|
initialTodos: { default: () => [] },
|
|
1587
1593
|
toolEvents: { default: () => [] },
|
|
1588
1594
|
chatStatus: { default: "ready" }
|
|
1589
1595
|
},
|
|
1590
|
-
setup(
|
|
1591
|
-
const
|
|
1592
|
-
function
|
|
1593
|
-
|
|
1596
|
+
setup(t) {
|
|
1597
|
+
const e = t, s = S([]), n = S(0), o = B(() => s.value.filter((u) => u.status === "completed").length), d = B(() => s.value.filter((u) => u.status === "in_progress").length), i = B(() => s.value.filter((u) => u.status === "interrupted").length), l = B(() => s.value.filter((u) => u.status === "pending").length), p = S(!1), $ = S(!1);
|
|
1598
|
+
function y() {
|
|
1599
|
+
p.value = !p.value, $.value = !p.value;
|
|
1594
1600
|
}
|
|
1595
|
-
function
|
|
1596
|
-
if (
|
|
1597
|
-
|
|
1601
|
+
function R(u) {
|
|
1602
|
+
if (u.length === 0) {
|
|
1603
|
+
p.value = !1, $.value = !1;
|
|
1598
1604
|
return;
|
|
1599
1605
|
}
|
|
1600
|
-
|
|
1606
|
+
!$.value && e.chatStatus === "streaming" && (p.value = !0);
|
|
1601
1607
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return (
|
|
1608
|
+
function M(u) {
|
|
1609
|
+
return (u || "") === "write_todos";
|
|
1604
1610
|
}
|
|
1605
|
-
function
|
|
1606
|
-
const
|
|
1607
|
-
return
|
|
1611
|
+
function E(u, m) {
|
|
1612
|
+
const v = String(u || "").toLowerCase();
|
|
1613
|
+
return v === "completed" ? "completed" : v === "in_progress" ? "in_progress" : v === "pending" ? "pending" : v === "interrupted" ? "interrupted" : m;
|
|
1608
1614
|
}
|
|
1609
|
-
function
|
|
1610
|
-
const
|
|
1611
|
-
return
|
|
1615
|
+
function k(u) {
|
|
1616
|
+
const m = E(u, "pending");
|
|
1617
|
+
return m === "in_progress" ? "interrupted" : m;
|
|
1612
1618
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1619
|
+
function q(u) {
|
|
1620
|
+
return u.state === "completed" ? "completed" : u.state === "interrupted" ? "interrupted" : u.phase === "tool_call_started" ? "pending" : "in_progress";
|
|
1615
1621
|
}
|
|
1616
|
-
function
|
|
1617
|
-
return
|
|
1618
|
-
id:
|
|
1619
|
-
title:
|
|
1620
|
-
status:
|
|
1621
|
-
})).filter((
|
|
1622
|
+
function oe(u, m = "pending") {
|
|
1623
|
+
return u.map((v, se) => ({
|
|
1624
|
+
id: v.id || `todo-${se + 1}`,
|
|
1625
|
+
title: v.title || v.task || v.content || v.text || v.name || "",
|
|
1626
|
+
status: E(v.status || v.state, m)
|
|
1627
|
+
})).filter((v) => v.title);
|
|
1622
1628
|
}
|
|
1623
|
-
function
|
|
1624
|
-
return
|
|
1625
|
-
id:
|
|
1626
|
-
title:
|
|
1627
|
-
status:
|
|
1628
|
-
})).filter((
|
|
1629
|
+
function I(u) {
|
|
1630
|
+
return u.map((m, v) => ({
|
|
1631
|
+
id: m.id || `todo-${v + 1}`,
|
|
1632
|
+
title: m.title || m.task || m.content || m.text || m.name || "",
|
|
1633
|
+
status: k(m.status || m.state)
|
|
1634
|
+
})).filter((m) => m.title);
|
|
1629
1635
|
}
|
|
1630
|
-
function
|
|
1631
|
-
const
|
|
1632
|
-
...
|
|
1636
|
+
function j() {
|
|
1637
|
+
const u = s.value.map((m) => m.status !== "in_progress" ? m : {
|
|
1638
|
+
...m,
|
|
1633
1639
|
status: "interrupted"
|
|
1634
1640
|
});
|
|
1635
|
-
|
|
1641
|
+
s.value = u, R(u);
|
|
1636
1642
|
}
|
|
1637
|
-
function
|
|
1638
|
-
return "todo" in
|
|
1643
|
+
function L(u) {
|
|
1644
|
+
return "todo" in u || "todos" in u || "item" in u || "items" in u;
|
|
1639
1645
|
}
|
|
1640
|
-
function
|
|
1641
|
-
if (!
|
|
1646
|
+
function F(u) {
|
|
1647
|
+
if (!u) return [];
|
|
1642
1648
|
try {
|
|
1643
|
-
const
|
|
1644
|
-
if (Array.isArray(
|
|
1645
|
-
return
|
|
1646
|
-
if (
|
|
1647
|
-
if (Array.isArray(
|
|
1648
|
-
if (Array.isArray(
|
|
1649
|
-
if (
|
|
1650
|
-
if (
|
|
1649
|
+
const m = JSON.parse(u);
|
|
1650
|
+
if (Array.isArray(m))
|
|
1651
|
+
return m;
|
|
1652
|
+
if (L(m)) {
|
|
1653
|
+
if (Array.isArray(m.todos)) return m.todos;
|
|
1654
|
+
if (Array.isArray(m.items)) return m.items;
|
|
1655
|
+
if (m.todo) return [m.todo];
|
|
1656
|
+
if (m.item) return [m.item];
|
|
1651
1657
|
}
|
|
1652
1658
|
return [];
|
|
1653
1659
|
} catch {
|
|
1654
1660
|
return [];
|
|
1655
1661
|
}
|
|
1656
1662
|
}
|
|
1657
|
-
function ee(
|
|
1658
|
-
const
|
|
1659
|
-
return
|
|
1663
|
+
function ee(u, m = "pending") {
|
|
1664
|
+
const v = F(u);
|
|
1665
|
+
return oe(v, m);
|
|
1660
1666
|
}
|
|
1661
|
-
function
|
|
1662
|
-
const
|
|
1663
|
-
return
|
|
1667
|
+
function Q(u, m = "pending") {
|
|
1668
|
+
const v = ee(u, m);
|
|
1669
|
+
return v.length === 0 ? !1 : (s.value = v, R(v), !0);
|
|
1664
1670
|
}
|
|
1665
|
-
function
|
|
1666
|
-
const
|
|
1667
|
-
|
|
1671
|
+
function K(u) {
|
|
1672
|
+
const m = q(u);
|
|
1673
|
+
M(u.name) && Q(u.args, m);
|
|
1668
1674
|
}
|
|
1669
|
-
return
|
|
1670
|
-
() =>
|
|
1671
|
-
(
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1675
|
+
return Be(
|
|
1676
|
+
() => e.initialTodos,
|
|
1677
|
+
(u) => {
|
|
1678
|
+
const m = I(u || []);
|
|
1679
|
+
s.value = m, R(m);
|
|
1674
1680
|
},
|
|
1675
1681
|
{ deep: !0, immediate: !0 }
|
|
1676
|
-
),
|
|
1677
|
-
() =>
|
|
1678
|
-
(
|
|
1679
|
-
if (!
|
|
1680
|
-
|
|
1682
|
+
), Be(
|
|
1683
|
+
() => e.toolEvents,
|
|
1684
|
+
(u) => {
|
|
1685
|
+
if (!u.length) {
|
|
1686
|
+
n.value = 0;
|
|
1681
1687
|
return;
|
|
1682
1688
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
}),
|
|
1689
|
+
u.length < n.value && (s.value = [], n.value = 0, R([])), u.slice(n.value).forEach((v) => {
|
|
1690
|
+
K(v);
|
|
1691
|
+
}), n.value = u.length;
|
|
1686
1692
|
},
|
|
1687
1693
|
{ deep: !0, immediate: !0 }
|
|
1688
|
-
),
|
|
1689
|
-
() =>
|
|
1690
|
-
(
|
|
1691
|
-
|
|
1694
|
+
), Be(
|
|
1695
|
+
() => e.chatStatus,
|
|
1696
|
+
(u, m) => {
|
|
1697
|
+
m === "streaming" && u === "ready" && j();
|
|
1692
1698
|
}
|
|
1693
|
-
), (
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
class:
|
|
1697
|
-
onClick:
|
|
1699
|
+
), (u, m) => s.value.length ? (r(), h("div", Ha, [
|
|
1700
|
+
b("div", Ga, [
|
|
1701
|
+
b("div", {
|
|
1702
|
+
class: Z(["todo-divider", { collapsed: !p.value }]),
|
|
1703
|
+
onClick: y
|
|
1698
1704
|
}, [
|
|
1699
|
-
|
|
1700
|
-
(
|
|
1705
|
+
b("div", qa, [
|
|
1706
|
+
(r(), C(_e(p.value ? a(Xt) : a(Yt)), {
|
|
1701
1707
|
size: 13,
|
|
1702
1708
|
class: "title-chevron"
|
|
1703
1709
|
})),
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1710
|
+
m[0] || (m[0] = b("span", { class: "title-label" }, "执行计划", -1)),
|
|
1711
|
+
b("span", Ja, Y(o.value) + "/" + Y(s.value.length), 1),
|
|
1712
|
+
b("span", Xa, Y(d.value > 0 ? `进行中 ${d.value}` : i.value > 0 ? `中断 ${i.value}` : l.value > 0 ? `待处理 ${l.value}` : "已完成"), 1)
|
|
1707
1713
|
])
|
|
1708
1714
|
], 2),
|
|
1709
|
-
|
|
1710
|
-
(
|
|
1711
|
-
key:
|
|
1715
|
+
Ie(b("div", Ya, [
|
|
1716
|
+
(r(!0), h(de, null, ve(s.value, (v, se) => (r(), h("div", {
|
|
1717
|
+
key: v.id,
|
|
1712
1718
|
class: "todo-item"
|
|
1713
1719
|
}, [
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
class:
|
|
1717
|
-
completed:
|
|
1718
|
-
pending:
|
|
1719
|
-
interrupted:
|
|
1720
|
-
"in-progress":
|
|
1720
|
+
b("div", Za, [
|
|
1721
|
+
b("div", {
|
|
1722
|
+
class: Z(["todo-content", {
|
|
1723
|
+
completed: v.status === "completed",
|
|
1724
|
+
pending: v.status === "pending",
|
|
1725
|
+
interrupted: v.status === "interrupted",
|
|
1726
|
+
"in-progress": v.status === "in_progress"
|
|
1721
1727
|
}])
|
|
1722
1728
|
}, [
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1729
|
+
b("span", Qa, Y(se + 1) + ".", 1),
|
|
1730
|
+
b("span", en, [
|
|
1731
|
+
v.status === "pending" ? (r(), C(a(Zt), {
|
|
1726
1732
|
key: 0,
|
|
1727
1733
|
size: 13,
|
|
1728
1734
|
class: "status-icon pending-icon"
|
|
1729
|
-
})) :
|
|
1730
|
-
|
|
1735
|
+
})) : G("", !0),
|
|
1736
|
+
v.status === "in_progress" ? (r(), C(a(Qt), {
|
|
1731
1737
|
key: 1,
|
|
1732
1738
|
size: 13,
|
|
1733
1739
|
class: "status-icon in-progress-icon"
|
|
1734
|
-
})) :
|
|
1735
|
-
|
|
1740
|
+
})) : G("", !0),
|
|
1741
|
+
v.status === "interrupted" ? (r(), C(a(es), {
|
|
1736
1742
|
key: 2,
|
|
1737
1743
|
size: 13,
|
|
1738
1744
|
class: "status-icon interrupted-icon"
|
|
1739
|
-
})) :
|
|
1740
|
-
|
|
1745
|
+
})) : G("", !0),
|
|
1746
|
+
v.status === "completed" ? (r(), C(a(ts), {
|
|
1741
1747
|
key: 3,
|
|
1742
1748
|
size: 13,
|
|
1743
1749
|
class: "status-icon completed-icon"
|
|
1744
|
-
})) :
|
|
1750
|
+
})) : G("", !0)
|
|
1745
1751
|
]),
|
|
1746
|
-
|
|
1752
|
+
v.status === "in_progress" ? (r(), C(a(Ka), {
|
|
1747
1753
|
key: 0,
|
|
1748
1754
|
as: "div",
|
|
1749
1755
|
class: "title-text-base title-text-shimmer"
|
|
1750
1756
|
}, {
|
|
1751
|
-
default:
|
|
1752
|
-
|
|
1757
|
+
default: A(() => [
|
|
1758
|
+
je(Y(v.title), 1)
|
|
1753
1759
|
]),
|
|
1754
1760
|
_: 2
|
|
1755
|
-
}, 1024)) : (
|
|
1761
|
+
}, 1024)) : (r(), h("div", tn, Y(v.title), 1))
|
|
1756
1762
|
], 2)
|
|
1757
1763
|
])
|
|
1758
1764
|
]))), 128))
|
|
1759
1765
|
], 512), [
|
|
1760
|
-
[
|
|
1766
|
+
[Pe, p.value]
|
|
1761
1767
|
])
|
|
1762
1768
|
])
|
|
1763
|
-
])) :
|
|
1769
|
+
])) : G("", !0);
|
|
1764
1770
|
}
|
|
1765
|
-
}),
|
|
1771
|
+
}), an = /* @__PURE__ */ pe(sn, [["__scopeId", "data-v-0f197674"]]), nn = ["data-ai-theme"], on = {
|
|
1766
1772
|
key: 0,
|
|
1767
1773
|
class: "flex-1 overflow-y-hidden flex flex-col items-center justify-center"
|
|
1768
|
-
},
|
|
1774
|
+
}, rn = { class: "default-empty-state" }, ln = { class: "default-empty-title" }, un = {
|
|
1769
1775
|
key: 2,
|
|
1770
1776
|
class: "loading-mask"
|
|
1771
|
-
},
|
|
1777
|
+
}, cn = /* @__PURE__ */ P({
|
|
1772
1778
|
__name: "ChatBot",
|
|
1773
1779
|
props: {
|
|
1774
1780
|
assistantId: { default: "research" },
|
|
@@ -1783,197 +1789,197 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1783
1789
|
theme: { default: "light" }
|
|
1784
1790
|
},
|
|
1785
1791
|
emits: ["close", "update:isMaximized"],
|
|
1786
|
-
setup(
|
|
1787
|
-
const
|
|
1788
|
-
apiUrl:
|
|
1789
|
-
apiKey:
|
|
1790
|
-
}), i =
|
|
1791
|
-
|
|
1792
|
-
const
|
|
1793
|
-
function
|
|
1794
|
-
const O =
|
|
1792
|
+
setup(t, { expose: e, emit: s }) {
|
|
1793
|
+
const n = S(null), o = t, d = new Ct({
|
|
1794
|
+
apiUrl: o.apiUrl,
|
|
1795
|
+
apiKey: o.apiKey || void 0
|
|
1796
|
+
}), i = S(!1), l = S(null), p = S(null);
|
|
1797
|
+
Ee(gt, { portalHost: p });
|
|
1798
|
+
const $ = S("ready"), y = S(""), R = S(!1), M = S(!1), E = S(!0), k = S([]), q = S([]), oe = S([]), I = S([]);
|
|
1799
|
+
function j(g) {
|
|
1800
|
+
const O = g || "";
|
|
1795
1801
|
return O.includes("todo") || O === "write_todos";
|
|
1796
1802
|
}
|
|
1797
|
-
function
|
|
1798
|
-
|
|
1799
|
-
phase:
|
|
1800
|
-
id:
|
|
1801
|
-
name:
|
|
1802
|
-
args:
|
|
1803
|
-
result:
|
|
1804
|
-
state:
|
|
1803
|
+
function L(g) {
|
|
1804
|
+
j(g.name) && (I.value = [...I.value, {
|
|
1805
|
+
phase: g.phase,
|
|
1806
|
+
id: g.id,
|
|
1807
|
+
name: g.name,
|
|
1808
|
+
args: g.rawArgs,
|
|
1809
|
+
result: g.result,
|
|
1810
|
+
state: g.state
|
|
1805
1811
|
}]);
|
|
1806
1812
|
}
|
|
1807
|
-
const
|
|
1808
|
-
|
|
1809
|
-
|
|
1813
|
+
const F = S([]), ee = S(null);
|
|
1814
|
+
at(async () => {
|
|
1815
|
+
E.value = !0, q.value = [...o.suggestions], await Promise.all([
|
|
1810
1816
|
(async () => {
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1817
|
+
const g = await vs(o.apiUrl);
|
|
1818
|
+
F.value = g, ee.value = hs(g) || null;
|
|
1813
1819
|
})(),
|
|
1814
|
-
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1820
|
+
o.threadId ? (async () => {
|
|
1821
|
+
const g = await ys(d, o.threadId, o.userId);
|
|
1822
|
+
l.value = g, k.value = await _s(
|
|
1823
|
+
d,
|
|
1824
|
+
g,
|
|
1819
1825
|
(O) => {
|
|
1820
|
-
|
|
1826
|
+
q.value = O;
|
|
1821
1827
|
},
|
|
1822
1828
|
(O) => {
|
|
1823
|
-
|
|
1829
|
+
oe.value = O;
|
|
1824
1830
|
}
|
|
1825
1831
|
);
|
|
1826
1832
|
})() : Promise.resolve()
|
|
1827
|
-
]),
|
|
1833
|
+
]), E.value = !1;
|
|
1828
1834
|
});
|
|
1829
|
-
function
|
|
1830
|
-
i.value = !i.value,
|
|
1835
|
+
function Q() {
|
|
1836
|
+
i.value = !i.value, se("update:isMaximized", i.value);
|
|
1831
1837
|
}
|
|
1832
|
-
async function
|
|
1833
|
-
var
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
for (const
|
|
1839
|
-
const
|
|
1840
|
-
if ((
|
|
1841
|
-
|
|
1838
|
+
async function K(g, O = []) {
|
|
1839
|
+
var he, f, _, x, z;
|
|
1840
|
+
if ($.value === "streaming") return;
|
|
1841
|
+
$.value = "streaming";
|
|
1842
|
+
const H = [];
|
|
1843
|
+
g.trim() && H.push({ type: "text", text: g });
|
|
1844
|
+
for (const w of O) {
|
|
1845
|
+
const U = w.mediaType || "application/octet-stream", ce = w.filename || w.id || "unknown", J = w.data || w.url || "", te = J.startsWith("data:"), ne = te && J.split(",")[1] || "", fe = w.type || (te ? U.startsWith("image/") ? "image" : "file" : "file_url");
|
|
1846
|
+
if ((fe === "file" || fe === "image") && ne) {
|
|
1847
|
+
fe === "image" ? H.push({
|
|
1842
1848
|
type: "image",
|
|
1843
|
-
mimeType:
|
|
1844
|
-
data:
|
|
1845
|
-
metadata: { name:
|
|
1846
|
-
}) :
|
|
1849
|
+
mimeType: U,
|
|
1850
|
+
data: ne,
|
|
1851
|
+
metadata: { name: ce }
|
|
1852
|
+
}) : H.push({
|
|
1847
1853
|
type: "file",
|
|
1848
|
-
mimeType:
|
|
1849
|
-
data:
|
|
1850
|
-
metadata: { filename:
|
|
1854
|
+
mimeType: U,
|
|
1855
|
+
data: ne,
|
|
1856
|
+
metadata: { filename: ce }
|
|
1851
1857
|
});
|
|
1852
1858
|
continue;
|
|
1853
1859
|
}
|
|
1854
|
-
|
|
1860
|
+
w.url && H.push({
|
|
1855
1861
|
type: "file_url",
|
|
1856
|
-
url:
|
|
1857
|
-
mimeType:
|
|
1858
|
-
metadata: { filename:
|
|
1862
|
+
url: w.url,
|
|
1863
|
+
mimeType: U,
|
|
1864
|
+
metadata: { filename: ce }
|
|
1859
1865
|
});
|
|
1860
1866
|
}
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
...
|
|
1867
|
+
const xe = `human-${Date.now()}`;
|
|
1868
|
+
k.value = [
|
|
1869
|
+
...k.value,
|
|
1864
1870
|
{
|
|
1865
|
-
key:
|
|
1871
|
+
key: xe,
|
|
1866
1872
|
type: "human",
|
|
1867
|
-
content:
|
|
1868
|
-
files: O.map((
|
|
1873
|
+
content: g,
|
|
1874
|
+
files: O.map((w) => ({ url: w.url, mediaType: w.mediaType, filename: w.filename }))
|
|
1869
1875
|
}
|
|
1870
1876
|
];
|
|
1871
1877
|
try {
|
|
1872
|
-
let
|
|
1878
|
+
let w = function(ge, le, D, ye) {
|
|
1873
1879
|
return {
|
|
1874
|
-
key: `tool-${
|
|
1880
|
+
key: `tool-${ge}-${Date.now()}`,
|
|
1875
1881
|
type: "tool",
|
|
1876
1882
|
content: "",
|
|
1877
|
-
batchId:
|
|
1883
|
+
batchId: y.value,
|
|
1878
1884
|
toolCalls: [{
|
|
1879
|
-
id:
|
|
1880
|
-
name:
|
|
1881
|
-
args:
|
|
1885
|
+
id: ge,
|
|
1886
|
+
name: le,
|
|
1887
|
+
args: D,
|
|
1882
1888
|
result: "",
|
|
1883
|
-
state:
|
|
1889
|
+
state: ye
|
|
1884
1890
|
}]
|
|
1885
1891
|
};
|
|
1886
|
-
},
|
|
1887
|
-
const
|
|
1888
|
-
|
|
1892
|
+
}, U = function(ge, le) {
|
|
1893
|
+
const D = k.value[ge];
|
|
1894
|
+
D && D.toolCalls && D.toolCalls.length > 0 && (le.args !== void 0 && (D.toolCalls[0].args = le.args), le.result !== void 0 && (D.toolCalls[0].result = le.result), le.state !== void 0 && (D.toolCalls[0].state = le.state));
|
|
1889
1895
|
};
|
|
1890
|
-
if (!
|
|
1891
|
-
const
|
|
1896
|
+
if (!l.value) {
|
|
1897
|
+
const ge = await d.threads.create({
|
|
1892
1898
|
metadata: {
|
|
1893
|
-
user_id:
|
|
1894
|
-
name:
|
|
1899
|
+
user_id: o.userId,
|
|
1900
|
+
name: g.slice(0, 50)
|
|
1895
1901
|
}
|
|
1896
1902
|
});
|
|
1897
|
-
|
|
1903
|
+
l.value = ge.thread_id;
|
|
1898
1904
|
}
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1901
|
-
|
|
1905
|
+
const ce = d.runs.stream(
|
|
1906
|
+
l.value,
|
|
1907
|
+
o.assistantId,
|
|
1902
1908
|
{
|
|
1903
1909
|
input: {
|
|
1904
1910
|
messages: [
|
|
1905
|
-
...
|
|
1911
|
+
...o.systemPrompt ? [{
|
|
1906
1912
|
type: "system",
|
|
1907
|
-
content: [{ type: "text", text:
|
|
1913
|
+
content: [{ type: "text", text: o.systemPrompt }]
|
|
1908
1914
|
}] : [],
|
|
1909
1915
|
{
|
|
1910
1916
|
type: "human",
|
|
1911
|
-
content:
|
|
1917
|
+
content: H
|
|
1912
1918
|
}
|
|
1913
1919
|
]
|
|
1914
1920
|
},
|
|
1915
1921
|
config: {
|
|
1916
1922
|
tags: ["serv"],
|
|
1917
1923
|
configurable: {
|
|
1918
|
-
model_provider: ((
|
|
1919
|
-
model: ((
|
|
1920
|
-
base_url: ((
|
|
1924
|
+
model_provider: ((he = ee.value) == null ? void 0 : he.provider) || "openai",
|
|
1925
|
+
model: ((f = ee.value) == null ? void 0 : f.name) || "",
|
|
1926
|
+
base_url: ((_ = ee.value) == null ? void 0 : _.base_url) || ""
|
|
1921
1927
|
}
|
|
1922
1928
|
},
|
|
1923
1929
|
metadata: {
|
|
1924
|
-
user_id:
|
|
1925
|
-
name:
|
|
1930
|
+
user_id: o.userId,
|
|
1931
|
+
name: g.slice(0, 50)
|
|
1926
1932
|
},
|
|
1927
1933
|
streamMode: ["messages-tuple", "custom"],
|
|
1928
1934
|
stream_resumable: !1,
|
|
1929
1935
|
on_disconnect: "cancel"
|
|
1930
1936
|
}
|
|
1931
|
-
),
|
|
1932
|
-
|
|
1933
|
-
...
|
|
1937
|
+
), J = `ai-${Date.now()}`;
|
|
1938
|
+
k.value = [
|
|
1939
|
+
...k.value,
|
|
1934
1940
|
{
|
|
1935
|
-
key:
|
|
1941
|
+
key: J,
|
|
1936
1942
|
type: "ai",
|
|
1937
1943
|
content: "",
|
|
1938
1944
|
batchId: ""
|
|
1939
1945
|
}
|
|
1940
1946
|
];
|
|
1941
|
-
let
|
|
1942
|
-
const
|
|
1943
|
-
let
|
|
1944
|
-
for await (const
|
|
1945
|
-
const
|
|
1946
|
-
if (
|
|
1947
|
-
if (
|
|
1947
|
+
let te = "";
|
|
1948
|
+
const ne = /* @__PURE__ */ new Map();
|
|
1949
|
+
let fe = !1;
|
|
1950
|
+
for await (const ge of ce) {
|
|
1951
|
+
const le = ge.event, D = ge.data;
|
|
1952
|
+
if (le === "metadata" && (D != null && D.run_id) && (y.value = D.run_id), le === "custom") {
|
|
1953
|
+
if (be(D), (D == null ? void 0 : D.type) === "suggested_questions")
|
|
1948
1954
|
continue;
|
|
1949
|
-
const
|
|
1950
|
-
type: (
|
|
1951
|
-
content:
|
|
1952
|
-
},
|
|
1953
|
-
|
|
1954
|
-
...
|
|
1955
|
+
const ye = {
|
|
1956
|
+
type: (D == null ? void 0 : D.type) || "unknown",
|
|
1957
|
+
content: D == null ? void 0 : D.content
|
|
1958
|
+
}, V = `custom-${Date.now()}`;
|
|
1959
|
+
k.value = [
|
|
1960
|
+
...k.value,
|
|
1955
1961
|
{
|
|
1956
|
-
key:
|
|
1962
|
+
key: V,
|
|
1957
1963
|
type: "custom",
|
|
1958
1964
|
content: "",
|
|
1959
|
-
customContent:
|
|
1965
|
+
customContent: ye
|
|
1960
1966
|
}
|
|
1961
|
-
], console.log("📦 Custom 消息:",
|
|
1967
|
+
], console.log("📦 Custom 消息:", ye);
|
|
1962
1968
|
continue;
|
|
1963
1969
|
}
|
|
1964
|
-
if (
|
|
1965
|
-
const
|
|
1966
|
-
if (
|
|
1967
|
-
if (
|
|
1968
|
-
const
|
|
1969
|
-
let
|
|
1970
|
-
for (const [
|
|
1971
|
-
if (
|
|
1972
|
-
|
|
1970
|
+
if (le === "messages" || le === "messages/partial") {
|
|
1971
|
+
const ye = Array.isArray(D) ? D : [D], V = ye[0], ze = ye[1];
|
|
1972
|
+
if (ze != null && ze.run_id && (y.value = ze.run_id), V) {
|
|
1973
|
+
if (V.type === "tool") {
|
|
1974
|
+
const c = V.tool_call_id, re = V.name || "未知工具", ue = typeof V.content == "string" ? V.content : JSON.stringify(V.content), X = V.status;
|
|
1975
|
+
let ae;
|
|
1976
|
+
for (const [Me, Te] of ne)
|
|
1977
|
+
if (Te.id === c) {
|
|
1978
|
+
ae = Te, ne.delete(Me);
|
|
1973
1979
|
break;
|
|
1974
1980
|
}
|
|
1975
|
-
const De = ((
|
|
1976
|
-
switch (
|
|
1981
|
+
const De = ((Me) => {
|
|
1982
|
+
switch (Me) {
|
|
1977
1983
|
case "success":
|
|
1978
1984
|
return "completed";
|
|
1979
1985
|
case "error":
|
|
@@ -1983,307 +1989,322 @@ const Fs = /* @__PURE__ */ S({
|
|
|
1983
1989
|
default:
|
|
1984
1990
|
return "completed";
|
|
1985
1991
|
}
|
|
1986
|
-
})(
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
1989
|
-
args:
|
|
1990
|
-
result:
|
|
1992
|
+
})(X);
|
|
1993
|
+
if (ae && ae.messageKey !== void 0)
|
|
1994
|
+
U(ae.messageKey, {
|
|
1995
|
+
args: ae.args,
|
|
1996
|
+
result: ue,
|
|
1991
1997
|
state: De
|
|
1992
1998
|
});
|
|
1993
1999
|
else {
|
|
1994
|
-
const
|
|
1995
|
-
key: `tool-${
|
|
2000
|
+
const Te = {
|
|
2001
|
+
key: `tool-${c}-${Date.now()}`,
|
|
1996
2002
|
type: "tool",
|
|
1997
|
-
content:
|
|
1998
|
-
batchId:
|
|
2003
|
+
content: ue,
|
|
2004
|
+
batchId: y.value,
|
|
1999
2005
|
toolCalls: [{
|
|
2000
|
-
id:
|
|
2001
|
-
name:
|
|
2002
|
-
args: (
|
|
2003
|
-
result:
|
|
2006
|
+
id: c,
|
|
2007
|
+
name: re,
|
|
2008
|
+
args: (ae == null ? void 0 : ae.args) || "",
|
|
2009
|
+
result: ue,
|
|
2004
2010
|
state: De,
|
|
2005
|
-
error:
|
|
2011
|
+
error: X === "error" ? ue : void 0
|
|
2006
2012
|
}]
|
|
2007
2013
|
};
|
|
2008
|
-
|
|
2014
|
+
k.value.push(Te);
|
|
2009
2015
|
}
|
|
2010
|
-
|
|
2016
|
+
L({
|
|
2011
2017
|
phase: "tool_result",
|
|
2012
|
-
id:
|
|
2013
|
-
name:
|
|
2014
|
-
rawArgs: (
|
|
2015
|
-
result:
|
|
2018
|
+
id: c,
|
|
2019
|
+
name: re,
|
|
2020
|
+
rawArgs: (ae == null ? void 0 : ae.args) || "",
|
|
2021
|
+
result: ue,
|
|
2016
2022
|
state: De
|
|
2017
2023
|
}), console.log("🔧 阶段4 - 工具结果返回:", {
|
|
2018
|
-
name:
|
|
2019
|
-
id:
|
|
2020
|
-
args: (
|
|
2021
|
-
result:
|
|
2022
|
-
status:
|
|
2023
|
-
messageCount:
|
|
2024
|
-
}),
|
|
2024
|
+
name: re,
|
|
2025
|
+
id: c,
|
|
2026
|
+
args: (ae == null ? void 0 : ae.args) || "",
|
|
2027
|
+
result: ue,
|
|
2028
|
+
status: X,
|
|
2029
|
+
messageCount: k.value.length
|
|
2030
|
+
}), fe = !0;
|
|
2025
2031
|
continue;
|
|
2026
2032
|
}
|
|
2027
|
-
if (
|
|
2028
|
-
for (const [,
|
|
2029
|
-
|
|
2033
|
+
if (V.chunk_position === "last") {
|
|
2034
|
+
for (const [, c] of ne)
|
|
2035
|
+
c.messageKey !== void 0 && U(c.messageKey, { state: "running" }), L({
|
|
2030
2036
|
phase: "tool_call_finished",
|
|
2031
|
-
id:
|
|
2032
|
-
name:
|
|
2033
|
-
rawArgs:
|
|
2037
|
+
id: c.id,
|
|
2038
|
+
name: c.name,
|
|
2039
|
+
rawArgs: c.args,
|
|
2034
2040
|
state: "running"
|
|
2035
2041
|
});
|
|
2036
2042
|
console.log("🛑 阶段3 - 工具调用结束", {
|
|
2037
|
-
chunk_position:
|
|
2038
|
-
toolCallsCount:
|
|
2039
|
-
allToolCalls: Array.from(
|
|
2043
|
+
chunk_position: V.chunk_position,
|
|
2044
|
+
toolCallsCount: ne.size,
|
|
2045
|
+
allToolCalls: Array.from(ne.values()).map((c) => ({ id: c.id, name: c.name, args: c.args }))
|
|
2040
2046
|
});
|
|
2041
2047
|
}
|
|
2042
|
-
const
|
|
2043
|
-
if (
|
|
2044
|
-
if (
|
|
2045
|
-
for (const
|
|
2046
|
-
const
|
|
2047
|
-
if (
|
|
2048
|
-
|
|
2048
|
+
const we = V.id, Ge = V.tool_calls && V.tool_calls.length > 0, qe = V.tool_call_chunks && V.tool_call_chunks.length > 0;
|
|
2049
|
+
if (Ge || qe) {
|
|
2050
|
+
if (Ge)
|
|
2051
|
+
for (const c of V.tool_calls) {
|
|
2052
|
+
const re = V.tool_calls.indexOf(c), ue = `${we}_${re}`, X = ne.get(ue);
|
|
2053
|
+
if (X)
|
|
2054
|
+
c.id && (X.id = c.id), c.name && (X.name = c.name), c.name && (X.name = c.name);
|
|
2049
2055
|
else {
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2052
|
-
const
|
|
2053
|
-
|
|
2054
|
-
id:
|
|
2055
|
-
name:
|
|
2056
|
+
const ae = w(c.id, c.name, "", "start");
|
|
2057
|
+
k.value.push(ae);
|
|
2058
|
+
const ke = k.value.length - 1;
|
|
2059
|
+
ne.set(ue, {
|
|
2060
|
+
id: c.id,
|
|
2061
|
+
name: c.name,
|
|
2056
2062
|
args: "",
|
|
2057
|
-
messageKey:
|
|
2058
|
-
}),
|
|
2063
|
+
messageKey: ke.toString()
|
|
2064
|
+
}), L({
|
|
2059
2065
|
phase: "tool_call_started",
|
|
2060
|
-
id:
|
|
2061
|
-
name:
|
|
2062
|
-
rawArgs: typeof
|
|
2066
|
+
id: c.id,
|
|
2067
|
+
name: c.name,
|
|
2068
|
+
rawArgs: typeof c.args == "string" ? c.args : "",
|
|
2063
2069
|
state: "start"
|
|
2064
2070
|
}), console.log("📝 阶段1 - 工具调用开始:", {
|
|
2065
|
-
messageId:
|
|
2066
|
-
index:
|
|
2067
|
-
toolCallId:
|
|
2068
|
-
name:
|
|
2069
|
-
msgIndex:
|
|
2071
|
+
messageId: we,
|
|
2072
|
+
index: re,
|
|
2073
|
+
toolCallId: c.id,
|
|
2074
|
+
name: c.name,
|
|
2075
|
+
msgIndex: ke
|
|
2070
2076
|
});
|
|
2071
2077
|
}
|
|
2072
2078
|
}
|
|
2073
|
-
if (
|
|
2074
|
-
for (const
|
|
2075
|
-
const
|
|
2076
|
-
if (
|
|
2077
|
-
const
|
|
2078
|
-
let
|
|
2079
|
-
if (
|
|
2080
|
-
|
|
2079
|
+
if (qe)
|
|
2080
|
+
for (const c of V.tool_call_chunks) {
|
|
2081
|
+
const re = c.index;
|
|
2082
|
+
if (re === void 0) continue;
|
|
2083
|
+
const ue = `${we}_${re}`;
|
|
2084
|
+
let X = ne.get(ue);
|
|
2085
|
+
if (X)
|
|
2086
|
+
c.args && c.args.trim() && (X.args = (X.args || "") + c.args, X.messageKey && U(X.messageKey, { args: X.args, state: "running" }), L({
|
|
2081
2087
|
phase: "tool_args_streaming",
|
|
2082
|
-
id:
|
|
2083
|
-
name:
|
|
2084
|
-
rawArgs:
|
|
2088
|
+
id: X.id || c.id || "",
|
|
2089
|
+
name: X.name || c.name || "",
|
|
2090
|
+
rawArgs: X.args,
|
|
2085
2091
|
state: "running"
|
|
2086
|
-
})),
|
|
2087
|
-
messageId:
|
|
2088
|
-
index:
|
|
2089
|
-
newArgs:
|
|
2090
|
-
accumulatedArgs:
|
|
2092
|
+
})), c.id && !X.id && (X.id = c.id), c.name && (X.name = c.name), console.log("📝 阶段2 - args 流式累加:", {
|
|
2093
|
+
messageId: we,
|
|
2094
|
+
index: re,
|
|
2095
|
+
newArgs: c.args,
|
|
2096
|
+
accumulatedArgs: X.args
|
|
2091
2097
|
});
|
|
2092
2098
|
else {
|
|
2093
|
-
const
|
|
2094
|
-
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
id:
|
|
2098
|
-
name:
|
|
2099
|
-
args:
|
|
2100
|
-
messageKey:
|
|
2101
|
-
}),
|
|
2099
|
+
const ae = w(c.id || "", c.name || "", c.args || "", "running");
|
|
2100
|
+
k.value.push(ae);
|
|
2101
|
+
const ke = k.value.length - 1;
|
|
2102
|
+
ne.set(ue, {
|
|
2103
|
+
id: c.id || "",
|
|
2104
|
+
name: c.name || "",
|
|
2105
|
+
args: c.args || "",
|
|
2106
|
+
messageKey: ke.toString()
|
|
2107
|
+
}), L({
|
|
2102
2108
|
phase: "tool_args_streaming",
|
|
2103
|
-
id:
|
|
2104
|
-
name:
|
|
2105
|
-
rawArgs:
|
|
2109
|
+
id: c.id || "",
|
|
2110
|
+
name: c.name || "",
|
|
2111
|
+
rawArgs: c.args || "",
|
|
2106
2112
|
state: "running"
|
|
2107
2113
|
}), console.log("📝 阶段1 - 工具调用开始:", {
|
|
2108
|
-
messageId:
|
|
2109
|
-
index:
|
|
2110
|
-
toolCallId:
|
|
2111
|
-
name:
|
|
2112
|
-
msgIndex:
|
|
2114
|
+
messageId: we,
|
|
2115
|
+
index: re,
|
|
2116
|
+
toolCallId: c.id || "(暂无)",
|
|
2117
|
+
name: c.name || "(暂无)",
|
|
2118
|
+
msgIndex: ke
|
|
2113
2119
|
});
|
|
2114
2120
|
}
|
|
2115
2121
|
}
|
|
2116
2122
|
}
|
|
2117
|
-
let
|
|
2118
|
-
if (typeof
|
|
2119
|
-
for (let
|
|
2123
|
+
let Ae = "";
|
|
2124
|
+
if (typeof V.content == "string" ? Ae = V.content : Array.isArray(V.content) && (Ae = V.content.filter((c) => c.type === "text").map((c) => c.text).join("")), fe) {
|
|
2125
|
+
for (let re = k.value.length - 1; re >= 0 && k.value[re].type !== "ai"; re--)
|
|
2120
2126
|
;
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2123
|
-
key:
|
|
2127
|
+
const c = `ai-${Date.now()}`;
|
|
2128
|
+
k.value.push({
|
|
2129
|
+
key: c,
|
|
2124
2130
|
type: "ai",
|
|
2125
2131
|
content: "",
|
|
2126
|
-
batchId:
|
|
2127
|
-
}),
|
|
2132
|
+
batchId: y.value
|
|
2133
|
+
}), te = "", fe = !1;
|
|
2128
2134
|
}
|
|
2129
|
-
|
|
2135
|
+
Ae !== void 0 && (te += Ae);
|
|
2130
2136
|
let Se = -1;
|
|
2131
|
-
for (let
|
|
2132
|
-
if (
|
|
2133
|
-
Se =
|
|
2137
|
+
for (let c = k.value.length - 1; c >= 0; c--)
|
|
2138
|
+
if (k.value[c].type === "ai") {
|
|
2139
|
+
Se = c;
|
|
2134
2140
|
break;
|
|
2135
2141
|
}
|
|
2136
|
-
Se >= 0 && (
|
|
2142
|
+
Se >= 0 && (k.value[Se].content = te, k.value[Se].batchId = y.value);
|
|
2137
2143
|
}
|
|
2138
2144
|
}
|
|
2139
2145
|
}
|
|
2140
|
-
const
|
|
2141
|
-
|
|
2142
|
-
} catch (
|
|
2143
|
-
console.error("Error sending message:",
|
|
2144
|
-
let
|
|
2145
|
-
if (
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2146
|
+
const He = k.value.length - 1;
|
|
2147
|
+
He >= 0 && (k.value[He].batchId = y.value), $.value = "ready";
|
|
2148
|
+
} catch (w) {
|
|
2149
|
+
console.error("Error sending message:", w);
|
|
2150
|
+
let U = "抱歉,发生了一些错误,请稍后重试。";
|
|
2151
|
+
if (w) {
|
|
2152
|
+
const J = w.message || ((x = w.error) == null ? void 0 : x.message) || String(w), te = ((z = w.error) == null ? void 0 : z.error) || w.name || "APIError";
|
|
2153
|
+
J && J !== "[object Object]" && (te === "APIError" && J.includes("internal error") ? U = "服务内部错误,请稍后重试。" : J.includes("timeout") || J.includes("Timeout") ? U = "请求超时,请稍后重试。" : J.includes("network") || J.includes("Network") ? U = "网络连接失败,请检查网络后重试。" : J.includes("401") || J.includes("unauthorized") ? U = "认证失败,请重新登录。" : J.includes("403") || J.includes("forbidden") ? U = "没有权限执行此操作。" : J.includes("429") || J.includes("rate limit") ? U = "请求过于频繁,请稍后再试。" : U = `抱歉,发生错误: ${J}`);
|
|
2148
2154
|
}
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
...
|
|
2155
|
+
const ce = `error-${Date.now()}`;
|
|
2156
|
+
k.value = [
|
|
2157
|
+
...k.value,
|
|
2152
2158
|
{
|
|
2153
|
-
key:
|
|
2159
|
+
key: ce,
|
|
2154
2160
|
type: "ai",
|
|
2155
|
-
content:
|
|
2156
|
-
batchId:
|
|
2161
|
+
content: U,
|
|
2162
|
+
batchId: ce
|
|
2157
2163
|
}
|
|
2158
|
-
],
|
|
2164
|
+
], $.value = "ready";
|
|
2159
2165
|
}
|
|
2160
2166
|
}
|
|
2161
|
-
function
|
|
2162
|
-
var
|
|
2163
|
-
const O = !!
|
|
2164
|
-
if (!O && !
|
|
2167
|
+
function u(g) {
|
|
2168
|
+
var he, f;
|
|
2169
|
+
const O = !!g.text, H = ((he = g.files) == null ? void 0 : he.length) > 0;
|
|
2170
|
+
if (!O && !H)
|
|
2165
2171
|
return;
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2172
|
+
const xe = ((f = g.text) == null ? void 0 : f.trim()) || "";
|
|
2173
|
+
K(xe || "仅发送了附件", g.files || []);
|
|
2168
2174
|
}
|
|
2169
|
-
async function
|
|
2170
|
-
if (console.log("🛑 点击停止按钮:", { threadId:
|
|
2175
|
+
async function m() {
|
|
2176
|
+
if (console.log("🛑 点击停止按钮:", { threadId: l.value, runId: y.value }), l.value && y.value)
|
|
2171
2177
|
try {
|
|
2172
|
-
console.log("📡 发送 cancel 请求..."), await
|
|
2173
|
-
} catch (
|
|
2174
|
-
console.error("❌ cancel 请求失败:",
|
|
2178
|
+
console.log("📡 发送 cancel 请求..."), await d.runs.cancel(l.value, y.value), console.log("✅ cancel 请求成功"), $.value = "ready";
|
|
2179
|
+
} catch (g) {
|
|
2180
|
+
console.error("❌ cancel 请求失败:", g), $.value = "ready";
|
|
2175
2181
|
}
|
|
2176
2182
|
else
|
|
2177
|
-
console.log("⚠️ 缺少 threadId 或 runId,直接重置状态"),
|
|
2183
|
+
console.log("⚠️ 缺少 threadId 或 runId,直接重置状态"), $.value = "ready";
|
|
2178
2184
|
}
|
|
2179
|
-
function
|
|
2180
|
-
|
|
2185
|
+
function v(g) {
|
|
2186
|
+
K(g);
|
|
2181
2187
|
}
|
|
2182
|
-
const
|
|
2183
|
-
function
|
|
2184
|
-
|
|
2188
|
+
const se = s;
|
|
2189
|
+
function me() {
|
|
2190
|
+
se("close");
|
|
2185
2191
|
}
|
|
2186
|
-
function
|
|
2187
|
-
if ((
|
|
2188
|
-
|
|
2192
|
+
function be(g) {
|
|
2193
|
+
if ((g == null ? void 0 : g.type) === "suggested_questions" && Array.isArray(g == null ? void 0 : g.content)) {
|
|
2194
|
+
q.value = g.content, console.log("📝 更新建议问题:", g.content);
|
|
2189
2195
|
return;
|
|
2190
2196
|
}
|
|
2191
|
-
console.log("Custom event received:",
|
|
2197
|
+
console.log("Custom event received:", g);
|
|
2192
2198
|
}
|
|
2193
|
-
return (
|
|
2199
|
+
return e({
|
|
2200
|
+
setTextInput: (g) => {
|
|
2201
|
+
var O;
|
|
2202
|
+
(O = n.value) == null || O.setTextInput(g);
|
|
2203
|
+
},
|
|
2204
|
+
addAttachments: (g) => {
|
|
2205
|
+
var O;
|
|
2206
|
+
(O = n.value) == null || O.addAttachments(g);
|
|
2207
|
+
},
|
|
2208
|
+
sendMessage: async () => {
|
|
2209
|
+
var g;
|
|
2210
|
+
await ((g = n.value) == null ? void 0 : g.sendMessage());
|
|
2211
|
+
}
|
|
2212
|
+
}), (g, O) => (r(), h("div", {
|
|
2194
2213
|
class: "chat-bot",
|
|
2195
|
-
"data-ai-theme":
|
|
2214
|
+
"data-ai-theme": o.theme
|
|
2196
2215
|
}, [
|
|
2197
|
-
|
|
2216
|
+
b("div", {
|
|
2198
2217
|
ref_key: "portalHost",
|
|
2199
|
-
ref:
|
|
2218
|
+
ref: p,
|
|
2200
2219
|
class: "chat-bot-portal-host"
|
|
2201
2220
|
}, null, 512),
|
|
2202
|
-
|
|
2203
|
-
class:
|
|
2221
|
+
b("div", {
|
|
2222
|
+
class: Z(["chat-window", { maximized: i.value }])
|
|
2204
2223
|
}, [
|
|
2205
|
-
|
|
2206
|
-
title:
|
|
2224
|
+
T(zs, {
|
|
2225
|
+
title: t.assistantName,
|
|
2207
2226
|
"is-maximized": i.value,
|
|
2208
|
-
"show-header-actions":
|
|
2209
|
-
onClose:
|
|
2210
|
-
onToggleMaximize:
|
|
2227
|
+
"show-header-actions": t.showHeaderActions,
|
|
2228
|
+
onClose: me,
|
|
2229
|
+
onToggleMaximize: Q
|
|
2211
2230
|
}, null, 8, ["title", "is-maximized", "show-header-actions"]),
|
|
2212
|
-
!
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
O[3] || (O[3] =
|
|
2216
|
-
|
|
2217
|
-
O[4] || (O[4] =
|
|
2231
|
+
!E.value && k.value.length === 0 ? (r(), h("div", on, [
|
|
2232
|
+
W(g.$slots, "empty", { sendMessage: K }, () => [
|
|
2233
|
+
b("div", rn, [
|
|
2234
|
+
O[3] || (O[3] = b("div", { class: "default-empty-badge" }, "AI", -1)),
|
|
2235
|
+
b("h2", ln, "欢迎使用 " + Y(t.assistantName), 1),
|
|
2236
|
+
O[4] || (O[4] = b("p", { class: "default-empty-desc" }, "请输入你的问题,开始一段新的对话。", -1))
|
|
2218
2237
|
])
|
|
2219
2238
|
], !0)
|
|
2220
|
-
])) : (
|
|
2239
|
+
])) : (r(), C(Vs, {
|
|
2221
2240
|
key: 1,
|
|
2222
|
-
messages:
|
|
2223
|
-
"is-streaming":
|
|
2224
|
-
theme:
|
|
2241
|
+
messages: k.value,
|
|
2242
|
+
"is-streaming": $.value === "streaming",
|
|
2243
|
+
theme: o.theme
|
|
2225
2244
|
}, {
|
|
2226
|
-
custom:
|
|
2227
|
-
|
|
2228
|
-
customContent:
|
|
2229
|
-
threadId:
|
|
2245
|
+
custom: A(({ customContent: H }) => [
|
|
2246
|
+
W(g.$slots, "custom", {
|
|
2247
|
+
customContent: H,
|
|
2248
|
+
threadId: l.value
|
|
2230
2249
|
}, () => [
|
|
2231
|
-
(
|
|
2250
|
+
(H == null ? void 0 : H.type) === "generated_files" ? (r(), C(Na, {
|
|
2232
2251
|
key: 0,
|
|
2233
|
-
"custom-content":
|
|
2234
|
-
"api-url":
|
|
2235
|
-
"thread-id":
|
|
2236
|
-
}, null, 8, ["custom-content", "api-url", "thread-id"])) :
|
|
2252
|
+
"custom-content": H,
|
|
2253
|
+
"api-url": o.apiUrl,
|
|
2254
|
+
"thread-id": l.value
|
|
2255
|
+
}, null, 8, ["custom-content", "api-url", "thread-id"])) : G("", !0)
|
|
2237
2256
|
], !0)
|
|
2238
2257
|
]),
|
|
2239
2258
|
_: 3
|
|
2240
2259
|
}, 8, ["messages", "is-streaming", "theme"])),
|
|
2241
|
-
|
|
2242
|
-
"initial-todos":
|
|
2243
|
-
"tool-events":
|
|
2244
|
-
"chat-status":
|
|
2260
|
+
T(an, {
|
|
2261
|
+
"initial-todos": oe.value,
|
|
2262
|
+
"tool-events": I.value,
|
|
2263
|
+
"chat-status": $.value
|
|
2245
2264
|
}, null, 8, ["initial-todos", "tool-events", "chat-status"]),
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
"
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2265
|
+
T(Ra, {
|
|
2266
|
+
ref_key: "chatInputRef",
|
|
2267
|
+
ref: n,
|
|
2268
|
+
status: $.value,
|
|
2269
|
+
"current-model": ee.value,
|
|
2270
|
+
models: F.value,
|
|
2271
|
+
suggestions: q.value,
|
|
2272
|
+
"use-web-search": R.value,
|
|
2273
|
+
modelSelectorOpen: M.value,
|
|
2274
|
+
"onUpdate:modelSelectorOpen": O[0] || (O[0] = (H) => M.value = H),
|
|
2275
|
+
onSubmit: u,
|
|
2276
|
+
onStop: m,
|
|
2277
|
+
onSelectSuggestion: v,
|
|
2278
|
+
"onUpdate:currentModel": O[1] || (O[1] = (H) => ee.value = H),
|
|
2279
|
+
"onUpdate:useWebSearch": O[2] || (O[2] = (H) => R.value = H)
|
|
2259
2280
|
}, {
|
|
2260
|
-
"attachment-trigger":
|
|
2261
|
-
|
|
2281
|
+
"attachment-trigger": A((H) => [
|
|
2282
|
+
W(g.$slots, "attachment-trigger", $e(Ce(H)), void 0, !0)
|
|
2262
2283
|
]),
|
|
2263
2284
|
_: 3
|
|
2264
2285
|
}, 8, ["status", "current-model", "models", "suggestions", "use-web-search", "modelSelectorOpen"]),
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
])) :
|
|
2286
|
+
E.value ? (r(), h("div", un, [
|
|
2287
|
+
T(a(Ua), { size: 24 })
|
|
2288
|
+
])) : G("", !0)
|
|
2268
2289
|
], 2)
|
|
2269
|
-
], 8,
|
|
2290
|
+
], 8, nn));
|
|
2270
2291
|
}
|
|
2271
|
-
}),
|
|
2292
|
+
}), dn = /* @__PURE__ */ pe(cn, [["__scopeId", "data-v-fdb3cbee"]]), pn = { class: "icon-wrapper" }, mn = /* @__PURE__ */ P({
|
|
2272
2293
|
__name: "FloatButton",
|
|
2273
2294
|
props: {
|
|
2274
2295
|
isExpanded: { type: Boolean }
|
|
2275
2296
|
},
|
|
2276
2297
|
emits: ["toggle"],
|
|
2277
|
-
setup(
|
|
2278
|
-
const
|
|
2279
|
-
return (
|
|
2280
|
-
class:
|
|
2281
|
-
onClick:
|
|
2298
|
+
setup(t, { emit: e }) {
|
|
2299
|
+
const s = e;
|
|
2300
|
+
return (n, o) => (r(), h("button", {
|
|
2301
|
+
class: Z(["float-button", { expanded: t.isExpanded }]),
|
|
2302
|
+
onClick: o[0] || (o[0] = (d) => s("toggle")),
|
|
2282
2303
|
type: "button"
|
|
2283
2304
|
}, [
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2305
|
+
b("span", pn, [
|
|
2306
|
+
T(a(ss), { class: "icon-svg" }),
|
|
2307
|
+
T(a(as), {
|
|
2287
2308
|
size: 16,
|
|
2288
2309
|
"stroke-width": 2,
|
|
2289
2310
|
absoluteStrokeWidth: "",
|
|
@@ -2292,7 +2313,7 @@ const Fs = /* @__PURE__ */ S({
|
|
|
2292
2313
|
])
|
|
2293
2314
|
], 2));
|
|
2294
2315
|
}
|
|
2295
|
-
}),
|
|
2316
|
+
}), fn = /* @__PURE__ */ pe(mn, [["__scopeId", "data-v-4f20ed22"]]), gn = ["data-ai-theme"], vn = /* @__PURE__ */ P({
|
|
2296
2317
|
__name: "AskAiBot",
|
|
2297
2318
|
props: {
|
|
2298
2319
|
assistantId: { default: "research" },
|
|
@@ -2308,82 +2329,100 @@ const Fs = /* @__PURE__ */ S({
|
|
|
2308
2329
|
height: { default: "calc(100vh - 90px)" },
|
|
2309
2330
|
theme: { default: "light" }
|
|
2310
2331
|
},
|
|
2311
|
-
setup(
|
|
2312
|
-
const
|
|
2313
|
-
function
|
|
2314
|
-
|
|
2332
|
+
setup(t, { expose: e }) {
|
|
2333
|
+
const s = S(null), n = t, o = S(n.defaultExpanded), d = S(!1), i = S(typeof n.width == "number" ? n.width : 500), l = S(!1);
|
|
2334
|
+
function p() {
|
|
2335
|
+
o.value = !o.value, o.value || (d.value = !1);
|
|
2336
|
+
}
|
|
2337
|
+
function $(I) {
|
|
2338
|
+
d.value = I;
|
|
2315
2339
|
}
|
|
2316
|
-
function
|
|
2317
|
-
|
|
2340
|
+
function y(I) {
|
|
2341
|
+
I.preventDefault(), l.value = !0, document.addEventListener("mousemove", R), document.addEventListener("mouseup", M);
|
|
2318
2342
|
}
|
|
2319
|
-
function
|
|
2320
|
-
|
|
2343
|
+
function R(I) {
|
|
2344
|
+
if (!l.value) return;
|
|
2345
|
+
const j = window.innerWidth - I.clientX - 20;
|
|
2346
|
+
i.value = Math.max(300, Math.min(1400, j));
|
|
2321
2347
|
}
|
|
2322
|
-
function
|
|
2323
|
-
|
|
2324
|
-
const f = window.innerWidth - A.clientX - 20;
|
|
2325
|
-
i.value = Math.max(300, Math.min(1400, f));
|
|
2348
|
+
function M() {
|
|
2349
|
+
l.value = !1, document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", M);
|
|
2326
2350
|
}
|
|
2327
|
-
function
|
|
2328
|
-
|
|
2351
|
+
async function E() {
|
|
2352
|
+
o.value || (o.value = !0, await rt());
|
|
2329
2353
|
}
|
|
2330
|
-
return (
|
|
2354
|
+
return e({
|
|
2355
|
+
setTextInput: (I) => {
|
|
2356
|
+
var j;
|
|
2357
|
+
(j = s.value) == null || j.setTextInput(I);
|
|
2358
|
+
},
|
|
2359
|
+
addAttachments: (I) => {
|
|
2360
|
+
var j;
|
|
2361
|
+
(j = s.value) == null || j.addAttachments(I);
|
|
2362
|
+
},
|
|
2363
|
+
sendMessage: async () => {
|
|
2364
|
+
var I;
|
|
2365
|
+
await E(), await ((I = s.value) == null ? void 0 : I.sendMessage());
|
|
2366
|
+
}
|
|
2367
|
+
}), (I, j) => (r(), h("div", {
|
|
2331
2368
|
class: "ask-ai-bot",
|
|
2332
|
-
"data-ai-theme":
|
|
2369
|
+
"data-ai-theme": n.theme
|
|
2333
2370
|
}, [
|
|
2334
|
-
|
|
2335
|
-
default:
|
|
2336
|
-
|
|
2337
|
-
class:
|
|
2338
|
-
style:
|
|
2339
|
-
width: typeof
|
|
2340
|
-
height: typeof
|
|
2371
|
+
T(ot, { name: "slide-up" }, {
|
|
2372
|
+
default: A(() => [
|
|
2373
|
+
Ie(b("div", {
|
|
2374
|
+
class: Z(["chat-window-container", { maximized: d.value }]),
|
|
2375
|
+
style: it(d.value ? {} : {
|
|
2376
|
+
width: typeof n.width == "number" ? `${i.value}px` : n.width,
|
|
2377
|
+
height: typeof n.height == "number" ? `${n.height}px` : n.height
|
|
2341
2378
|
})
|
|
2342
2379
|
}, [
|
|
2343
|
-
|
|
2344
|
-
"
|
|
2345
|
-
|
|
2346
|
-
"
|
|
2347
|
-
"
|
|
2348
|
-
"
|
|
2349
|
-
"
|
|
2350
|
-
"
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2380
|
+
T(dn, {
|
|
2381
|
+
ref_key: "chatBotRef",
|
|
2382
|
+
ref: s,
|
|
2383
|
+
"api-url": t.apiUrl,
|
|
2384
|
+
"api-key": t.apiKey,
|
|
2385
|
+
"assistant-id": t.assistantId,
|
|
2386
|
+
"assistant-name": t.assistantName,
|
|
2387
|
+
"system-prompt": t.systemPrompt,
|
|
2388
|
+
"thread-id": t.threadId,
|
|
2389
|
+
"user-id": t.userId,
|
|
2390
|
+
suggestions: t.suggestions,
|
|
2391
|
+
theme: n.theme,
|
|
2392
|
+
onClose: p,
|
|
2393
|
+
"onUpdate:isMaximized": $
|
|
2355
2394
|
}, {
|
|
2356
|
-
empty:
|
|
2357
|
-
|
|
2395
|
+
empty: A((L) => [
|
|
2396
|
+
W(I.$slots, "empty", $e(Ce(L)), void 0, !0)
|
|
2358
2397
|
]),
|
|
2359
|
-
custom:
|
|
2360
|
-
|
|
2398
|
+
custom: A((L) => [
|
|
2399
|
+
W(I.$slots, "custom", $e(Ce(L)), void 0, !0)
|
|
2361
2400
|
]),
|
|
2362
|
-
"attachment-trigger":
|
|
2363
|
-
|
|
2401
|
+
"attachment-trigger": A((L) => [
|
|
2402
|
+
W(I.$slots, "attachment-trigger", $e(Ce(L)), void 0, !0)
|
|
2364
2403
|
]),
|
|
2365
2404
|
_: 3
|
|
2366
2405
|
}, 8, ["api-url", "api-key", "assistant-id", "assistant-name", "system-prompt", "thread-id", "user-id", "suggestions", "theme"]),
|
|
2367
|
-
|
|
2406
|
+
d.value ? G("", !0) : (r(), h("div", {
|
|
2368
2407
|
key: 0,
|
|
2369
2408
|
class: "resize-handle",
|
|
2370
|
-
onMousedown:
|
|
2409
|
+
onMousedown: y
|
|
2371
2410
|
}, null, 32))
|
|
2372
2411
|
], 6), [
|
|
2373
|
-
[
|
|
2412
|
+
[Pe, o.value]
|
|
2374
2413
|
])
|
|
2375
2414
|
]),
|
|
2376
2415
|
_: 3
|
|
2377
2416
|
}),
|
|
2378
|
-
|
|
2379
|
-
"is-expanded":
|
|
2380
|
-
onToggle:
|
|
2417
|
+
T(fn, {
|
|
2418
|
+
"is-expanded": o.value,
|
|
2419
|
+
onToggle: p
|
|
2381
2420
|
}, null, 8, ["is-expanded"])
|
|
2382
|
-
], 8,
|
|
2421
|
+
], 8, gn));
|
|
2383
2422
|
}
|
|
2384
|
-
}),
|
|
2423
|
+
}), Mn = /* @__PURE__ */ pe(vn, [["__scopeId", "data-v-ac4bed37"]]);
|
|
2385
2424
|
export {
|
|
2386
|
-
|
|
2387
|
-
|
|
2425
|
+
Mn as AskAiBot,
|
|
2426
|
+
dn as ChatBot
|
|
2388
2427
|
};
|
|
2389
2428
|
//# sourceMappingURL=index.js.map
|