@opentiny/tiny-robot-chat 0.5.2-alpha.8 → 0.5.2-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +36 -7
- package/dist/index.js +1573 -1492
- package/dist/style.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useScroll as
|
|
3
|
-
import { TrIconButton as ae, TrHistory as
|
|
4
|
-
import { IconArrowDown as
|
|
5
|
-
import { sseStreamToGenerator as
|
|
6
|
-
import { Client as
|
|
7
|
-
import { StreamableHTTPClientTransport as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as Z, shallowRef as K, computed as h, watch as ue, onUnmounted as tt, openBlock as P, createBlock as W, unref as p, createCommentVNode as U, ref as ge, toValue as z, createElementBlock as F, createElementVNode as B, resolveDynamicComponent as we, normalizeClass as _, createVNode as D, renderSlot as C, toDisplayString as H, createTextVNode as Be, mergeProps as N, Fragment as Se, renderList as nt, withCtx as S, createSlots as J, normalizeProps as q, guardReactiveProps as j, h as he, nextTick as ot, useSlots as st, watchEffect as at, reactive as lt } from "vue";
|
|
2
|
+
import { useScroll as rt, useEventListener as it, useResizeObserver as dt, useMutationObserver as ut, useBreakpoints as ct, useWindowSize as ft } from "@vueuse/core";
|
|
3
|
+
import { TrIconButton as ae, TrHistory as vt, TrDropdownMenu as mt, TrSender as bt, TrLayout as pe, BubbleRenderers as gt, useAutoScroll as ht, TrWelcome as Pe, TrPrompts as Le, TrBubbleProvider as pt, TrBubbleList as yt, TrMcpServerPicker as At } from "@opentiny/tiny-robot";
|
|
4
|
+
import { IconArrowDown as Ct, IconAi as le, IconCollapseLeft as ye, IconNewSession as Ae, IconCollapseRight as Ue, IconPlugin as wt, IconSearch as St, IconThink as kt, IconAtom as Et, IconUser as Ot, IconClose as Rt } from "@opentiny/tiny-robot-svgs";
|
|
5
|
+
import { sseStreamToGenerator as Tt, toolPlugin as Mt, useConversation as Pt } from "@opentiny/tiny-robot-kit";
|
|
6
|
+
import { Client as Lt } from "@modelcontextprotocol/sdk/client";
|
|
7
|
+
import { StreamableHTTPClientTransport as $t } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
|
+
const It = /* @__PURE__ */ Z({
|
|
9
9
|
__name: "ScrollToBottom",
|
|
10
10
|
props: {
|
|
11
11
|
target: {}
|
|
12
12
|
},
|
|
13
13
|
setup(e) {
|
|
14
|
-
const t = e,
|
|
14
|
+
const t = e, o = K(0), { y: n, measure: c } = rt(() => t.target, {
|
|
15
15
|
behavior: "smooth",
|
|
16
16
|
observe: !0
|
|
17
|
-
}),
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
|
|
17
|
+
}), v = h(() => o.value > 80);
|
|
18
|
+
function b() {
|
|
19
|
+
const y = t.target;
|
|
20
|
+
o.value = y ? y.scrollHeight - y.clientHeight - y.scrollTop : 0;
|
|
21
21
|
}
|
|
22
22
|
let a;
|
|
23
|
-
function
|
|
23
|
+
function r() {
|
|
24
24
|
a === void 0 && (a = requestAnimationFrame(() => {
|
|
25
|
-
a = void 0,
|
|
25
|
+
a = void 0, b();
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
it(() => t.target, "scroll", r), dt(() => t.target, r), ut(() => t.target, r, { childList: !0, subtree: !0 }), ue(
|
|
29
29
|
() => t.target,
|
|
30
|
-
() =>
|
|
30
|
+
() => r(),
|
|
31
31
|
{ immediate: !0 }
|
|
32
|
-
),
|
|
32
|
+
), tt(() => {
|
|
33
33
|
a !== void 0 && cancelAnimationFrame(a);
|
|
34
34
|
});
|
|
35
|
-
function
|
|
36
|
-
var
|
|
37
|
-
|
|
35
|
+
function u() {
|
|
36
|
+
var y;
|
|
37
|
+
c(), n.value = ((y = t.target) == null ? void 0 : y.scrollHeight) ?? 0;
|
|
38
38
|
}
|
|
39
|
-
return (
|
|
39
|
+
return (y, f) => v.value ? (P(), W(p(ae), {
|
|
40
40
|
key: 0,
|
|
41
41
|
class: "tr-chat-scroll-to-bottom",
|
|
42
|
-
icon:
|
|
42
|
+
icon: p(Ct),
|
|
43
43
|
rounded: "",
|
|
44
44
|
size: "36",
|
|
45
45
|
"svg-size": "18",
|
|
46
46
|
type: "button",
|
|
47
47
|
"aria-label": "滚动到底部",
|
|
48
|
-
onClick:
|
|
49
|
-
}, null, 8, ["icon"])) :
|
|
48
|
+
onClick: u
|
|
49
|
+
}, null, 8, ["icon"])) : U("", !0);
|
|
50
50
|
}
|
|
51
51
|
}), Y = (e, t) => {
|
|
52
|
-
const
|
|
53
|
-
for (const [
|
|
54
|
-
n
|
|
55
|
-
return
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
const t =
|
|
52
|
+
const o = e.__vccOpts || e;
|
|
53
|
+
for (const [n, c] of t)
|
|
54
|
+
o[n] = c;
|
|
55
|
+
return o;
|
|
56
|
+
}, Vt = /* @__PURE__ */ Y(It, [["__scopeId", "data-v-ab8c6a28"]]);
|
|
57
|
+
function Bt(e) {
|
|
58
|
+
const t = ge([]), o = /* @__PURE__ */ new Map();
|
|
59
59
|
return ue(
|
|
60
|
-
() => [
|
|
61
|
-
([
|
|
62
|
-
const
|
|
63
|
-
for (const a of
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
for (const
|
|
67
|
-
|
|
68
|
-
Object.assign(
|
|
60
|
+
() => [z(e.conversations), z(e.defaultTitle)],
|
|
61
|
+
([n, c]) => {
|
|
62
|
+
const v = /* @__PURE__ */ new Set(), b = [];
|
|
63
|
+
for (const a of n ?? []) {
|
|
64
|
+
v.add(a.id);
|
|
65
|
+
const u = o.get(a.id) ?? { id: a.id, title: a.title || c, raw: a };
|
|
66
|
+
for (const y of Object.keys(u))
|
|
67
|
+
y !== "raw" && !(y in a) && delete u[y];
|
|
68
|
+
Object.assign(u, a, {
|
|
69
69
|
id: a.id,
|
|
70
|
-
title: a.title ||
|
|
70
|
+
title: a.title || c,
|
|
71
71
|
raw: a
|
|
72
|
-
}),
|
|
72
|
+
}), o.set(a.id, u), b.push(u);
|
|
73
73
|
}
|
|
74
|
-
for (const a of
|
|
75
|
-
|
|
76
|
-
t.value =
|
|
74
|
+
for (const a of o.keys())
|
|
75
|
+
v.has(a) || o.delete(a);
|
|
76
|
+
t.value = b;
|
|
77
77
|
},
|
|
78
78
|
{ immediate: !0, deep: !0 }
|
|
79
79
|
), t;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Ut = { class: "chat-left-aside" }, Ft = ["aria-label"], Wt = { class: "chat-left-aside-brand" }, Dt = { class: "chat-left-aside-brand__title" }, qt = { class: "chat-left-aside-action__label" }, Kt = /* @__PURE__ */ Z({
|
|
82
82
|
__name: "ChatLeftAside",
|
|
83
83
|
props: {
|
|
84
84
|
conversation: {},
|
|
@@ -91,232 +91,157 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
91
91
|
},
|
|
92
92
|
emits: ["createConversation", "switchConversation", "renameConversation", "deleteConversation", "historyAction", "open", "close", "toggle"],
|
|
93
93
|
setup(e, { emit: t }) {
|
|
94
|
-
const
|
|
95
|
-
conversations: () =>
|
|
96
|
-
defaultTitle: () =>
|
|
97
|
-
}),
|
|
98
|
-
const { menuItems:
|
|
99
|
-
return
|
|
100
|
-
}),
|
|
94
|
+
const o = e, n = t, c = Bt({
|
|
95
|
+
conversations: () => o.conversation.items,
|
|
96
|
+
defaultTitle: () => o.labels.newConversationTitle
|
|
97
|
+
}), v = h(() => {
|
|
98
|
+
const { menuItems: d, ...s } = o.history;
|
|
99
|
+
return s;
|
|
100
|
+
}), b = h(() => o.history.menuItems ?? []);
|
|
101
101
|
function a() {
|
|
102
|
-
|
|
102
|
+
n("createConversation");
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
104
|
+
function r(d) {
|
|
105
|
+
n("switchConversation", d.raw);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
107
|
+
function u(d, s) {
|
|
108
|
+
n("renameConversation", s.raw, d);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
110
|
+
function y(d, s) {
|
|
111
|
+
n("historyAction", d, s.raw);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
113
|
+
function f(d) {
|
|
114
|
+
return o.conversation.items.find((s) => s.id === d) ?? { id: d, title: o.labels.newConversationTitle };
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
116
|
+
function m(d) {
|
|
117
|
+
n("switchConversation", f(d));
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
119
|
+
function k(d, s) {
|
|
120
|
+
n("renameConversation", f(d), s);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
122
|
+
function T(d) {
|
|
123
|
+
n("deleteConversation", f(d));
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
125
|
+
function E() {
|
|
126
|
+
n("open");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
128
|
+
function R() {
|
|
129
|
+
n("close");
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
131
|
+
function I() {
|
|
132
|
+
n("toggle");
|
|
133
133
|
}
|
|
134
|
-
return (
|
|
135
|
-
|
|
134
|
+
return (d, s) => (P(), F("aside", Ut, [
|
|
135
|
+
B("span", {
|
|
136
136
|
class: "chat-left-aside-logo",
|
|
137
137
|
"aria-label": e.brand.name || e.labels.newConversationTitle
|
|
138
138
|
}, [
|
|
139
|
-
(
|
|
140
|
-
], 8,
|
|
141
|
-
|
|
142
|
-
class:
|
|
139
|
+
(P(), W(we(e.brand.logo || p(le))))
|
|
140
|
+
], 8, Ft),
|
|
141
|
+
B("div", {
|
|
142
|
+
class: _(["chat-left-aside-rail", { "is-hidden": !e.isDock || e.isOpen }])
|
|
143
143
|
}, [
|
|
144
|
-
|
|
144
|
+
D(p(ae), {
|
|
145
145
|
class: "chat-left-aside-rail__button",
|
|
146
|
-
icon:
|
|
146
|
+
icon: p(ye),
|
|
147
147
|
size: "32",
|
|
148
148
|
"svg-size": "20",
|
|
149
149
|
"aria-label": e.labels.expandConversationList,
|
|
150
|
-
onClick:
|
|
150
|
+
onClick: E
|
|
151
151
|
}, null, 8, ["icon", "aria-label"]),
|
|
152
|
-
|
|
152
|
+
D(p(ae), {
|
|
153
153
|
class: "chat-left-aside-rail__button",
|
|
154
|
-
icon:
|
|
154
|
+
icon: p(Ae),
|
|
155
155
|
size: "32",
|
|
156
156
|
"svg-size": "20",
|
|
157
157
|
"aria-label": e.labels.createConversation,
|
|
158
158
|
onClick: a
|
|
159
159
|
}, null, 8, ["icon", "aria-label"])
|
|
160
160
|
], 2),
|
|
161
|
-
|
|
162
|
-
class:
|
|
161
|
+
B("div", {
|
|
162
|
+
class: _(["chat-left-aside-panel", { "is-hidden": !e.isOpen }])
|
|
163
163
|
}, [
|
|
164
|
-
|
|
164
|
+
C(d.$slots, "default", {
|
|
165
165
|
conversation: e.conversation,
|
|
166
166
|
isOpen: e.isOpen,
|
|
167
167
|
createConversation: a,
|
|
168
|
-
switchConversation:
|
|
169
|
-
renameConversation:
|
|
170
|
-
deleteConversation:
|
|
171
|
-
openLeftAside:
|
|
172
|
-
closeLeftAside:
|
|
173
|
-
toggleLeftAside:
|
|
168
|
+
switchConversation: m,
|
|
169
|
+
renameConversation: k,
|
|
170
|
+
deleteConversation: T,
|
|
171
|
+
openLeftAside: E,
|
|
172
|
+
closeLeftAside: R,
|
|
173
|
+
toggleLeftAside: I
|
|
174
174
|
}, () => [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
icon:
|
|
175
|
+
B("div", Wt, [
|
|
176
|
+
B("span", Dt, H(e.brand.name), 1),
|
|
177
|
+
D(p(ae), {
|
|
178
|
+
icon: p(Ue),
|
|
179
179
|
size: "32",
|
|
180
180
|
"svg-size": "20",
|
|
181
181
|
type: "button",
|
|
182
182
|
"aria-label": e.labels.collapseConversationList,
|
|
183
|
-
onClick:
|
|
183
|
+
onClick: R
|
|
184
184
|
}, null, 8, ["icon", "aria-label"])
|
|
185
185
|
]),
|
|
186
|
-
|
|
186
|
+
B("button", {
|
|
187
187
|
class: "chat-left-aside-action",
|
|
188
188
|
type: "button",
|
|
189
189
|
onClick: a
|
|
190
190
|
}, [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
B("span", qt, [
|
|
192
|
+
D(p(Ae), { "font-size": "20" }),
|
|
193
|
+
Be(" " + H(e.labels.createConversation), 1)
|
|
194
194
|
])
|
|
195
195
|
]),
|
|
196
|
-
e.showHistory ? (
|
|
196
|
+
e.showHistory ? (P(), W(p(vt), N({ key: 0 }, v.value, {
|
|
197
197
|
class: "chat-left-aside-content",
|
|
198
|
-
data: [...
|
|
198
|
+
data: [...p(c)],
|
|
199
199
|
selected: e.conversation.activeId ?? void 0,
|
|
200
|
-
"menu-items":
|
|
201
|
-
onItemClick:
|
|
202
|
-
onItemTitleChange:
|
|
203
|
-
onItemAction:
|
|
204
|
-
}), null, 16, ["data", "selected", "menu-items"])) :
|
|
200
|
+
"menu-items": b.value,
|
|
201
|
+
onItemClick: r,
|
|
202
|
+
onItemTitleChange: u,
|
|
203
|
+
onItemAction: y
|
|
204
|
+
}), null, 16, ["data", "selected", "menu-items"])) : U("", !0)
|
|
205
205
|
], !0)
|
|
206
206
|
], 2)
|
|
207
207
|
]));
|
|
208
208
|
}
|
|
209
|
-
}),
|
|
209
|
+
}), zt = /* @__PURE__ */ Y(Kt, [["__scopeId", "data-v-110b6ae6"]]), jt = {
|
|
210
210
|
key: 0,
|
|
211
211
|
class: "tr-chat-mcp-selector"
|
|
212
|
-
},
|
|
212
|
+
}, Jt = ["aria-label", "title"], Zt = { class: "tr-chat-mcp-selector__label" }, Gt = {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: "tr-chat-mcp-selector__count"
|
|
215
|
-
},
|
|
215
|
+
}, Yt = /* @__PURE__ */ Z({
|
|
216
216
|
__name: "MCPSelector",
|
|
217
217
|
props: {
|
|
218
218
|
mcp: {},
|
|
219
219
|
labels: {}
|
|
220
220
|
},
|
|
221
|
-
emits: ["addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
|
|
221
|
+
emits: ["open", "addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
|
|
222
222
|
setup(e, { emit: t }) {
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
}, d = h(() => n.mcp.servers ?? []), a = h(() => n.mcp.tools ?? {}), l = h(() => d.value.length > 0), b = h(() => d.value.filter((s) => s.installed && s.enabled).length), A = h(
|
|
229
|
-
() => d.value.some((s) => {
|
|
230
|
-
var v;
|
|
231
|
-
return !!(s.loading || (v = a.value[s.id]) != null && v.some((S) => S.loading));
|
|
232
|
-
})
|
|
233
|
-
), c = h(
|
|
234
|
-
() => d.value.filter((s) => s.installed).map((s) => C(s, { includeTools: !0 }))
|
|
235
|
-
), f = h(
|
|
236
|
-
() => d.value.map((s) => C(s, { includeTools: !1 }))
|
|
237
|
-
);
|
|
238
|
-
function O(s, v) {
|
|
239
|
-
var $;
|
|
240
|
-
const S = ($ = s.metadata) == null ? void 0 : $[v];
|
|
241
|
-
return typeof S == "string" ? S : void 0;
|
|
242
|
-
}
|
|
243
|
-
function C(s, v) {
|
|
244
|
-
const S = v.includeTools && s.installed ? a.value[s.id] ?? [] : [];
|
|
245
|
-
return {
|
|
246
|
-
id: s.id,
|
|
247
|
-
name: s.name,
|
|
248
|
-
icon: O(s, "icon") ?? Ut,
|
|
249
|
-
description: s.description ?? "",
|
|
250
|
-
enabled: s.enabled,
|
|
251
|
-
expanded: !0,
|
|
252
|
-
tools: S.map(($) => ({
|
|
253
|
-
id: $.id,
|
|
254
|
-
name: $.name,
|
|
255
|
-
description: $.description ?? "",
|
|
256
|
-
enabled: $.enabled
|
|
257
|
-
})),
|
|
258
|
-
addState: s.loading ? "loading" : s.installed ? "added" : "idle",
|
|
259
|
-
category: O(s, "category")
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function L(s) {
|
|
263
|
-
return d.value.find((v) => v.id === s);
|
|
264
|
-
}
|
|
265
|
-
function T(s) {
|
|
266
|
-
const v = L(s.id);
|
|
267
|
-
!v || v.installed || v.loading || o("addServer", { id: s.id });
|
|
268
|
-
}
|
|
269
|
-
function p(s) {
|
|
270
|
-
const v = L(s.id);
|
|
271
|
-
!v || !v.installed || v.loading || o("removeServer", { id: s.id });
|
|
272
|
-
}
|
|
273
|
-
function r(s, v) {
|
|
274
|
-
const S = L(s.id);
|
|
275
|
-
!S || !S.installed || S.loading || S.enabled === v || o("updateServerEnabled", { id: s.id, enabled: v });
|
|
276
|
-
}
|
|
277
|
-
function i(s, v, S) {
|
|
278
|
-
var P;
|
|
279
|
-
const $ = L(s.id), w = (P = a.value[s.id]) == null ? void 0 : P.find((Z) => Z.id === v);
|
|
280
|
-
!$ || !$.installed || !w || w.loading || w.enabled === S || o("updateToolEnabled", { serverId: s.id, toolId: v, enabled: S });
|
|
281
|
-
}
|
|
282
|
-
return (s, v) => l.value ? (I(), F("div", Ft, [
|
|
283
|
-
V("button", {
|
|
284
|
-
class: X(["tr-chat-mcp-selector__button", { "tr-chat-mcp-selector__button--active": b.value > 0 }]),
|
|
223
|
+
const o = e, n = t, c = h(() => o.mcp.servers ?? []), v = h(() => c.value.length > 0), b = h(() => c.value.filter((a) => a.installed && a.enabled).length);
|
|
224
|
+
return (a, r) => v.value ? (P(), F("div", jt, [
|
|
225
|
+
B("button", {
|
|
226
|
+
class: _(["tr-chat-mcp-selector__button", { "tr-chat-mcp-selector__button--active": b.value > 0 }]),
|
|
285
227
|
type: "button",
|
|
286
228
|
"aria-label": e.labels.mcp,
|
|
287
229
|
title: e.labels.mcp,
|
|
288
|
-
onClick:
|
|
230
|
+
onClick: r[0] || (r[0] = (u) => n("open"))
|
|
289
231
|
}, [
|
|
290
|
-
|
|
232
|
+
D(p(wt), {
|
|
291
233
|
size: 16,
|
|
292
234
|
class: "tr-chat-mcp-selector__icon"
|
|
293
235
|
}),
|
|
294
|
-
|
|
295
|
-
b.value > 0 ? (
|
|
296
|
-
], 10,
|
|
297
|
-
|
|
298
|
-
visible: u.value,
|
|
299
|
-
"onUpdate:visible": v[1] || (v[1] = (S) => u.value = S),
|
|
300
|
-
"active-count": b.value,
|
|
301
|
-
"popup-config": m,
|
|
302
|
-
"installed-plugins": c.value,
|
|
303
|
-
"market-plugins": f.value,
|
|
304
|
-
loading: A.value,
|
|
305
|
-
"market-loading": !1,
|
|
306
|
-
"show-custom-add-button": !1,
|
|
307
|
-
"allow-plugin-delete": !0,
|
|
308
|
-
"allow-tool-toggle": !0,
|
|
309
|
-
onPluginToggle: r,
|
|
310
|
-
onPluginAdd: T,
|
|
311
|
-
onPluginDelete: p,
|
|
312
|
-
onToolToggle: i
|
|
313
|
-
}, null, 8, ["visible", "active-count", "installed-plugins", "market-plugins", "loading"])
|
|
314
|
-
])) : B("", !0);
|
|
236
|
+
B("span", Zt, H(e.labels.mcp), 1),
|
|
237
|
+
b.value > 0 ? (P(), F("span", Gt, H(b.value), 1)) : U("", !0)
|
|
238
|
+
], 10, Jt)
|
|
239
|
+
])) : U("", !0);
|
|
315
240
|
}
|
|
316
|
-
}),
|
|
241
|
+
}), Nt = /* @__PURE__ */ Y(Yt, [["__scopeId", "data-v-4a5340bf"]]), Ht = ["low", "medium", "high", "max"], re = ["thinking", "search"], Qt = {
|
|
317
242
|
key: 0,
|
|
318
243
|
class: "tr-chat-model-features"
|
|
319
|
-
},
|
|
244
|
+
}, Xt = ["disabled", "aria-label", "title", "onClick"], xt = { class: "tr-chat-model-features__label" }, _t = /* @__PURE__ */ Z({
|
|
320
245
|
__name: "ModelFeatures",
|
|
321
246
|
props: {
|
|
322
247
|
model: {},
|
|
@@ -324,56 +249,56 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
324
249
|
},
|
|
325
250
|
emits: ["updateFeature"],
|
|
326
251
|
setup(e, { emit: t }) {
|
|
327
|
-
const
|
|
252
|
+
const o = e, n = t, c = {
|
|
328
253
|
thinking: "thinkingFeature",
|
|
329
254
|
search: "searchFeature"
|
|
330
|
-
},
|
|
331
|
-
thinking:
|
|
332
|
-
search:
|
|
333
|
-
},
|
|
334
|
-
() => re.map((
|
|
335
|
-
id:
|
|
336
|
-
label:
|
|
337
|
-
icon: m
|
|
255
|
+
}, v = {
|
|
256
|
+
thinking: kt,
|
|
257
|
+
search: St
|
|
258
|
+
}, b = h(
|
|
259
|
+
() => re.map((m) => ({
|
|
260
|
+
id: m,
|
|
261
|
+
label: o.labels[c[m]],
|
|
262
|
+
icon: v[m]
|
|
338
263
|
}))
|
|
339
|
-
), a = h(() => new Set(
|
|
340
|
-
var
|
|
341
|
-
return (
|
|
342
|
-
}),
|
|
343
|
-
() =>
|
|
344
|
-
var
|
|
345
|
-
return (
|
|
264
|
+
), a = h(() => new Set(o.model.pendingFeatureIds ?? [])), r = h(() => {
|
|
265
|
+
var m;
|
|
266
|
+
return (m = o.model.options) == null ? void 0 : m.find((k) => k.id === o.model.selectedId);
|
|
267
|
+
}), u = h(
|
|
268
|
+
() => b.value.filter((m) => {
|
|
269
|
+
var k, T;
|
|
270
|
+
return (T = (k = r.value) == null ? void 0 : k.capabilities) == null ? void 0 : T[m.id];
|
|
346
271
|
})
|
|
347
272
|
);
|
|
348
|
-
function
|
|
349
|
-
return a.value.has(
|
|
350
|
-
}
|
|
351
|
-
function
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
return (
|
|
356
|
-
(
|
|
357
|
-
var
|
|
358
|
-
return
|
|
359
|
-
key:
|
|
360
|
-
class:
|
|
273
|
+
function y(m) {
|
|
274
|
+
return a.value.has(m);
|
|
275
|
+
}
|
|
276
|
+
function f(m) {
|
|
277
|
+
var k;
|
|
278
|
+
y(m) || n("updateFeature", { id: m, enabled: !((k = o.model.features) != null && k[m]) });
|
|
279
|
+
}
|
|
280
|
+
return (m, k) => u.value.length ? (P(), F("div", Qt, [
|
|
281
|
+
(P(!0), F(Se, null, nt(u.value, (T) => {
|
|
282
|
+
var E;
|
|
283
|
+
return P(), F("button", {
|
|
284
|
+
key: T.id,
|
|
285
|
+
class: _(["tr-chat-model-features__button", { "tr-chat-model-features__button--active": (E = e.model.features) == null ? void 0 : E[T.id] }]),
|
|
361
286
|
type: "button",
|
|
362
|
-
disabled:
|
|
363
|
-
"aria-label":
|
|
364
|
-
title:
|
|
365
|
-
onClick: (
|
|
287
|
+
disabled: y(T.id),
|
|
288
|
+
"aria-label": T.label,
|
|
289
|
+
title: T.label,
|
|
290
|
+
onClick: (R) => f(T.id)
|
|
366
291
|
}, [
|
|
367
|
-
(
|
|
292
|
+
(P(), W(we(T.icon), {
|
|
368
293
|
size: 16,
|
|
369
294
|
class: "tr-chat-model-features__icon"
|
|
370
295
|
})),
|
|
371
|
-
|
|
372
|
-
], 10,
|
|
296
|
+
B("span", xt, H(T.label), 1)
|
|
297
|
+
], 10, Xt);
|
|
373
298
|
}), 128))
|
|
374
|
-
])) :
|
|
299
|
+
])) : U("", !0);
|
|
375
300
|
}
|
|
376
|
-
}),
|
|
301
|
+
}), en = /* @__PURE__ */ Y(_t, [["__scopeId", "data-v-e63ed58d"]]), tn = ["disabled", "aria-label", "title"], nn = { class: "tr-chat-model-selector__label" }, on = /* @__PURE__ */ Z({
|
|
377
302
|
__name: "ModelSelector",
|
|
378
303
|
props: {
|
|
379
304
|
model: {},
|
|
@@ -381,47 +306,47 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
381
306
|
},
|
|
382
307
|
emits: ["selectModel"],
|
|
383
308
|
setup(e, { emit: t }) {
|
|
384
|
-
const
|
|
385
|
-
() =>
|
|
386
|
-
id:
|
|
387
|
-
text:
|
|
309
|
+
const o = e, n = t, c = h(() => o.model.options ?? []), v = h(() => c.value.find((r) => r.id === o.model.selectedId)), b = h(
|
|
310
|
+
() => c.value.map((r) => ({
|
|
311
|
+
id: r.id,
|
|
312
|
+
text: r.label
|
|
388
313
|
}))
|
|
389
314
|
);
|
|
390
|
-
function a(
|
|
391
|
-
|
|
315
|
+
function a(r) {
|
|
316
|
+
o.model.selecting || r.id === o.model.selectedId || n("selectModel", { id: r.id });
|
|
392
317
|
}
|
|
393
|
-
return (
|
|
318
|
+
return (r, u) => c.value.length ? (P(), W(p(mt), {
|
|
394
319
|
key: 0,
|
|
395
320
|
class: "tr-chat-model-selector__menu",
|
|
396
|
-
items:
|
|
321
|
+
items: b.value,
|
|
397
322
|
trigger: "click",
|
|
398
323
|
onItemClick: a
|
|
399
324
|
}, {
|
|
400
|
-
trigger:
|
|
401
|
-
var
|
|
325
|
+
trigger: S(() => {
|
|
326
|
+
var y, f, m;
|
|
402
327
|
return [
|
|
403
|
-
|
|
328
|
+
B("button", {
|
|
404
329
|
class: "tr-chat-model-selector__button",
|
|
405
330
|
type: "button",
|
|
406
331
|
disabled: e.model.selecting,
|
|
407
|
-
"aria-label": ((
|
|
408
|
-
title: ((
|
|
332
|
+
"aria-label": ((y = v.value) == null ? void 0 : y.label) || e.labels.selectModel,
|
|
333
|
+
title: ((f = v.value) == null ? void 0 : f.label) || e.labels.selectModel
|
|
409
334
|
}, [
|
|
410
|
-
|
|
335
|
+
D(p(Et), {
|
|
411
336
|
size: 16,
|
|
412
337
|
class: "tr-chat-model-selector__icon"
|
|
413
338
|
}),
|
|
414
|
-
|
|
415
|
-
], 8,
|
|
339
|
+
B("span", nn, H(((m = v.value) == null ? void 0 : m.label) || e.labels.selectModel), 1)
|
|
340
|
+
], 8, tn)
|
|
416
341
|
];
|
|
417
342
|
}),
|
|
418
343
|
_: 1
|
|
419
|
-
}, 8, ["items"])) :
|
|
344
|
+
}, 8, ["items"])) : U("", !0);
|
|
420
345
|
}
|
|
421
|
-
}),
|
|
346
|
+
}), sn = /* @__PURE__ */ Y(on, [["__scopeId", "data-v-173603c5"]]), an = { class: "chat-footer" }, ln = {
|
|
422
347
|
key: 0,
|
|
423
348
|
class: "model-actions"
|
|
424
|
-
},
|
|
349
|
+
}, rn = /* @__PURE__ */ Z({
|
|
425
350
|
__name: "ChatComposer",
|
|
426
351
|
props: {
|
|
427
352
|
sender: {},
|
|
@@ -431,99 +356,103 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
431
356
|
model: {},
|
|
432
357
|
mcp: {}
|
|
433
358
|
},
|
|
434
|
-
emits: ["submit", "cancel", "clear", "update:value", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
|
|
359
|
+
emits: ["submit", "cancel", "clear", "update:value", "openMcpPanel", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
|
|
435
360
|
setup(e, { emit: t }) {
|
|
436
|
-
const
|
|
437
|
-
var
|
|
361
|
+
const o = e, n = t, c = h(() => {
|
|
362
|
+
var E;
|
|
438
363
|
return {
|
|
439
364
|
mode: "multiple",
|
|
440
365
|
clearable: !0,
|
|
441
|
-
placeholder:
|
|
366
|
+
placeholder: o.sender.loading ? o.labels.composerLoadingPlaceholder : o.labels.composerPlaceholder,
|
|
442
367
|
showWordLimit: !0,
|
|
443
368
|
maxLength: 1e3,
|
|
444
|
-
...
|
|
369
|
+
...o.senderOptions,
|
|
445
370
|
defaultActions: {
|
|
446
|
-
...
|
|
371
|
+
...o.senderOptions.defaultActions,
|
|
447
372
|
submit: {
|
|
448
|
-
...(
|
|
449
|
-
disabled:
|
|
373
|
+
...(E = o.senderOptions.defaultActions) == null ? void 0 : E.submit,
|
|
374
|
+
disabled: o.sender.submitDisabled
|
|
450
375
|
}
|
|
451
376
|
},
|
|
452
|
-
modelValue:
|
|
453
|
-
loading:
|
|
454
|
-
disabled:
|
|
377
|
+
modelValue: o.value,
|
|
378
|
+
loading: o.sender.loading,
|
|
379
|
+
disabled: o.sender.disabled
|
|
455
380
|
};
|
|
456
381
|
});
|
|
457
|
-
function
|
|
458
|
-
|
|
382
|
+
function v(E) {
|
|
383
|
+
n("update:value", E);
|
|
459
384
|
}
|
|
460
|
-
function
|
|
461
|
-
|
|
385
|
+
function b() {
|
|
386
|
+
n("openMcpPanel");
|
|
462
387
|
}
|
|
463
|
-
function a() {
|
|
464
|
-
|
|
388
|
+
function a(E, R) {
|
|
389
|
+
n("submit", { text: E, structuredData: R });
|
|
465
390
|
}
|
|
466
|
-
function
|
|
467
|
-
|
|
391
|
+
function r() {
|
|
392
|
+
n("clear");
|
|
468
393
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
394
|
+
function u(E) {
|
|
395
|
+
n("modelSelect", E);
|
|
471
396
|
}
|
|
472
|
-
function
|
|
473
|
-
|
|
397
|
+
function y(E) {
|
|
398
|
+
n("modelFeatureChange", E);
|
|
474
399
|
}
|
|
475
|
-
function
|
|
476
|
-
|
|
400
|
+
function f(E) {
|
|
401
|
+
n("mcpAddServer", E);
|
|
477
402
|
}
|
|
478
|
-
function
|
|
479
|
-
|
|
403
|
+
function m(E) {
|
|
404
|
+
n("mcpRemoveServer", E);
|
|
480
405
|
}
|
|
481
|
-
function
|
|
482
|
-
|
|
406
|
+
function k(E) {
|
|
407
|
+
n("mcpServerEnabledChange", E);
|
|
483
408
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
409
|
+
function T(E) {
|
|
410
|
+
n("mcpToolEnabledChange", E);
|
|
411
|
+
}
|
|
412
|
+
return (E, R) => (P(), F("div", an, [
|
|
413
|
+
C(E.$slots, "composer-before", {}, void 0, !0),
|
|
414
|
+
C(E.$slots, "default", {}, () => [
|
|
415
|
+
D(p(bt), N(c.value, {
|
|
416
|
+
"onUpdate:modelValue": v,
|
|
417
|
+
onSubmit: a,
|
|
418
|
+
onCancel: R[0] || (R[0] = (I) => n("cancel")),
|
|
419
|
+
onClear: r
|
|
420
|
+
}), J({ _: 2 }, [
|
|
421
|
+
E.$slots["sender-footer"] || e.model || e.mcp ? {
|
|
494
422
|
name: "footer",
|
|
495
|
-
fn:
|
|
496
|
-
e.model || e.mcp ? (
|
|
497
|
-
e.
|
|
423
|
+
fn: S(() => [
|
|
424
|
+
e.model || e.mcp ? (P(), F("div", ln, [
|
|
425
|
+
e.model ? (P(), W(en, {
|
|
498
426
|
key: 0,
|
|
499
|
-
|
|
427
|
+
model: e.model,
|
|
500
428
|
labels: e.labels,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
onUpdateToolEnabled: O
|
|
505
|
-
}, null, 8, ["mcp", "labels"])) : B("", !0),
|
|
506
|
-
e.model ? (I(), W(xt, {
|
|
429
|
+
onUpdateFeature: y
|
|
430
|
+
}, null, 8, ["model", "labels"])) : U("", !0),
|
|
431
|
+
e.model ? (P(), W(sn, {
|
|
507
432
|
key: 1,
|
|
508
433
|
model: e.model,
|
|
509
434
|
labels: e.labels,
|
|
510
|
-
onSelectModel:
|
|
511
|
-
}, null, 8, ["model", "labels"])) :
|
|
512
|
-
e.
|
|
435
|
+
onSelectModel: u
|
|
436
|
+
}, null, 8, ["model", "labels"])) : U("", !0),
|
|
437
|
+
e.mcp ? (P(), W(Nt, {
|
|
513
438
|
key: 2,
|
|
514
|
-
|
|
439
|
+
mcp: e.mcp,
|
|
440
|
+
onOpen: b,
|
|
515
441
|
labels: e.labels,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
442
|
+
onAddServer: f,
|
|
443
|
+
onRemoveServer: m,
|
|
444
|
+
onUpdateServerEnabled: k,
|
|
445
|
+
onUpdateToolEnabled: T
|
|
446
|
+
}, null, 8, ["mcp", "labels"])) : U("", !0)
|
|
447
|
+
])) : U("", !0),
|
|
448
|
+
C(E.$slots, "sender-footer", {}, void 0, !0)
|
|
520
449
|
]),
|
|
521
450
|
key: "0"
|
|
522
451
|
} : void 0,
|
|
523
|
-
|
|
452
|
+
E.$slots["sender-footer-right"] ? {
|
|
524
453
|
name: "footer-right",
|
|
525
|
-
fn:
|
|
526
|
-
|
|
454
|
+
fn: S(() => [
|
|
455
|
+
C(E.$slots, "sender-footer-right", {}, void 0, !0)
|
|
527
456
|
]),
|
|
528
457
|
key: "1"
|
|
529
458
|
} : void 0
|
|
@@ -531,7 +460,7 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
531
460
|
], !0)
|
|
532
461
|
]));
|
|
533
462
|
}
|
|
534
|
-
}),
|
|
463
|
+
}), dn = /* @__PURE__ */ Y(rn, [["__scopeId", "data-v-beded133"]]), $e = /* @__PURE__ */ Z({
|
|
535
464
|
__name: "ChatComposerHost",
|
|
536
465
|
props: {
|
|
537
466
|
sender: {},
|
|
@@ -541,77 +470,78 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
541
470
|
model: {},
|
|
542
471
|
mcp: {}
|
|
543
472
|
},
|
|
544
|
-
emits: ["submit", "cancel", "clear", "update:value", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
|
|
473
|
+
emits: ["submit", "cancel", "clear", "update:value", "openMcpPanel", "modelSelect", "modelFeatureChange", "mcpAddServer", "mcpRemoveServer", "mcpServerEnabledChange", "mcpToolEnabledChange"],
|
|
545
474
|
setup(e, { emit: t }) {
|
|
546
|
-
const
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
function
|
|
551
|
-
|
|
552
|
-
}
|
|
553
|
-
const
|
|
554
|
-
value:
|
|
555
|
-
loading:
|
|
556
|
-
disabled:
|
|
557
|
-
submitDisabled:
|
|
558
|
-
setInputValue:
|
|
559
|
-
submit:
|
|
560
|
-
cancel: () =>
|
|
561
|
-
clear: () =>
|
|
475
|
+
const o = e, n = t;
|
|
476
|
+
function c(a) {
|
|
477
|
+
n("update:value", a);
|
|
478
|
+
}
|
|
479
|
+
function v(a) {
|
|
480
|
+
n("submit", a);
|
|
481
|
+
}
|
|
482
|
+
const b = h(() => ({
|
|
483
|
+
value: o.value,
|
|
484
|
+
loading: o.sender.loading,
|
|
485
|
+
disabled: o.sender.disabled,
|
|
486
|
+
submitDisabled: o.sender.submitDisabled,
|
|
487
|
+
setInputValue: c,
|
|
488
|
+
submit: v,
|
|
489
|
+
cancel: () => n("cancel"),
|
|
490
|
+
clear: () => n("clear")
|
|
562
491
|
}));
|
|
563
|
-
return (a,
|
|
564
|
-
sender:
|
|
565
|
-
value:
|
|
566
|
-
"sender-options":
|
|
567
|
-
labels:
|
|
568
|
-
model:
|
|
569
|
-
mcp:
|
|
570
|
-
onSubmit:
|
|
571
|
-
onCancel:
|
|
572
|
-
onClear:
|
|
573
|
-
"onUpdate:value":
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
492
|
+
return (a, r) => (P(), W(dn, {
|
|
493
|
+
sender: o.sender,
|
|
494
|
+
value: o.value,
|
|
495
|
+
"sender-options": o.senderOptions,
|
|
496
|
+
labels: o.labels,
|
|
497
|
+
model: o.model,
|
|
498
|
+
mcp: o.mcp,
|
|
499
|
+
onSubmit: r[0] || (r[0] = (u) => n("submit", u)),
|
|
500
|
+
onCancel: r[1] || (r[1] = (u) => n("cancel")),
|
|
501
|
+
onClear: r[2] || (r[2] = (u) => n("clear")),
|
|
502
|
+
"onUpdate:value": r[3] || (r[3] = (u) => n("update:value", u)),
|
|
503
|
+
onOpenMcpPanel: r[4] || (r[4] = (u) => n("openMcpPanel")),
|
|
504
|
+
onModelSelect: r[5] || (r[5] = (u) => n("modelSelect", u)),
|
|
505
|
+
onModelFeatureChange: r[6] || (r[6] = (u) => n("modelFeatureChange", u)),
|
|
506
|
+
onMcpAddServer: r[7] || (r[7] = (u) => n("mcpAddServer", u)),
|
|
507
|
+
onMcpRemoveServer: r[8] || (r[8] = (u) => n("mcpRemoveServer", u)),
|
|
508
|
+
onMcpServerEnabledChange: r[9] || (r[9] = (u) => n("mcpServerEnabledChange", u)),
|
|
509
|
+
onMcpToolEnabledChange: r[10] || (r[10] = (u) => n("mcpToolEnabledChange", u))
|
|
510
|
+
}, J({ _: 2 }, [
|
|
581
511
|
a.$slots["composer-before"] ? {
|
|
582
512
|
name: "composer-before",
|
|
583
|
-
fn:
|
|
584
|
-
|
|
513
|
+
fn: S(() => [
|
|
514
|
+
C(a.$slots, "composer-before", q(j(b.value)))
|
|
585
515
|
]),
|
|
586
516
|
key: "0"
|
|
587
517
|
} : void 0,
|
|
588
518
|
a.$slots["layout-footer"] ? {
|
|
589
519
|
name: "default",
|
|
590
|
-
fn:
|
|
591
|
-
|
|
520
|
+
fn: S(() => [
|
|
521
|
+
C(a.$slots, "layout-footer", q(j(b.value)))
|
|
592
522
|
]),
|
|
593
523
|
key: "1"
|
|
594
524
|
} : void 0,
|
|
595
525
|
a.$slots["sender-footer"] ? {
|
|
596
526
|
name: "sender-footer",
|
|
597
|
-
fn:
|
|
598
|
-
|
|
527
|
+
fn: S(() => [
|
|
528
|
+
C(a.$slots, "sender-footer")
|
|
599
529
|
]),
|
|
600
530
|
key: "2"
|
|
601
531
|
} : void 0,
|
|
602
532
|
a.$slots["sender-footer-right"] ? {
|
|
603
533
|
name: "sender-footer-right",
|
|
604
|
-
fn:
|
|
605
|
-
|
|
534
|
+
fn: S(() => [
|
|
535
|
+
C(a.$slots, "sender-footer-right")
|
|
606
536
|
]),
|
|
607
537
|
key: "3"
|
|
608
538
|
} : void 0
|
|
609
539
|
]), 1032, ["sender", "value", "sender-options", "labels", "model", "mcp"]));
|
|
610
540
|
}
|
|
611
|
-
}),
|
|
541
|
+
}), un = {
|
|
612
542
|
key: 0,
|
|
613
543
|
class: "chat-notice"
|
|
614
|
-
},
|
|
544
|
+
}, cn = { class: "chat-header" }, fn = { class: "chat-header__aside-cell" }, vn = ["aria-label"], mn = { class: "chat-header__title" }, bn = { class: "chat-header__actions" }, gn = ["aria-label", "title"], hn = ["aria-label"], pn = /* @__PURE__ */ Z({
|
|
615
545
|
__name: "ChatHeader",
|
|
616
546
|
props: {
|
|
617
547
|
title: {},
|
|
@@ -626,57 +556,57 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
626
556
|
},
|
|
627
557
|
emits: ["createConversation", "openLeftAside", "closeLeftAside", "toggleLeftAside", "openRightAside"],
|
|
628
558
|
setup(e, { emit: t }) {
|
|
629
|
-
const
|
|
630
|
-
function
|
|
631
|
-
|
|
559
|
+
const o = t;
|
|
560
|
+
function n() {
|
|
561
|
+
o("createConversation");
|
|
632
562
|
}
|
|
633
|
-
function
|
|
634
|
-
|
|
563
|
+
function c() {
|
|
564
|
+
o("openLeftAside");
|
|
635
565
|
}
|
|
636
|
-
function
|
|
637
|
-
|
|
566
|
+
function v() {
|
|
567
|
+
o("closeLeftAside");
|
|
638
568
|
}
|
|
639
|
-
function
|
|
640
|
-
|
|
569
|
+
function b() {
|
|
570
|
+
o("toggleLeftAside");
|
|
641
571
|
}
|
|
642
572
|
function a() {
|
|
643
|
-
|
|
573
|
+
o("openRightAside");
|
|
644
574
|
}
|
|
645
|
-
return (
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
])) :
|
|
649
|
-
|
|
575
|
+
return (r, u) => (P(), F(Se, null, [
|
|
576
|
+
r.$slots.notice ? (P(), F("div", un, [
|
|
577
|
+
C(r.$slots, "notice", {}, void 0, !0)
|
|
578
|
+
])) : U("", !0),
|
|
579
|
+
C(r.$slots, "default", {
|
|
650
580
|
title: e.title,
|
|
651
581
|
isEmpty: e.isEmpty,
|
|
652
582
|
conversation: e.conversation,
|
|
653
|
-
createConversation:
|
|
583
|
+
createConversation: n,
|
|
654
584
|
isLeftAsideOpen: e.isLeftAsideOpen,
|
|
655
|
-
openLeftAside:
|
|
656
|
-
closeLeftAside:
|
|
657
|
-
toggleLeftAside:
|
|
585
|
+
openLeftAside: c,
|
|
586
|
+
closeLeftAside: v,
|
|
587
|
+
toggleLeftAside: b,
|
|
658
588
|
openRightAside: a
|
|
659
589
|
}, () => [
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
e.isLeftAsideVisible && e.isLeftAsideDrawer ? (
|
|
590
|
+
B("header", cn, [
|
|
591
|
+
B("div", fn, [
|
|
592
|
+
e.isLeftAsideVisible && e.isLeftAsideDrawer ? (P(), W(p(pe).AsideToggle, {
|
|
663
593
|
key: 0,
|
|
664
594
|
side: "left"
|
|
665
595
|
}, {
|
|
666
|
-
default:
|
|
667
|
-
|
|
596
|
+
default: S(({ isOpen: y }) => [
|
|
597
|
+
B("span", {
|
|
668
598
|
class: "chat-header__aside-toggle",
|
|
669
|
-
"aria-label":
|
|
599
|
+
"aria-label": y ? e.labels.collapseConversationList : e.labels.expandConversationList
|
|
670
600
|
}, [
|
|
671
|
-
(
|
|
672
|
-
], 8,
|
|
601
|
+
(P(), W(we(y ? p(Ue) : p(ye)), { size: 20 }))
|
|
602
|
+
], 8, vn)
|
|
673
603
|
]),
|
|
674
604
|
_: 1
|
|
675
|
-
})) :
|
|
605
|
+
})) : U("", !0)
|
|
676
606
|
]),
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
e.isRightAsideVisible && !e.isRightAsideOpen ? (
|
|
607
|
+
B("h3", mn, H(e.title), 1),
|
|
608
|
+
B("div", bn, [
|
|
609
|
+
e.isRightAsideVisible && !e.isRightAsideOpen ? (P(), F("button", {
|
|
680
610
|
key: 0,
|
|
681
611
|
class: "chat-header__aside-action",
|
|
682
612
|
type: "button",
|
|
@@ -684,26 +614,26 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
684
614
|
title: e.labels.openRightAside,
|
|
685
615
|
onClick: a
|
|
686
616
|
}, [
|
|
687
|
-
|
|
688
|
-
], 8,
|
|
689
|
-
!e.isEmpty || !e.isLeftAsideVisible ? (
|
|
617
|
+
D(p(ye), { size: 18 })
|
|
618
|
+
], 8, gn)) : U("", !0),
|
|
619
|
+
!e.isEmpty || !e.isLeftAsideVisible ? (P(), F("button", {
|
|
690
620
|
key: 1,
|
|
691
|
-
class:
|
|
621
|
+
class: _(["chat-header__new", { "chat-header__new--visible": !e.isLeftAsideVisible }]),
|
|
692
622
|
type: "button",
|
|
693
623
|
"aria-label": e.labels.createConversation,
|
|
694
|
-
onClick:
|
|
624
|
+
onClick: n
|
|
695
625
|
}, [
|
|
696
|
-
|
|
697
|
-
], 10,
|
|
626
|
+
D(p(Ae), { size: 20 })
|
|
627
|
+
], 10, hn)) : U("", !0)
|
|
698
628
|
])
|
|
699
629
|
])
|
|
700
630
|
], !0)
|
|
701
631
|
], 64));
|
|
702
632
|
}
|
|
703
|
-
}),
|
|
633
|
+
}), yn = /* @__PURE__ */ Y(pn, [["__scopeId", "data-v-616b4d3a"]]), An = {
|
|
704
634
|
key: 0,
|
|
705
635
|
class: "chat-welcome-content"
|
|
706
|
-
},
|
|
636
|
+
}, Cn = /* @__PURE__ */ Z({
|
|
707
637
|
__name: "ChatMessages",
|
|
708
638
|
props: {
|
|
709
639
|
messages: {},
|
|
@@ -717,151 +647,151 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
717
647
|
},
|
|
718
648
|
emits: ["promptClick", "bubbleStateChange", "bubbleEvent"],
|
|
719
649
|
setup(e, { emit: t }) {
|
|
720
|
-
const
|
|
650
|
+
const o = e, n = t, c = he(le, { style: { fontSize: "28px" } }), v = he(Ot, { style: { fontSize: "28px" } }), b = {
|
|
721
651
|
assistant: {
|
|
722
652
|
placement: "start",
|
|
723
|
-
avatar:
|
|
653
|
+
avatar: c
|
|
724
654
|
},
|
|
725
655
|
user: {
|
|
726
656
|
placement: "end",
|
|
727
|
-
avatar:
|
|
657
|
+
avatar: v
|
|
728
658
|
},
|
|
729
659
|
system: {
|
|
730
660
|
hidden: !0
|
|
731
661
|
}
|
|
732
|
-
}, a = h(() =>
|
|
733
|
-
fallbackContentRenderer:
|
|
734
|
-
...
|
|
735
|
-
})),
|
|
736
|
-
const
|
|
737
|
-
...
|
|
662
|
+
}, a = h(() => o.messages.length === 0), r = h(() => o.messages.at(-1)), u = h(() => o.messages.map((l) => ({ ...l }))), y = h(() => o.options.autoScroll ?? !0), f = h(() => ({
|
|
663
|
+
fallbackContentRenderer: gt.Markdown,
|
|
664
|
+
...o.options.bubbleProvider
|
|
665
|
+
})), m = h(() => {
|
|
666
|
+
const l = o.options.bubbleList, i = {
|
|
667
|
+
...b,
|
|
738
668
|
...Object.fromEntries(
|
|
739
|
-
Object.entries(
|
|
740
|
-
|
|
669
|
+
Object.entries(l.roleConfigs ?? {}).map(([A, M]) => [
|
|
670
|
+
A,
|
|
741
671
|
{
|
|
742
|
-
...
|
|
743
|
-
|
|
672
|
+
...b[A],
|
|
673
|
+
...M
|
|
744
674
|
}
|
|
745
675
|
])
|
|
746
676
|
)
|
|
747
677
|
};
|
|
748
678
|
return {
|
|
749
|
-
...
|
|
750
|
-
roleConfigs:
|
|
679
|
+
...l,
|
|
680
|
+
roleConfigs: i,
|
|
751
681
|
autoScroll: !1
|
|
752
682
|
};
|
|
753
|
-
}),
|
|
683
|
+
}), k = h(() => o.welcome === !1 ? null : o.welcome), T = h(() => o.prompts === !1 ? {
|
|
754
684
|
items: []
|
|
755
685
|
} : {
|
|
756
|
-
...
|
|
757
|
-
items: [...
|
|
758
|
-
}),
|
|
759
|
-
() =>
|
|
686
|
+
...o.prompts,
|
|
687
|
+
items: [...o.prompts.items ?? []]
|
|
688
|
+
}), E = h(() => o.prompts !== !1 && T.value.items.length > 0), { scrollToBottom: R } = ht(
|
|
689
|
+
() => o.scrollTarget,
|
|
760
690
|
() => {
|
|
761
|
-
var
|
|
762
|
-
return
|
|
691
|
+
var l, i;
|
|
692
|
+
return y.value ? [o.messages.length, (l = r.value) == null ? void 0 : l.content, (i = r.value) == null ? void 0 : i.reasoning_content] : null;
|
|
763
693
|
}
|
|
764
694
|
);
|
|
765
695
|
ue(
|
|
766
696
|
() => {
|
|
767
|
-
var
|
|
768
|
-
return (
|
|
697
|
+
var l;
|
|
698
|
+
return (l = r.value) == null ? void 0 : l.role;
|
|
769
699
|
},
|
|
770
|
-
async (
|
|
771
|
-
|
|
700
|
+
async (l) => {
|
|
701
|
+
y.value && l === "user" && (await ot(), R("smooth"));
|
|
772
702
|
}
|
|
773
703
|
);
|
|
774
|
-
function
|
|
775
|
-
|
|
704
|
+
function I(l, i) {
|
|
705
|
+
i.disabled || n("promptClick", l, i);
|
|
776
706
|
}
|
|
777
|
-
function
|
|
778
|
-
|
|
707
|
+
function d(l) {
|
|
708
|
+
n("bubbleStateChange", l);
|
|
779
709
|
}
|
|
780
|
-
function
|
|
781
|
-
|
|
710
|
+
function s(l) {
|
|
711
|
+
n("bubbleEvent", l);
|
|
782
712
|
}
|
|
783
|
-
return (
|
|
784
|
-
class:
|
|
713
|
+
return (l, i) => (P(), F("div", {
|
|
714
|
+
class: _(["chat-panel-content chat-panel-content--main", {
|
|
785
715
|
"is-message-state": !a.value
|
|
786
716
|
}])
|
|
787
717
|
}, [
|
|
788
|
-
|
|
789
|
-
a.value ? (
|
|
718
|
+
C(l.$slots, "default", {}, () => [
|
|
719
|
+
a.value ? (P(), F("div", {
|
|
790
720
|
key: 0,
|
|
791
|
-
class:
|
|
792
|
-
"chat-empty-content--centered":
|
|
721
|
+
class: _(["chat-empty-content", {
|
|
722
|
+
"chat-empty-content--centered": o.centerEmptyState || o.centerWelcomeComposer
|
|
793
723
|
}])
|
|
794
724
|
}, [
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
footer:
|
|
798
|
-
|
|
799
|
-
|
|
725
|
+
l.$slots["welcome-composer"] ? (P(), F("div", An, [
|
|
726
|
+
k.value ? (P(), W(p(Pe), q(N({ key: 0 }, k.value)), {
|
|
727
|
+
footer: S(() => [
|
|
728
|
+
C(l.$slots, "welcome-footer", {}, void 0, !0),
|
|
729
|
+
C(l.$slots, "welcome-composer", {}, void 0, !0)
|
|
800
730
|
]),
|
|
801
731
|
_: 3
|
|
802
|
-
}, 16)) :
|
|
803
|
-
|
|
804
|
-
|
|
732
|
+
}, 16)) : U("", !0),
|
|
733
|
+
E.value ? (P(), W(p(Le), N({ key: 1 }, T.value, { onItemClick: I }), J({ _: 2 }, [
|
|
734
|
+
l.$slots["prompts-footer"] ? {
|
|
805
735
|
name: "footer",
|
|
806
|
-
fn:
|
|
807
|
-
|
|
736
|
+
fn: S(() => [
|
|
737
|
+
C(l.$slots, "prompts-footer", {}, void 0, !0)
|
|
808
738
|
]),
|
|
809
739
|
key: "0"
|
|
810
740
|
} : void 0
|
|
811
|
-
]), 1040)) :
|
|
812
|
-
])) : (
|
|
813
|
-
|
|
814
|
-
|
|
741
|
+
]), 1040)) : U("", !0)
|
|
742
|
+
])) : (P(), F(Se, { key: 1 }, [
|
|
743
|
+
k.value ? (P(), W(p(Pe), q(N({ key: 0 }, k.value)), J({ _: 2 }, [
|
|
744
|
+
l.$slots["welcome-footer"] ? {
|
|
815
745
|
name: "footer",
|
|
816
|
-
fn:
|
|
817
|
-
|
|
746
|
+
fn: S(() => [
|
|
747
|
+
C(l.$slots, "welcome-footer", {}, void 0, !0)
|
|
818
748
|
]),
|
|
819
749
|
key: "0"
|
|
820
750
|
} : void 0
|
|
821
|
-
]), 1040)) :
|
|
822
|
-
|
|
823
|
-
|
|
751
|
+
]), 1040)) : U("", !0),
|
|
752
|
+
E.value ? (P(), W(p(Le), N({ key: 1 }, T.value, { onItemClick: I }), J({ _: 2 }, [
|
|
753
|
+
l.$slots["prompts-footer"] ? {
|
|
824
754
|
name: "footer",
|
|
825
|
-
fn:
|
|
826
|
-
|
|
755
|
+
fn: S(() => [
|
|
756
|
+
C(l.$slots, "prompts-footer", {}, void 0, !0)
|
|
827
757
|
]),
|
|
828
758
|
key: "0"
|
|
829
759
|
} : void 0
|
|
830
|
-
]), 1040)) :
|
|
760
|
+
]), 1040)) : U("", !0)
|
|
831
761
|
], 64))
|
|
832
|
-
], 2)) : (
|
|
833
|
-
default:
|
|
834
|
-
|
|
762
|
+
], 2)) : (P(), W(p(pt), q(N({ key: 1 }, f.value)), {
|
|
763
|
+
default: S(() => [
|
|
764
|
+
D(p(yt), N(m.value, {
|
|
835
765
|
class: "tr-chat-messages__bubble-list",
|
|
836
|
-
messages:
|
|
837
|
-
onStateChange:
|
|
838
|
-
onBubbleEvent:
|
|
839
|
-
}),
|
|
840
|
-
|
|
766
|
+
messages: u.value,
|
|
767
|
+
onStateChange: d,
|
|
768
|
+
onBubbleEvent: s
|
|
769
|
+
}), J({ _: 2 }, [
|
|
770
|
+
l.$slots["bubble-prefix"] ? {
|
|
841
771
|
name: "prefix",
|
|
842
|
-
fn:
|
|
843
|
-
|
|
772
|
+
fn: S(() => [
|
|
773
|
+
C(l.$slots, "bubble-prefix", {}, void 0, !0)
|
|
844
774
|
]),
|
|
845
775
|
key: "0"
|
|
846
776
|
} : void 0,
|
|
847
|
-
|
|
777
|
+
l.$slots["bubble-suffix"] ? {
|
|
848
778
|
name: "suffix",
|
|
849
|
-
fn:
|
|
850
|
-
|
|
779
|
+
fn: S(() => [
|
|
780
|
+
C(l.$slots, "bubble-suffix", {}, void 0, !0)
|
|
851
781
|
]),
|
|
852
782
|
key: "1"
|
|
853
783
|
} : void 0,
|
|
854
|
-
|
|
784
|
+
l.$slots["bubble-after"] ? {
|
|
855
785
|
name: "after",
|
|
856
|
-
fn:
|
|
857
|
-
|
|
786
|
+
fn: S(() => [
|
|
787
|
+
C(l.$slots, "bubble-after", {}, void 0, !0)
|
|
858
788
|
]),
|
|
859
789
|
key: "2"
|
|
860
790
|
} : void 0,
|
|
861
|
-
|
|
791
|
+
l.$slots["bubble-content-footer"] ? {
|
|
862
792
|
name: "content-footer",
|
|
863
|
-
fn:
|
|
864
|
-
|
|
793
|
+
fn: S(() => [
|
|
794
|
+
C(l.$slots, "bubble-content-footer", {}, void 0, !0)
|
|
865
795
|
]),
|
|
866
796
|
key: "3"
|
|
867
797
|
} : void 0
|
|
@@ -872,7 +802,7 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
872
802
|
], !0)
|
|
873
803
|
], 2));
|
|
874
804
|
}
|
|
875
|
-
}),
|
|
805
|
+
}), wn = /* @__PURE__ */ Y(Cn, [["__scopeId", "data-v-d0b8924e"]]), Sn = { class: "chat-right-aside" }, kn = { class: "chat-right-aside__header" }, En = ["aria-label", "title"], On = { class: "chat-right-aside__body" }, Rn = /* @__PURE__ */ Z({
|
|
876
806
|
__name: "ChatRightAside",
|
|
877
807
|
props: {
|
|
878
808
|
showClose: { type: Boolean, default: !0 },
|
|
@@ -880,97 +810,206 @@ const Rt = { class: "chat-left-aside" }, Lt = ["aria-label"], $t = { class: "cha
|
|
|
880
810
|
},
|
|
881
811
|
emits: ["close"],
|
|
882
812
|
setup(e, { emit: t }) {
|
|
883
|
-
const
|
|
884
|
-
return (
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
e.showClose ? (
|
|
813
|
+
const o = t;
|
|
814
|
+
return (n, c) => (P(), F("section", Sn, [
|
|
815
|
+
B("header", kn, [
|
|
816
|
+
C(n.$slots, "title", {}, void 0, !0),
|
|
817
|
+
e.showClose ? (P(), F("button", {
|
|
888
818
|
key: 0,
|
|
889
819
|
class: "chat-right-aside__close",
|
|
890
820
|
type: "button",
|
|
891
821
|
"aria-label": e.labels.closeRightAside,
|
|
892
822
|
title: e.labels.closeRightAside,
|
|
893
|
-
onClick:
|
|
823
|
+
onClick: c[0] || (c[0] = (v) => o("close"))
|
|
894
824
|
}, [
|
|
895
|
-
|
|
896
|
-
], 8,
|
|
825
|
+
D(p(Rt), { class: "chat-right-aside__close-icon" })
|
|
826
|
+
], 8, En)) : U("", !0)
|
|
897
827
|
]),
|
|
898
|
-
|
|
899
|
-
|
|
828
|
+
B("div", On, [
|
|
829
|
+
C(n.$slots, "default", {}, void 0, !0)
|
|
900
830
|
])
|
|
901
831
|
]));
|
|
902
832
|
}
|
|
903
|
-
}),
|
|
833
|
+
}), Tn = /* @__PURE__ */ Y(Rn, [["__scopeId", "data-v-1013d8c6"]]), Mn = "data:image/png;base64,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", Pn = { class: "chat-mcp-panel" }, Ln = /* @__PURE__ */ Z({
|
|
834
|
+
__name: "ChatMcpPanel",
|
|
835
|
+
props: {
|
|
836
|
+
mcp: {},
|
|
837
|
+
labels: {}
|
|
838
|
+
},
|
|
839
|
+
emits: ["close", "addServer", "removeServer", "updateServerEnabled", "updateToolEnabled"],
|
|
840
|
+
setup(e, { emit: t }) {
|
|
841
|
+
const o = e, n = t, c = h({
|
|
842
|
+
get: () => !0,
|
|
843
|
+
set: (s) => {
|
|
844
|
+
s || n("close");
|
|
845
|
+
}
|
|
846
|
+
}), v = h(() => o.mcp.servers ?? []), b = h(() => o.mcp.tools ?? {}), a = h(() => v.value.filter((s) => s.installed && s.enabled).length), r = h(
|
|
847
|
+
() => v.value.some((s) => {
|
|
848
|
+
var l;
|
|
849
|
+
return !!(s.loading || (l = b.value[s.id]) != null && l.some((i) => i.loading));
|
|
850
|
+
})
|
|
851
|
+
), u = h(
|
|
852
|
+
() => v.value.filter((s) => s.installed).map((s) => k(s, !0))
|
|
853
|
+
), y = h(() => v.value.map((s) => k(s, !1))), f = {
|
|
854
|
+
position: "static",
|
|
855
|
+
top: "auto",
|
|
856
|
+
right: "auto",
|
|
857
|
+
bottom: "auto",
|
|
858
|
+
left: "auto",
|
|
859
|
+
transform: "none",
|
|
860
|
+
zIndex: "auto",
|
|
861
|
+
width: "100%",
|
|
862
|
+
maxWidth: "none",
|
|
863
|
+
height: "100%",
|
|
864
|
+
minHeight: "0"
|
|
865
|
+
};
|
|
866
|
+
function m(s, l) {
|
|
867
|
+
var A;
|
|
868
|
+
const i = (A = s.metadata) == null ? void 0 : A[l];
|
|
869
|
+
return typeof i == "string" ? i : void 0;
|
|
870
|
+
}
|
|
871
|
+
function k(s, l) {
|
|
872
|
+
const i = l && s.installed ? b.value[s.id] ?? [] : [];
|
|
873
|
+
return {
|
|
874
|
+
id: s.id,
|
|
875
|
+
name: s.name,
|
|
876
|
+
icon: m(s, "icon") ?? Mn,
|
|
877
|
+
description: s.description ?? "",
|
|
878
|
+
enabled: s.enabled,
|
|
879
|
+
expanded: !0,
|
|
880
|
+
tools: i.map((A) => ({
|
|
881
|
+
id: A.id,
|
|
882
|
+
name: A.name,
|
|
883
|
+
description: A.description ?? "",
|
|
884
|
+
enabled: A.enabled
|
|
885
|
+
})),
|
|
886
|
+
addState: s.loading ? "loading" : s.installed ? "added" : "idle",
|
|
887
|
+
category: m(s, "category")
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
function T(s) {
|
|
891
|
+
return v.value.find((l) => l.id === s);
|
|
892
|
+
}
|
|
893
|
+
function E(s) {
|
|
894
|
+
const l = T(s.id);
|
|
895
|
+
!l || l.installed || l.loading || n("addServer", { id: s.id });
|
|
896
|
+
}
|
|
897
|
+
function R(s) {
|
|
898
|
+
const l = T(s.id);
|
|
899
|
+
!l || !l.installed || l.loading || n("removeServer", { id: s.id });
|
|
900
|
+
}
|
|
901
|
+
function I(s, l) {
|
|
902
|
+
const i = T(s.id);
|
|
903
|
+
!i || !i.installed || i.loading || i.enabled === l || n("updateServerEnabled", { id: s.id, enabled: l });
|
|
904
|
+
}
|
|
905
|
+
function d(s, l, i) {
|
|
906
|
+
var $;
|
|
907
|
+
const A = T(s.id), M = ($ = b.value[s.id]) == null ? void 0 : $.find((V) => V.id === l);
|
|
908
|
+
!A || !A.installed || !M || M.loading || M.enabled === i || n("updateToolEnabled", { serverId: s.id, toolId: l, enabled: i });
|
|
909
|
+
}
|
|
910
|
+
return (s, l) => (P(), F("div", Pn, [
|
|
911
|
+
D(p(At), {
|
|
912
|
+
visible: c.value,
|
|
913
|
+
"onUpdate:visible": l[0] || (l[0] = (i) => c.value = i),
|
|
914
|
+
style: f,
|
|
915
|
+
"active-count": a.value,
|
|
916
|
+
"installed-plugins": u.value,
|
|
917
|
+
"market-plugins": y.value,
|
|
918
|
+
loading: r.value,
|
|
919
|
+
"market-loading": !1,
|
|
920
|
+
title: e.labels.mcp,
|
|
921
|
+
"show-custom-add-button": !1,
|
|
922
|
+
"allow-plugin-delete": !0,
|
|
923
|
+
"allow-tool-toggle": !0,
|
|
924
|
+
onPluginToggle: I,
|
|
925
|
+
onPluginAdd: E,
|
|
926
|
+
onPluginDelete: R,
|
|
927
|
+
onToolToggle: d
|
|
928
|
+
}, null, 8, ["visible", "active-count", "installed-plugins", "market-plugins", "loading", "title"])
|
|
929
|
+
]));
|
|
930
|
+
}
|
|
931
|
+
}), $n = /* @__PURE__ */ Y(Ln, [["__scopeId", "data-v-5fd73b95"]]);
|
|
904
932
|
function se(e, t) {
|
|
905
933
|
return typeof e == "number" ? e : t;
|
|
906
934
|
}
|
|
907
|
-
function
|
|
908
|
-
const t =
|
|
909
|
-
|
|
910
|
-
),
|
|
911
|
-
const
|
|
912
|
-
return
|
|
913
|
-
}),
|
|
914
|
-
const
|
|
915
|
-
return
|
|
916
|
-
}),
|
|
935
|
+
function In(e) {
|
|
936
|
+
const t = z(e.leftAside), o = z(e.rightAside), n = z(e.rightAsidePanel), c = K(t !== !1 ? (t == null ? void 0 : t.open) ?? (t == null ? void 0 : t.defaultOpen) ?? !1 : !1), v = K(
|
|
937
|
+
o !== !1 ? (o == null ? void 0 : o.open) ?? (o == null ? void 0 : o.defaultOpen) ?? !1 : !1
|
|
938
|
+
), b = K(n), a = h(() => z(e.isMobileViewport)), r = h(() => z(e.viewportWidth)), u = h(() => z(e.leftAside)), y = h(() => z(e.rightAside)), f = h(() => {
|
|
939
|
+
const i = u.value;
|
|
940
|
+
return i !== !1 ? (i == null ? void 0 : i.open) ?? c.value : !1;
|
|
941
|
+
}), m = h(() => {
|
|
942
|
+
const i = y.value;
|
|
943
|
+
return i !== !1 ? (i == null ? void 0 : i.open) ?? v.value : !1;
|
|
944
|
+
}), k = h(() => {
|
|
945
|
+
const i = z(e.rightAsidePanel);
|
|
946
|
+
return i !== void 0 ? i : b.value;
|
|
947
|
+
}), T = h(
|
|
917
948
|
() => {
|
|
918
|
-
var
|
|
919
|
-
return
|
|
949
|
+
var i;
|
|
950
|
+
return a.value ? "drawer" : u.value !== !1 ? (i = u.value) == null ? void 0 : i.mode : "dock";
|
|
920
951
|
}
|
|
921
|
-
),
|
|
952
|
+
), E = h(
|
|
922
953
|
() => {
|
|
923
|
-
var
|
|
924
|
-
return
|
|
954
|
+
var i;
|
|
955
|
+
return a.value ? "drawer" : y.value !== !1 ? (i = y.value) == null ? void 0 : i.mode : "dock";
|
|
925
956
|
}
|
|
926
|
-
),
|
|
927
|
-
const
|
|
957
|
+
), R = h(() => {
|
|
958
|
+
const i = u.value, A = se(i !== !1 ? i == null ? void 0 : i.width : void 0, 300);
|
|
928
959
|
return {
|
|
929
|
-
mode:
|
|
930
|
-
open:
|
|
931
|
-
expandedWidth:
|
|
932
|
-
collapsedWidth:
|
|
960
|
+
mode: T.value,
|
|
961
|
+
open: f.value,
|
|
962
|
+
expandedWidth: a.value && r.value > 0 ? Math.min(A, Math.floor(r.value * 0.86)) : A,
|
|
963
|
+
collapsedWidth: a.value || i === !1 ? 0 : se(i == null ? void 0 : i.collapsedWidth, 56),
|
|
933
964
|
collapseEffect: "overlay"
|
|
934
965
|
};
|
|
935
|
-
}),
|
|
936
|
-
const
|
|
966
|
+
}), I = h(() => {
|
|
967
|
+
const i = y.value, A = a.value && r.value > 0 ? r.value : void 0;
|
|
937
968
|
return {
|
|
938
|
-
mode:
|
|
939
|
-
open:
|
|
940
|
-
expandedWidth:
|
|
941
|
-
minExpandedWidth:
|
|
942
|
-
maxExpandedWidth:
|
|
943
|
-
collapsedWidth:
|
|
969
|
+
mode: E.value,
|
|
970
|
+
open: m.value,
|
|
971
|
+
expandedWidth: A ?? se(i !== !1 ? i == null ? void 0 : i.width : void 0, 320),
|
|
972
|
+
minExpandedWidth: A,
|
|
973
|
+
maxExpandedWidth: A,
|
|
974
|
+
collapsedWidth: a.value || i === !1 ? 0 : se(i == null ? void 0 : i.collapsedWidth, 0),
|
|
944
975
|
collapseEffect: "overlay"
|
|
945
976
|
};
|
|
946
977
|
});
|
|
947
|
-
function
|
|
948
|
-
var
|
|
949
|
-
|
|
978
|
+
function d(i, A = "user") {
|
|
979
|
+
var M;
|
|
980
|
+
f.value !== i && (u.value !== !1 && ((M = u.value) == null ? void 0 : M.open) === void 0 && (c.value = i), e.onLeftOpenChange({ open: i, source: A }));
|
|
981
|
+
}
|
|
982
|
+
function s(i, A = "user") {
|
|
983
|
+
var M;
|
|
984
|
+
m.value !== i && (y.value !== !1 && ((M = y.value) == null ? void 0 : M.open) === void 0 && (v.value = i), e.onRightOpenChange({ open: i, source: A }));
|
|
950
985
|
}
|
|
951
|
-
function
|
|
952
|
-
var
|
|
953
|
-
|
|
986
|
+
function l(i) {
|
|
987
|
+
var A;
|
|
988
|
+
z(e.rightAsidePanel) === void 0 && (b.value = i), (A = e.onRightAsidePanelChange) == null || A.call(e, i);
|
|
954
989
|
}
|
|
955
|
-
return ue(
|
|
956
|
-
|
|
990
|
+
return ue(a, (i) => {
|
|
991
|
+
i && (d(!1, "viewport"), s(!1, "viewport"));
|
|
957
992
|
}), {
|
|
958
|
-
leftAsideOptions:
|
|
959
|
-
rightAsideOptions:
|
|
960
|
-
resolvedLeftAsideOpen:
|
|
961
|
-
resolvedRightAsideOpen:
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
993
|
+
leftAsideOptions: R,
|
|
994
|
+
rightAsideOptions: I,
|
|
995
|
+
resolvedLeftAsideOpen: f,
|
|
996
|
+
resolvedRightAsideOpen: m,
|
|
997
|
+
resolvedRightAsidePanel: k,
|
|
998
|
+
isLeftAsideDock: h(() => T.value === "dock"),
|
|
999
|
+
isLeftAsideDrawer: h(() => T.value === "drawer"),
|
|
1000
|
+
openLeftAside: () => d(!0),
|
|
1001
|
+
closeLeftAside: () => d(!1),
|
|
1002
|
+
toggleLeftAside: () => d(!f.value),
|
|
1003
|
+
closeRightAside: () => s(!1),
|
|
1004
|
+
openRightAside: (i) => {
|
|
1005
|
+
i !== void 0 && l(i), s(!0);
|
|
1006
|
+
},
|
|
1007
|
+
setRightAsidePanel: l,
|
|
1008
|
+
handleLeftAsideOpenChange: (i) => d(i.open),
|
|
1009
|
+
handleRightAsideOpenChange: (i) => s(i.open)
|
|
971
1010
|
};
|
|
972
1011
|
}
|
|
973
|
-
function
|
|
1012
|
+
function Vn() {
|
|
974
1013
|
return {
|
|
975
1014
|
newConversationTitle: "新对话",
|
|
976
1015
|
createConversation: "新建会话",
|
|
@@ -991,8 +1030,8 @@ function ko() {
|
|
|
991
1030
|
closeRightAside: "关闭详情"
|
|
992
1031
|
};
|
|
993
1032
|
}
|
|
994
|
-
function
|
|
995
|
-
const e =
|
|
1033
|
+
function Bn() {
|
|
1034
|
+
const e = Vn();
|
|
996
1035
|
return {
|
|
997
1036
|
layout: {
|
|
998
1037
|
surface: {
|
|
@@ -1038,7 +1077,7 @@ function Eo() {
|
|
|
1038
1077
|
title: e.welcomeTitle,
|
|
1039
1078
|
description: e.welcomeDescription,
|
|
1040
1079
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1041
|
-
icon:
|
|
1080
|
+
icon: he(le, { style: { fontSize: "40px" } })
|
|
1042
1081
|
},
|
|
1043
1082
|
prompts: {
|
|
1044
1083
|
items: []
|
|
@@ -1053,7 +1092,7 @@ function Eo() {
|
|
|
1053
1092
|
mcp: {}
|
|
1054
1093
|
};
|
|
1055
1094
|
}
|
|
1056
|
-
function
|
|
1095
|
+
function Un(e) {
|
|
1057
1096
|
return {
|
|
1058
1097
|
conversation: {
|
|
1059
1098
|
items: [],
|
|
@@ -1072,69 +1111,69 @@ function Oo(e) {
|
|
|
1072
1111
|
mcp: void 0
|
|
1073
1112
|
};
|
|
1074
1113
|
}
|
|
1075
|
-
function
|
|
1076
|
-
var
|
|
1077
|
-
const
|
|
1114
|
+
function Fn(e, t) {
|
|
1115
|
+
var n, c, v, b, a, r, u;
|
|
1116
|
+
const o = Un(t);
|
|
1078
1117
|
return {
|
|
1079
1118
|
conversation: {
|
|
1080
|
-
items: ((
|
|
1081
|
-
activeId: ((
|
|
1082
|
-
title: ((
|
|
1119
|
+
items: ((n = e == null ? void 0 : e.conversation) == null ? void 0 : n.items) ?? o.conversation.items,
|
|
1120
|
+
activeId: ((c = e == null ? void 0 : e.conversation) == null ? void 0 : c.activeId) ?? o.conversation.activeId,
|
|
1121
|
+
title: ((v = e == null ? void 0 : e.conversation) == null ? void 0 : v.title) ?? o.conversation.title
|
|
1083
1122
|
},
|
|
1084
1123
|
bubble: {
|
|
1085
|
-
messages: ((
|
|
1124
|
+
messages: ((b = e == null ? void 0 : e.bubble) == null ? void 0 : b.messages) ?? o.bubble.messages
|
|
1086
1125
|
},
|
|
1087
1126
|
sender: {
|
|
1088
|
-
loading: ((a = e == null ? void 0 : e.sender) == null ? void 0 : a.loading) ??
|
|
1089
|
-
disabled: ((
|
|
1090
|
-
submitDisabled: ((
|
|
1127
|
+
loading: ((a = e == null ? void 0 : e.sender) == null ? void 0 : a.loading) ?? o.sender.loading,
|
|
1128
|
+
disabled: ((r = e == null ? void 0 : e.sender) == null ? void 0 : r.disabled) ?? o.sender.disabled,
|
|
1129
|
+
submitDisabled: ((u = e == null ? void 0 : e.sender) == null ? void 0 : u.submitDisabled) ?? o.sender.submitDisabled
|
|
1091
1130
|
},
|
|
1092
1131
|
request: e == null ? void 0 : e.request,
|
|
1093
|
-
model: (e == null ? void 0 : e.model) ??
|
|
1094
|
-
mcp: (e == null ? void 0 : e.mcp) ??
|
|
1132
|
+
model: (e == null ? void 0 : e.model) ?? o.model,
|
|
1133
|
+
mcp: (e == null ? void 0 : e.mcp) ?? o.mcp
|
|
1095
1134
|
};
|
|
1096
1135
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const t =
|
|
1136
|
+
function Wn(e) {
|
|
1137
|
+
const t = Bn(), o = Dn(t.labels, e == null ? void 0 : e.labels);
|
|
1099
1138
|
return {
|
|
1100
|
-
layout:
|
|
1101
|
-
brand:
|
|
1102
|
-
labels:
|
|
1139
|
+
layout: qn(t.layout, e == null ? void 0 : e.layout),
|
|
1140
|
+
brand: jn(t.brand, e == null ? void 0 : e.brand),
|
|
1141
|
+
labels: o,
|
|
1103
1142
|
header: (e == null ? void 0 : e.header) !== !1,
|
|
1104
|
-
history:
|
|
1105
|
-
bubble:
|
|
1106
|
-
welcome:
|
|
1107
|
-
prompts:
|
|
1108
|
-
sender:
|
|
1109
|
-
model:
|
|
1110
|
-
mcp:
|
|
1143
|
+
history: Jn(t.history, e == null ? void 0 : e.history, o),
|
|
1144
|
+
bubble: Zn(t.bubble, e == null ? void 0 : e.bubble),
|
|
1145
|
+
welcome: Gn(t.welcome, e == null ? void 0 : e.welcome, o),
|
|
1146
|
+
prompts: Yn(t.prompts, e == null ? void 0 : e.prompts),
|
|
1147
|
+
sender: Nn(t.sender, e == null ? void 0 : e.sender),
|
|
1148
|
+
model: Hn(e == null ? void 0 : e.model),
|
|
1149
|
+
mcp: Qn(e == null ? void 0 : e.mcp)
|
|
1111
1150
|
};
|
|
1112
1151
|
}
|
|
1113
|
-
function
|
|
1152
|
+
function Dn(e, t) {
|
|
1114
1153
|
return {
|
|
1115
1154
|
...e,
|
|
1116
|
-
...
|
|
1155
|
+
...X(t)
|
|
1117
1156
|
};
|
|
1118
1157
|
}
|
|
1119
|
-
function
|
|
1120
|
-
var
|
|
1158
|
+
function qn(e, t) {
|
|
1159
|
+
var o, n, c;
|
|
1121
1160
|
return {
|
|
1122
1161
|
surface: {
|
|
1123
|
-
mode: ((
|
|
1124
|
-
floatingOptions: (
|
|
1162
|
+
mode: ((o = t == null ? void 0 : t.surface) == null ? void 0 : o.mode) ?? e.surface.mode,
|
|
1163
|
+
floatingOptions: (n = t == null ? void 0 : t.surface) == null ? void 0 : n.floatingOptions
|
|
1125
1164
|
},
|
|
1126
1165
|
emptyState: (t == null ? void 0 : t.emptyState) ?? e.emptyState,
|
|
1127
1166
|
composer: {
|
|
1128
|
-
welcome: ((
|
|
1167
|
+
welcome: ((c = t == null ? void 0 : t.composer) == null ? void 0 : c.welcome) ?? e.composer.welcome
|
|
1129
1168
|
},
|
|
1130
1169
|
contentMaxWidth: (t == null ? void 0 : t.contentMaxWidth) ?? e.contentMaxWidth,
|
|
1131
1170
|
panelPadding: (t == null ? void 0 : t.panelPadding) ?? e.panelPadding,
|
|
1132
1171
|
panelGap: (t == null ? void 0 : t.panelGap) ?? e.panelGap,
|
|
1133
|
-
leftAside:
|
|
1134
|
-
rightAside:
|
|
1172
|
+
leftAside: Kn(e.leftAside, t == null ? void 0 : t.leftAside),
|
|
1173
|
+
rightAside: zn(t == null ? void 0 : t.rightAside)
|
|
1135
1174
|
};
|
|
1136
1175
|
}
|
|
1137
|
-
function
|
|
1176
|
+
function Kn(e, t) {
|
|
1138
1177
|
return t === !1 ? !1 : {
|
|
1139
1178
|
mode: (t == null ? void 0 : t.mode) ?? e.mode,
|
|
1140
1179
|
width: (t == null ? void 0 : t.width) ?? e.width,
|
|
@@ -1143,7 +1182,7 @@ function $o(e, t) {
|
|
|
1143
1182
|
defaultOpen: (t == null ? void 0 : t.defaultOpen) ?? e.defaultOpen
|
|
1144
1183
|
};
|
|
1145
1184
|
}
|
|
1146
|
-
function
|
|
1185
|
+
function zn(e) {
|
|
1147
1186
|
return e === !1 || !e ? !1 : {
|
|
1148
1187
|
open: e == null ? void 0 : e.open,
|
|
1149
1188
|
mode: (e == null ? void 0 : e.mode) ?? "dock",
|
|
@@ -1153,96 +1192,96 @@ function Io(e) {
|
|
|
1153
1192
|
showClose: (e == null ? void 0 : e.showClose) ?? !0
|
|
1154
1193
|
};
|
|
1155
1194
|
}
|
|
1156
|
-
function
|
|
1195
|
+
function jn(e, t) {
|
|
1157
1196
|
return {
|
|
1158
1197
|
...e,
|
|
1159
|
-
...
|
|
1198
|
+
...X(t)
|
|
1160
1199
|
};
|
|
1161
1200
|
}
|
|
1162
|
-
function
|
|
1201
|
+
function Jn(e, t, o) {
|
|
1163
1202
|
if (t === !1)
|
|
1164
1203
|
return !1;
|
|
1165
|
-
const
|
|
1204
|
+
const n = {
|
|
1166
1205
|
...e,
|
|
1167
1206
|
menuItems: [
|
|
1168
|
-
{ id: "rename", text:
|
|
1169
|
-
{ id: "delete", text:
|
|
1207
|
+
{ id: "rename", text: o.renameConversation },
|
|
1208
|
+
{ id: "delete", text: o.deleteConversation }
|
|
1170
1209
|
]
|
|
1171
1210
|
};
|
|
1172
1211
|
return {
|
|
1173
|
-
...
|
|
1174
|
-
...
|
|
1175
|
-
menuItems: t != null && t.menuItems ? [...t.menuItems] : [...
|
|
1212
|
+
...n,
|
|
1213
|
+
...X(t),
|
|
1214
|
+
menuItems: t != null && t.menuItems ? [...t.menuItems] : [...n.menuItems]
|
|
1176
1215
|
};
|
|
1177
1216
|
}
|
|
1178
|
-
function
|
|
1179
|
-
var
|
|
1217
|
+
function Zn(e, t) {
|
|
1218
|
+
var o, n;
|
|
1180
1219
|
return {
|
|
1181
1220
|
...e,
|
|
1182
|
-
...
|
|
1221
|
+
...X(t),
|
|
1183
1222
|
autoScroll: (t == null ? void 0 : t.autoScroll) ?? e.autoScroll,
|
|
1184
1223
|
bubbleProvider: (t == null ? void 0 : t.bubbleProvider) ?? e.bubbleProvider,
|
|
1185
1224
|
bubbleList: {
|
|
1186
1225
|
...e.bubbleList,
|
|
1187
|
-
...
|
|
1226
|
+
...X(t == null ? void 0 : t.bubbleList),
|
|
1188
1227
|
roleConfigs: {
|
|
1189
|
-
...(
|
|
1190
|
-
...
|
|
1228
|
+
...(o = e.bubbleList) == null ? void 0 : o.roleConfigs,
|
|
1229
|
+
...Xn((n = t == null ? void 0 : t.bubbleList) == null ? void 0 : n.roleConfigs)
|
|
1191
1230
|
}
|
|
1192
1231
|
}
|
|
1193
1232
|
};
|
|
1194
1233
|
}
|
|
1195
|
-
function
|
|
1234
|
+
function Gn(e, t, o) {
|
|
1196
1235
|
if (t === !1)
|
|
1197
1236
|
return !1;
|
|
1198
|
-
const
|
|
1237
|
+
const n = {
|
|
1199
1238
|
...e,
|
|
1200
|
-
title:
|
|
1201
|
-
description:
|
|
1239
|
+
title: o.welcomeTitle,
|
|
1240
|
+
description: o.welcomeDescription
|
|
1202
1241
|
};
|
|
1203
1242
|
return {
|
|
1204
|
-
...
|
|
1205
|
-
...
|
|
1206
|
-
title: (t == null ? void 0 : t.title) ??
|
|
1207
|
-
description: (t == null ? void 0 : t.description) ??
|
|
1243
|
+
...n,
|
|
1244
|
+
...X(t),
|
|
1245
|
+
title: (t == null ? void 0 : t.title) ?? n.title,
|
|
1246
|
+
description: (t == null ? void 0 : t.description) ?? n.description
|
|
1208
1247
|
};
|
|
1209
1248
|
}
|
|
1210
|
-
function
|
|
1249
|
+
function Yn(e, t) {
|
|
1211
1250
|
return t === !1 ? !1 : {
|
|
1212
1251
|
...e,
|
|
1213
|
-
...
|
|
1252
|
+
...X(t),
|
|
1214
1253
|
items: [...(t == null ? void 0 : t.items) ?? e.items]
|
|
1215
1254
|
};
|
|
1216
1255
|
}
|
|
1217
|
-
function
|
|
1256
|
+
function Nn(e, t) {
|
|
1218
1257
|
return t === !1 ? !1 : {
|
|
1219
1258
|
...e,
|
|
1220
|
-
...
|
|
1259
|
+
...X(t)
|
|
1221
1260
|
};
|
|
1222
1261
|
}
|
|
1223
|
-
function
|
|
1262
|
+
function Hn(e) {
|
|
1224
1263
|
return e === !1 ? !1 : e ?? {};
|
|
1225
1264
|
}
|
|
1226
|
-
function
|
|
1265
|
+
function Qn(e) {
|
|
1227
1266
|
return e === !1 ? !1 : e ?? {};
|
|
1228
1267
|
}
|
|
1229
|
-
function
|
|
1268
|
+
function X(e) {
|
|
1230
1269
|
const t = {};
|
|
1231
1270
|
if (!e)
|
|
1232
1271
|
return t;
|
|
1233
|
-
for (const
|
|
1234
|
-
e[
|
|
1272
|
+
for (const o of Object.keys(e))
|
|
1273
|
+
e[o] !== void 0 && (t[o] = e[o]);
|
|
1235
1274
|
return t;
|
|
1236
1275
|
}
|
|
1237
|
-
function
|
|
1276
|
+
function Xn(e) {
|
|
1238
1277
|
const t = {};
|
|
1239
1278
|
if (!e)
|
|
1240
1279
|
return t;
|
|
1241
|
-
for (const [
|
|
1242
|
-
|
|
1280
|
+
for (const [o, n] of Object.entries(e))
|
|
1281
|
+
n !== void 0 && (t[o] = n);
|
|
1243
1282
|
return t;
|
|
1244
1283
|
}
|
|
1245
|
-
function
|
|
1284
|
+
function xn(e) {
|
|
1246
1285
|
if (e instanceof Error)
|
|
1247
1286
|
return e.message || String(e);
|
|
1248
1287
|
if (typeof e == "string")
|
|
@@ -1257,225 +1296,240 @@ function zo(e) {
|
|
|
1257
1296
|
}
|
|
1258
1297
|
return String(e);
|
|
1259
1298
|
}
|
|
1260
|
-
const
|
|
1299
|
+
const _n = { class: "chat-panel-content chat-panel-content--header" }, eo = { class: "chat-panel" }, to = {
|
|
1261
1300
|
key: 0,
|
|
1262
1301
|
class: "chat-request-error",
|
|
1263
1302
|
role: "alert"
|
|
1264
|
-
},
|
|
1303
|
+
}, no = { class: "chat-scroll-actions" }, oo = {
|
|
1265
1304
|
key: 0,
|
|
1266
1305
|
class: "chat-panel-content chat-panel-content--footer"
|
|
1267
|
-
},
|
|
1306
|
+
}, so = {
|
|
1307
|
+
key: 1,
|
|
1308
|
+
class: "chat-right-aside-title"
|
|
1309
|
+
}, ao = /* @__PURE__ */ Z({
|
|
1268
1310
|
__name: "ChatUI",
|
|
1269
1311
|
props: {
|
|
1270
1312
|
data: {},
|
|
1271
1313
|
ui: {},
|
|
1272
1314
|
inputValue: {},
|
|
1273
1315
|
defaultInputValue: {},
|
|
1274
|
-
floatingState: {}
|
|
1316
|
+
floatingState: {},
|
|
1317
|
+
rightAsidePanel: {}
|
|
1275
1318
|
},
|
|
1276
|
-
emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "update:inputValue", "submit", "cancel", "clear", "create-conversation", "switch-conversation", "rename-conversation", "delete-conversation", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "model-select", "model-feature-change", "mcp-add-server", "mcp-remove-server", "mcp-server-enabled-change", "mcp-tool-enabled-change", "left-aside-open-change", "right-aside-open-change"],
|
|
1319
|
+
emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "update:inputValue", "submit", "cancel", "clear", "create-conversation", "switch-conversation", "rename-conversation", "delete-conversation", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "model-select", "model-feature-change", "mcp-add-server", "mcp-remove-server", "mcp-server-enabled-change", "mcp-tool-enabled-change", "left-aside-open-change", "right-aside-open-change", "update:right-aside-panel"],
|
|
1277
1320
|
setup(e, { emit: t }) {
|
|
1278
|
-
const
|
|
1321
|
+
const o = e, n = t, c = st(), v = o.inputValue !== void 0, b = K(o.inputValue ?? o.defaultInputValue ?? ""), a = K(null), u = ct({
|
|
1279
1322
|
mobile: 0,
|
|
1280
1323
|
desktop: 960
|
|
1281
|
-
}).smaller("desktop"), { width:
|
|
1282
|
-
() =>
|
|
1283
|
-
),
|
|
1284
|
-
() =>
|
|
1285
|
-
), i = h(() =>
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1324
|
+
}).smaller("desktop"), { width: y } = ft(), f = h(() => Wn(o.ui)), m = h(() => Fn(o.data, f.value.labels)), k = h(() => v ? o.inputValue ?? "" : b.value), T = h(() => f.value.header !== !1), E = h(() => f.value.layout.leftAside), R = h(() => f.value.layout.rightAside), I = !!c["layout-right-aside"], d = !!c["layout-right-aside-content"], s = h(
|
|
1325
|
+
() => f.value.history === !1 ? { menuItems: [] } : f.value.history
|
|
1326
|
+
), l = h(
|
|
1327
|
+
() => f.value.sender === !1 ? void 0 : f.value.sender
|
|
1328
|
+
), i = h(() => f.value.model === !1 ? void 0 : m.value.model), A = h(() => f.value.mcp === !1 ? void 0 : m.value.mcp), M = h(() => {
|
|
1329
|
+
var g, w;
|
|
1330
|
+
return (((w = (g = A.value) == null ? void 0 : g.servers) == null ? void 0 : w.length) ?? 0) > 0;
|
|
1331
|
+
}), $ = h(() => I || d || M.value), V = h(() => R.value), x = h(() => f.value.sender !== !1), G = h(() => E.value !== !1), Q = h(() => $.value && V.value !== !1), L = In({
|
|
1332
|
+
leftAside: E,
|
|
1333
|
+
rightAside: V,
|
|
1334
|
+
rightAsidePanel: () => o.rightAsidePanel,
|
|
1335
|
+
isMobileViewport: u,
|
|
1336
|
+
viewportWidth: y,
|
|
1337
|
+
onLeftOpenChange: (g) => n("left-aside-open-change", g),
|
|
1338
|
+
onRightOpenChange: (g) => n("right-aside-open-change", g),
|
|
1339
|
+
onRightAsidePanelChange: (g) => n("update:right-aside-panel", g)
|
|
1340
|
+
}), ze = h(
|
|
1341
|
+
() => L.resolvedRightAsidePanel.value ?? (M.value ? "mcp" : void 0)
|
|
1342
|
+
), je = h(
|
|
1343
|
+
() => f.value.bubble.bubbleList.roleConfigs ?? { system: { hidden: !0 } }
|
|
1344
|
+
), ce = h(
|
|
1345
|
+
() => m.value.bubble.messages.filter((g) => !Ne(g.role))
|
|
1346
|
+
), te = h(() => ce.value.length === 0), Je = !!c["layout-main"], Ze = h(() => te.value && f.value.layout.emptyState === "center"), fe = h(
|
|
1347
|
+
() => te.value && l.value !== void 0 && f.value.welcome !== !1 && f.value.layout.composer.welcome === "center" && !Je
|
|
1348
|
+
), ne = h(() => {
|
|
1299
1349
|
var g;
|
|
1300
|
-
return (g =
|
|
1301
|
-
}),
|
|
1350
|
+
return (g = m.value.request) == null ? void 0 : g.error;
|
|
1351
|
+
}), Ge = h(() => ({
|
|
1302
1352
|
containerType: "inline-size",
|
|
1303
1353
|
"--tr-layout-left-aside-bg": "var(--tr-chat-ui-left-aside-bg, var(--tr-container-bg-default))",
|
|
1304
1354
|
"--tr-layout-right-aside-bg": "var(--tr-chat-ui-right-aside-bg, var(--tr-container-bg-default))",
|
|
1305
1355
|
"--tr-layout-header-bg": "var(--tr-chat-ui-header-bg, var(--tr-container-bg-default))",
|
|
1306
1356
|
"--tr-layout-main-bg": "var(--tr-chat-ui-main-bg, var(--tr-container-bg-default))",
|
|
1307
1357
|
"--tr-layout-footer-bg": "var(--tr-chat-ui-footer-bg, var(--tr-container-bg-default))",
|
|
1308
|
-
"--tr-chat-ui-content-max-width":
|
|
1309
|
-
"--tr-chat-ui-panel-padding":
|
|
1310
|
-
"--tr-chat-ui-panel-gap":
|
|
1311
|
-
})),
|
|
1312
|
-
const g =
|
|
1313
|
-
leftAside:
|
|
1314
|
-
rightAside:
|
|
1358
|
+
"--tr-chat-ui-content-max-width": ve(f.value.layout.contentMaxWidth),
|
|
1359
|
+
"--tr-chat-ui-panel-padding": ve(f.value.layout.panelPadding),
|
|
1360
|
+
"--tr-chat-ui-panel-gap": ve(f.value.layout.panelGap)
|
|
1361
|
+
})), Ye = h(() => {
|
|
1362
|
+
const g = f.value.layout, w = {
|
|
1363
|
+
leftAside: G.value ? L.leftAsideOptions.value : void 0,
|
|
1364
|
+
rightAside: Q.value ? L.rightAsideOptions.value : void 0
|
|
1315
1365
|
};
|
|
1316
1366
|
return g.surface.mode === "floating" ? {
|
|
1317
|
-
...
|
|
1367
|
+
...w,
|
|
1318
1368
|
mode: "floating",
|
|
1319
|
-
floatingState:
|
|
1369
|
+
floatingState: o.floatingState,
|
|
1320
1370
|
floatingOptions: g.surface.floatingOptions
|
|
1321
1371
|
} : {
|
|
1322
|
-
...
|
|
1372
|
+
...w,
|
|
1323
1373
|
mode: "normal"
|
|
1324
1374
|
};
|
|
1325
1375
|
});
|
|
1326
|
-
function
|
|
1376
|
+
function ve(g) {
|
|
1327
1377
|
return typeof g == "number" ? `${g}px` : g;
|
|
1328
1378
|
}
|
|
1329
|
-
function
|
|
1330
|
-
var
|
|
1331
|
-
return g ? !!((
|
|
1379
|
+
function Ne(g) {
|
|
1380
|
+
var w;
|
|
1381
|
+
return g ? !!((w = je.value[g]) != null && w.hidden) : !1;
|
|
1332
1382
|
}
|
|
1333
1383
|
function oe() {
|
|
1334
|
-
|
|
1384
|
+
n("create-conversation"), L.isLeftAsideDrawer.value && L.closeLeftAside();
|
|
1385
|
+
}
|
|
1386
|
+
function ke(g) {
|
|
1387
|
+
n("switch-conversation", { id: g.id }), L.isLeftAsideDrawer.value && L.closeLeftAside();
|
|
1335
1388
|
}
|
|
1336
|
-
function
|
|
1337
|
-
|
|
1389
|
+
function Ee(g, w) {
|
|
1390
|
+
n("rename-conversation", { id: g.id, title: w });
|
|
1338
1391
|
}
|
|
1339
|
-
function
|
|
1340
|
-
|
|
1392
|
+
function He(g, w) {
|
|
1393
|
+
n("history-action", { action: g, conversation: w });
|
|
1341
1394
|
}
|
|
1342
|
-
function
|
|
1343
|
-
|
|
1395
|
+
function Qe(g) {
|
|
1396
|
+
n("delete-conversation", { id: g.id });
|
|
1344
1397
|
}
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1398
|
+
function Xe(g, w) {
|
|
1399
|
+
n("prompt-click", { event: g, item: w });
|
|
1347
1400
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1401
|
+
function Oe(g) {
|
|
1402
|
+
n("submit", g);
|
|
1350
1403
|
}
|
|
1351
|
-
function
|
|
1352
|
-
|
|
1404
|
+
function Re() {
|
|
1405
|
+
n("cancel");
|
|
1353
1406
|
}
|
|
1354
|
-
function
|
|
1355
|
-
|
|
1407
|
+
function Te() {
|
|
1408
|
+
me(""), n("clear");
|
|
1356
1409
|
}
|
|
1357
|
-
function
|
|
1358
|
-
|
|
1410
|
+
function Me() {
|
|
1411
|
+
M.value && L.openRightAside("mcp");
|
|
1359
1412
|
}
|
|
1360
|
-
function
|
|
1361
|
-
|
|
1413
|
+
function me(g) {
|
|
1414
|
+
v || (b.value = g), n("update:inputValue", g);
|
|
1362
1415
|
}
|
|
1363
|
-
function
|
|
1364
|
-
|
|
1416
|
+
function xe(g) {
|
|
1417
|
+
n("bubble-state-change", g);
|
|
1365
1418
|
}
|
|
1366
|
-
function
|
|
1367
|
-
|
|
1419
|
+
function _e(g) {
|
|
1420
|
+
n("bubble-event", g);
|
|
1368
1421
|
}
|
|
1369
|
-
return (g,
|
|
1422
|
+
return (g, w) => (P(), W(p(pe), N(Ye.value, {
|
|
1370
1423
|
class: "tr-chat-ui",
|
|
1371
|
-
style:
|
|
1372
|
-
onLeftAsideOpenChange:
|
|
1373
|
-
onRightAsideOpenChange:
|
|
1374
|
-
"onUpdate:floatingState":
|
|
1375
|
-
onFloatingDragStart:
|
|
1376
|
-
onFloatingDrag:
|
|
1377
|
-
onFloatingDragEnd:
|
|
1378
|
-
onFloatingResizeStart:
|
|
1379
|
-
onFloatingResize:
|
|
1380
|
-
onFloatingResizeEnd:
|
|
1381
|
-
}),
|
|
1382
|
-
main:
|
|
1383
|
-
|
|
1384
|
-
|
|
1424
|
+
style: Ge.value,
|
|
1425
|
+
onLeftAsideOpenChange: p(L).handleLeftAsideOpenChange,
|
|
1426
|
+
onRightAsideOpenChange: p(L).handleRightAsideOpenChange,
|
|
1427
|
+
"onUpdate:floatingState": w[16] || (w[16] = (O) => n("update:floating-state", O)),
|
|
1428
|
+
onFloatingDragStart: w[17] || (w[17] = (O) => n("floating-drag-start", O)),
|
|
1429
|
+
onFloatingDrag: w[18] || (w[18] = (O) => n("floating-drag", O)),
|
|
1430
|
+
onFloatingDragEnd: w[19] || (w[19] = (O) => n("floating-drag-end", O)),
|
|
1431
|
+
onFloatingResizeStart: w[20] || (w[20] = (O) => n("floating-resize-start", O)),
|
|
1432
|
+
onFloatingResize: w[21] || (w[21] = (O) => n("floating-resize", O)),
|
|
1433
|
+
onFloatingResizeEnd: w[22] || (w[22] = (O) => n("floating-resize-end", O))
|
|
1434
|
+
}), J({
|
|
1435
|
+
main: S(() => [
|
|
1436
|
+
B("section", eo, [
|
|
1437
|
+
B("div", {
|
|
1385
1438
|
ref_key: "scrollTarget",
|
|
1386
1439
|
ref: a,
|
|
1387
1440
|
class: "chat-main-scroll-host"
|
|
1388
1441
|
}, [
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1442
|
+
ne.value !== void 0 && ne.value !== null ? (P(), F("div", to, [
|
|
1443
|
+
C(g.$slots, "request-error", { error: ne.value }, () => [
|
|
1444
|
+
Be(H(p(xn)(ne.value)), 1)
|
|
1392
1445
|
], !0)
|
|
1393
|
-
])) :
|
|
1394
|
-
|
|
1395
|
-
messages:
|
|
1446
|
+
])) : U("", !0),
|
|
1447
|
+
D(wn, {
|
|
1448
|
+
messages: ce.value,
|
|
1396
1449
|
"scroll-target": a.value,
|
|
1397
|
-
options:
|
|
1398
|
-
welcome:
|
|
1399
|
-
prompts:
|
|
1400
|
-
labels:
|
|
1401
|
-
"center-empty-state":
|
|
1402
|
-
"center-welcome-composer":
|
|
1403
|
-
onPromptClick:
|
|
1404
|
-
onBubbleStateChange:
|
|
1405
|
-
onBubbleEvent:
|
|
1406
|
-
},
|
|
1450
|
+
options: f.value.bubble,
|
|
1451
|
+
welcome: f.value.welcome,
|
|
1452
|
+
prompts: f.value.prompts,
|
|
1453
|
+
labels: f.value.labels,
|
|
1454
|
+
"center-empty-state": Ze.value,
|
|
1455
|
+
"center-welcome-composer": fe.value,
|
|
1456
|
+
onPromptClick: Xe,
|
|
1457
|
+
onBubbleStateChange: xe,
|
|
1458
|
+
onBubbleEvent: _e
|
|
1459
|
+
}, J({ _: 2 }, [
|
|
1407
1460
|
g.$slots["layout-main"] ? {
|
|
1408
1461
|
name: "default",
|
|
1409
|
-
fn:
|
|
1410
|
-
|
|
1411
|
-
messages:
|
|
1412
|
-
request:
|
|
1413
|
-
conversation:
|
|
1462
|
+
fn: S(() => [
|
|
1463
|
+
C(g.$slots, "layout-main", {
|
|
1464
|
+
messages: ce.value,
|
|
1465
|
+
request: m.value.request,
|
|
1466
|
+
conversation: m.value.conversation
|
|
1414
1467
|
}, void 0, !0)
|
|
1415
1468
|
]),
|
|
1416
1469
|
key: "0"
|
|
1417
1470
|
} : void 0,
|
|
1418
1471
|
g.$slots["welcome-footer"] ? {
|
|
1419
1472
|
name: "welcome-footer",
|
|
1420
|
-
fn:
|
|
1421
|
-
|
|
1473
|
+
fn: S(() => [
|
|
1474
|
+
C(g.$slots, "welcome-footer", {}, void 0, !0)
|
|
1422
1475
|
]),
|
|
1423
1476
|
key: "1"
|
|
1424
1477
|
} : void 0,
|
|
1425
1478
|
g.$slots["prompts-footer"] ? {
|
|
1426
1479
|
name: "prompts-footer",
|
|
1427
|
-
fn:
|
|
1428
|
-
|
|
1480
|
+
fn: S(() => [
|
|
1481
|
+
C(g.$slots, "prompts-footer", {}, void 0, !0)
|
|
1429
1482
|
]),
|
|
1430
1483
|
key: "2"
|
|
1431
1484
|
} : void 0,
|
|
1432
|
-
|
|
1485
|
+
fe.value && l.value ? {
|
|
1433
1486
|
name: "welcome-composer",
|
|
1434
|
-
fn:
|
|
1435
|
-
|
|
1487
|
+
fn: S(() => [
|
|
1488
|
+
D($e, {
|
|
1436
1489
|
class: "chat-welcome-composer",
|
|
1437
|
-
sender:
|
|
1438
|
-
value:
|
|
1439
|
-
"sender-options":
|
|
1440
|
-
labels:
|
|
1490
|
+
sender: m.value.sender,
|
|
1491
|
+
value: k.value,
|
|
1492
|
+
"sender-options": l.value,
|
|
1493
|
+
labels: f.value.labels,
|
|
1441
1494
|
model: i.value,
|
|
1442
|
-
mcp:
|
|
1443
|
-
onSubmit:
|
|
1444
|
-
onCancel:
|
|
1445
|
-
onClear:
|
|
1446
|
-
"onUpdate:value":
|
|
1447
|
-
onModelSelect:
|
|
1448
|
-
onModelFeatureChange:
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1495
|
+
mcp: A.value,
|
|
1496
|
+
onSubmit: Oe,
|
|
1497
|
+
onCancel: Re,
|
|
1498
|
+
onClear: Te,
|
|
1499
|
+
"onUpdate:value": me,
|
|
1500
|
+
onModelSelect: w[0] || (w[0] = (O) => n("model-select", O)),
|
|
1501
|
+
onModelFeatureChange: w[1] || (w[1] = (O) => n("model-feature-change", O)),
|
|
1502
|
+
onOpenMcpPanel: Me,
|
|
1503
|
+
onMcpAddServer: w[2] || (w[2] = (O) => n("mcp-add-server", O)),
|
|
1504
|
+
onMcpRemoveServer: w[3] || (w[3] = (O) => n("mcp-remove-server", O)),
|
|
1505
|
+
onMcpServerEnabledChange: w[4] || (w[4] = (O) => n("mcp-server-enabled-change", O)),
|
|
1506
|
+
onMcpToolEnabledChange: w[5] || (w[5] = (O) => n("mcp-tool-enabled-change", O))
|
|
1507
|
+
}, J({ _: 2 }, [
|
|
1454
1508
|
g.$slots["composer-before"] ? {
|
|
1455
1509
|
name: "composer-before",
|
|
1456
|
-
fn:
|
|
1457
|
-
|
|
1510
|
+
fn: S((O) => [
|
|
1511
|
+
C(g.$slots, "composer-before", q(j(O)), void 0, !0)
|
|
1458
1512
|
]),
|
|
1459
1513
|
key: "0"
|
|
1460
1514
|
} : void 0,
|
|
1461
1515
|
g.$slots["layout-footer"] ? {
|
|
1462
1516
|
name: "layout-footer",
|
|
1463
|
-
fn:
|
|
1464
|
-
|
|
1517
|
+
fn: S((O) => [
|
|
1518
|
+
C(g.$slots, "layout-footer", q(j(O)), void 0, !0)
|
|
1465
1519
|
]),
|
|
1466
1520
|
key: "1"
|
|
1467
1521
|
} : void 0,
|
|
1468
1522
|
g.$slots["sender-footer"] ? {
|
|
1469
1523
|
name: "sender-footer",
|
|
1470
|
-
fn:
|
|
1471
|
-
|
|
1524
|
+
fn: S(() => [
|
|
1525
|
+
C(g.$slots, "sender-footer", {}, void 0, !0)
|
|
1472
1526
|
]),
|
|
1473
1527
|
key: "2"
|
|
1474
1528
|
} : void 0,
|
|
1475
1529
|
g.$slots["sender-footer-right"] ? {
|
|
1476
1530
|
name: "sender-footer-right",
|
|
1477
|
-
fn:
|
|
1478
|
-
|
|
1531
|
+
fn: S(() => [
|
|
1532
|
+
C(g.$slots, "sender-footer-right", {}, void 0, !0)
|
|
1479
1533
|
]),
|
|
1480
1534
|
key: "3"
|
|
1481
1535
|
} : void 0
|
|
@@ -1485,75 +1539,75 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
|
|
|
1485
1539
|
} : void 0,
|
|
1486
1540
|
g.$slots["bubble-prefix"] ? {
|
|
1487
1541
|
name: "bubble-prefix",
|
|
1488
|
-
fn:
|
|
1489
|
-
|
|
1542
|
+
fn: S(() => [
|
|
1543
|
+
C(g.$slots, "bubble-prefix", {}, void 0, !0)
|
|
1490
1544
|
]),
|
|
1491
1545
|
key: "4"
|
|
1492
1546
|
} : void 0,
|
|
1493
1547
|
g.$slots["bubble-suffix"] ? {
|
|
1494
1548
|
name: "bubble-suffix",
|
|
1495
|
-
fn:
|
|
1496
|
-
|
|
1549
|
+
fn: S(() => [
|
|
1550
|
+
C(g.$slots, "bubble-suffix", {}, void 0, !0)
|
|
1497
1551
|
]),
|
|
1498
1552
|
key: "5"
|
|
1499
1553
|
} : void 0,
|
|
1500
1554
|
g.$slots["bubble-after"] ? {
|
|
1501
1555
|
name: "bubble-after",
|
|
1502
|
-
fn:
|
|
1503
|
-
|
|
1556
|
+
fn: S(() => [
|
|
1557
|
+
C(g.$slots, "bubble-after", {}, void 0, !0)
|
|
1504
1558
|
]),
|
|
1505
1559
|
key: "6"
|
|
1506
1560
|
} : void 0,
|
|
1507
1561
|
g.$slots["bubble-content-footer"] ? {
|
|
1508
1562
|
name: "bubble-content-footer",
|
|
1509
|
-
fn:
|
|
1510
|
-
|
|
1563
|
+
fn: S(() => [
|
|
1564
|
+
C(g.$slots, "bubble-content-footer", {}, void 0, !0)
|
|
1511
1565
|
]),
|
|
1512
1566
|
key: "7"
|
|
1513
1567
|
} : void 0
|
|
1514
1568
|
]), 1032, ["messages", "scroll-target", "options", "welcome", "prompts", "labels", "center-empty-state", "center-welcome-composer"])
|
|
1515
1569
|
], 512)
|
|
1516
1570
|
]),
|
|
1517
|
-
|
|
1518
|
-
|
|
1571
|
+
B("div", no, [
|
|
1572
|
+
D(Vt, { target: a.value }, null, 8, ["target"])
|
|
1519
1573
|
]),
|
|
1520
|
-
|
|
1574
|
+
D(p(pe).ProxyScrollbar, { "scroll-target": a.value }, null, 8, ["scroll-target"])
|
|
1521
1575
|
]),
|
|
1522
1576
|
_: 2
|
|
1523
1577
|
}, [
|
|
1524
|
-
|
|
1578
|
+
G.value ? {
|
|
1525
1579
|
name: "left-aside",
|
|
1526
|
-
fn:
|
|
1527
|
-
|
|
1528
|
-
conversation:
|
|
1529
|
-
history:
|
|
1530
|
-
brand:
|
|
1531
|
-
labels:
|
|
1532
|
-
"is-open":
|
|
1533
|
-
"is-dock":
|
|
1534
|
-
"show-history":
|
|
1580
|
+
fn: S(() => [
|
|
1581
|
+
D(zt, {
|
|
1582
|
+
conversation: m.value.conversation,
|
|
1583
|
+
history: s.value,
|
|
1584
|
+
brand: f.value.brand,
|
|
1585
|
+
labels: f.value.labels,
|
|
1586
|
+
"is-open": p(L).resolvedLeftAsideOpen.value,
|
|
1587
|
+
"is-dock": p(L).isLeftAsideDock.value,
|
|
1588
|
+
"show-history": f.value.history !== !1,
|
|
1535
1589
|
onCreateConversation: oe,
|
|
1536
|
-
onSwitchConversation:
|
|
1537
|
-
onRenameConversation:
|
|
1538
|
-
onDeleteConversation:
|
|
1539
|
-
onHistoryAction:
|
|
1540
|
-
onOpen:
|
|
1541
|
-
onClose:
|
|
1542
|
-
onToggle:
|
|
1543
|
-
},
|
|
1590
|
+
onSwitchConversation: ke,
|
|
1591
|
+
onRenameConversation: Ee,
|
|
1592
|
+
onDeleteConversation: Qe,
|
|
1593
|
+
onHistoryAction: He,
|
|
1594
|
+
onOpen: p(L).openLeftAside,
|
|
1595
|
+
onClose: p(L).closeLeftAside,
|
|
1596
|
+
onToggle: p(L).toggleLeftAside
|
|
1597
|
+
}, J({ _: 2 }, [
|
|
1544
1598
|
g.$slots["layout-left-aside"] ? {
|
|
1545
1599
|
name: "default",
|
|
1546
|
-
fn:
|
|
1547
|
-
|
|
1548
|
-
conversation:
|
|
1549
|
-
isOpen:
|
|
1600
|
+
fn: S(() => [
|
|
1601
|
+
C(g.$slots, "layout-left-aside", {
|
|
1602
|
+
conversation: m.value.conversation,
|
|
1603
|
+
isOpen: p(L).resolvedLeftAsideOpen.value,
|
|
1550
1604
|
createConversation: oe,
|
|
1551
|
-
switchConversation: (
|
|
1552
|
-
renameConversation: (
|
|
1553
|
-
deleteConversation: (
|
|
1554
|
-
openLeftAside:
|
|
1555
|
-
closeLeftAside:
|
|
1556
|
-
toggleLeftAside:
|
|
1605
|
+
switchConversation: (O) => ke({ id: O }),
|
|
1606
|
+
renameConversation: (O, et) => Ee({ id: O }, et),
|
|
1607
|
+
deleteConversation: (O) => n("delete-conversation", { id: O }),
|
|
1608
|
+
openLeftAside: p(L).openLeftAside,
|
|
1609
|
+
closeLeftAside: p(L).closeLeftAside,
|
|
1610
|
+
toggleLeftAside: p(L).toggleLeftAside
|
|
1557
1611
|
}, void 0, !0)
|
|
1558
1612
|
]),
|
|
1559
1613
|
key: "0"
|
|
@@ -1562,47 +1616,47 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
|
|
|
1562
1616
|
]),
|
|
1563
1617
|
key: "0"
|
|
1564
1618
|
} : void 0,
|
|
1565
|
-
|
|
1619
|
+
T.value ? {
|
|
1566
1620
|
name: "header",
|
|
1567
|
-
fn:
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
title:
|
|
1571
|
-
"is-empty":
|
|
1572
|
-
conversation:
|
|
1573
|
-
"is-left-aside-visible":
|
|
1574
|
-
"is-left-aside-drawer":
|
|
1575
|
-
"is-left-aside-open":
|
|
1576
|
-
"is-right-aside-visible":
|
|
1577
|
-
"is-right-aside-open":
|
|
1578
|
-
labels:
|
|
1621
|
+
fn: S(() => [
|
|
1622
|
+
B("div", _n, [
|
|
1623
|
+
D(yn, {
|
|
1624
|
+
title: m.value.conversation.title,
|
|
1625
|
+
"is-empty": te.value,
|
|
1626
|
+
conversation: m.value.conversation,
|
|
1627
|
+
"is-left-aside-visible": G.value,
|
|
1628
|
+
"is-left-aside-drawer": p(L).isLeftAsideDrawer.value,
|
|
1629
|
+
"is-left-aside-open": p(L).resolvedLeftAsideOpen.value,
|
|
1630
|
+
"is-right-aside-visible": Q.value,
|
|
1631
|
+
"is-right-aside-open": p(L).resolvedRightAsideOpen.value,
|
|
1632
|
+
labels: f.value.labels,
|
|
1579
1633
|
onCreateConversation: oe,
|
|
1580
|
-
onOpenLeftAside:
|
|
1581
|
-
onCloseLeftAside:
|
|
1582
|
-
onToggleLeftAside:
|
|
1583
|
-
onOpenRightAside:
|
|
1584
|
-
},
|
|
1634
|
+
onOpenLeftAside: p(L).openLeftAside,
|
|
1635
|
+
onCloseLeftAside: p(L).closeLeftAside,
|
|
1636
|
+
onToggleLeftAside: p(L).toggleLeftAside,
|
|
1637
|
+
onOpenRightAside: p(L).openRightAside
|
|
1638
|
+
}, J({ _: 2 }, [
|
|
1585
1639
|
g.$slots["header-notice"] ? {
|
|
1586
1640
|
name: "notice",
|
|
1587
|
-
fn:
|
|
1588
|
-
|
|
1641
|
+
fn: S(() => [
|
|
1642
|
+
C(g.$slots, "header-notice", {}, void 0, !0)
|
|
1589
1643
|
]),
|
|
1590
1644
|
key: "0"
|
|
1591
1645
|
} : void 0,
|
|
1592
1646
|
g.$slots["layout-header"] ? {
|
|
1593
1647
|
name: "default",
|
|
1594
|
-
fn:
|
|
1595
|
-
|
|
1596
|
-
title:
|
|
1597
|
-
isEmpty:
|
|
1598
|
-
conversation:
|
|
1648
|
+
fn: S(() => [
|
|
1649
|
+
C(g.$slots, "layout-header", {
|
|
1650
|
+
title: m.value.conversation.title,
|
|
1651
|
+
isEmpty: te.value,
|
|
1652
|
+
conversation: m.value.conversation,
|
|
1599
1653
|
createConversation: oe,
|
|
1600
|
-
isLeftAsideOpen:
|
|
1601
|
-
openLeftAside:
|
|
1602
|
-
closeLeftAside:
|
|
1603
|
-
toggleLeftAside:
|
|
1604
|
-
openRightAside:
|
|
1605
|
-
closeRightAside:
|
|
1654
|
+
isLeftAsideOpen: p(L).resolvedLeftAsideOpen.value,
|
|
1655
|
+
openLeftAside: p(L).openLeftAside,
|
|
1656
|
+
closeLeftAside: p(L).closeLeftAside,
|
|
1657
|
+
toggleLeftAside: p(L).toggleLeftAside,
|
|
1658
|
+
openRightAside: p(L).openRightAside,
|
|
1659
|
+
closeRightAside: p(L).closeRightAside
|
|
1606
1660
|
}, void 0, !0)
|
|
1607
1661
|
]),
|
|
1608
1662
|
key: "1"
|
|
@@ -1612,53 +1666,54 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
|
|
|
1612
1666
|
]),
|
|
1613
1667
|
key: "1"
|
|
1614
1668
|
} : void 0,
|
|
1615
|
-
|
|
1669
|
+
x.value && l.value ? {
|
|
1616
1670
|
name: "footer",
|
|
1617
|
-
fn:
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
sender:
|
|
1621
|
-
value:
|
|
1622
|
-
"sender-options":
|
|
1623
|
-
labels:
|
|
1671
|
+
fn: S(() => [
|
|
1672
|
+
fe.value ? U("", !0) : (P(), F("div", oo, [
|
|
1673
|
+
D($e, {
|
|
1674
|
+
sender: m.value.sender,
|
|
1675
|
+
value: k.value,
|
|
1676
|
+
"sender-options": l.value,
|
|
1677
|
+
labels: f.value.labels,
|
|
1624
1678
|
model: i.value,
|
|
1625
|
-
mcp:
|
|
1626
|
-
onSubmit:
|
|
1627
|
-
onCancel:
|
|
1628
|
-
onClear:
|
|
1629
|
-
"onUpdate:value":
|
|
1630
|
-
onModelSelect:
|
|
1631
|
-
onModelFeatureChange:
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1679
|
+
mcp: A.value,
|
|
1680
|
+
onSubmit: Oe,
|
|
1681
|
+
onCancel: Re,
|
|
1682
|
+
onClear: Te,
|
|
1683
|
+
"onUpdate:value": me,
|
|
1684
|
+
onModelSelect: w[6] || (w[6] = (O) => n("model-select", O)),
|
|
1685
|
+
onModelFeatureChange: w[7] || (w[7] = (O) => n("model-feature-change", O)),
|
|
1686
|
+
onOpenMcpPanel: Me,
|
|
1687
|
+
onMcpAddServer: w[8] || (w[8] = (O) => n("mcp-add-server", O)),
|
|
1688
|
+
onMcpRemoveServer: w[9] || (w[9] = (O) => n("mcp-remove-server", O)),
|
|
1689
|
+
onMcpServerEnabledChange: w[10] || (w[10] = (O) => n("mcp-server-enabled-change", O)),
|
|
1690
|
+
onMcpToolEnabledChange: w[11] || (w[11] = (O) => n("mcp-tool-enabled-change", O))
|
|
1691
|
+
}, J({ _: 2 }, [
|
|
1637
1692
|
g.$slots["composer-before"] ? {
|
|
1638
1693
|
name: "composer-before",
|
|
1639
|
-
fn:
|
|
1640
|
-
|
|
1694
|
+
fn: S((O) => [
|
|
1695
|
+
C(g.$slots, "composer-before", q(j(O)), void 0, !0)
|
|
1641
1696
|
]),
|
|
1642
1697
|
key: "0"
|
|
1643
1698
|
} : void 0,
|
|
1644
1699
|
g.$slots["layout-footer"] ? {
|
|
1645
1700
|
name: "layout-footer",
|
|
1646
|
-
fn:
|
|
1647
|
-
|
|
1701
|
+
fn: S((O) => [
|
|
1702
|
+
C(g.$slots, "layout-footer", q(j(O)), void 0, !0)
|
|
1648
1703
|
]),
|
|
1649
1704
|
key: "1"
|
|
1650
1705
|
} : void 0,
|
|
1651
1706
|
g.$slots["sender-footer"] ? {
|
|
1652
1707
|
name: "sender-footer",
|
|
1653
|
-
fn:
|
|
1654
|
-
|
|
1708
|
+
fn: S(() => [
|
|
1709
|
+
C(g.$slots, "sender-footer", {}, void 0, !0)
|
|
1655
1710
|
]),
|
|
1656
1711
|
key: "2"
|
|
1657
1712
|
} : void 0,
|
|
1658
1713
|
g.$slots["sender-footer-right"] ? {
|
|
1659
1714
|
name: "sender-footer-right",
|
|
1660
|
-
fn:
|
|
1661
|
-
|
|
1715
|
+
fn: S(() => [
|
|
1716
|
+
C(g.$slots, "sender-footer-right", {}, void 0, !0)
|
|
1662
1717
|
]),
|
|
1663
1718
|
key: "3"
|
|
1664
1719
|
} : void 0
|
|
@@ -1667,382 +1722,408 @@ const jo = { class: "chat-panel-content chat-panel-content--header" }, Jo = { cl
|
|
|
1667
1722
|
]),
|
|
1668
1723
|
key: "2"
|
|
1669
1724
|
} : void 0,
|
|
1670
|
-
|
|
1725
|
+
Q.value ? {
|
|
1671
1726
|
name: "right-aside",
|
|
1672
|
-
fn:
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1727
|
+
fn: S(() => [
|
|
1728
|
+
p(I) ? C(g.$slots, "layout-right-aside", {
|
|
1729
|
+
panel: ze.value,
|
|
1730
|
+
openRightAside: p(L).openRightAside,
|
|
1731
|
+
closeRightAside: p(L).closeRightAside,
|
|
1732
|
+
isRightAsideOpen: p(L).resolvedRightAsideOpen.value
|
|
1733
|
+
}, void 0, !0, 0) : p(d) ? (P(), W(Tn, {
|
|
1734
|
+
key: 1,
|
|
1735
|
+
"show-close": V.value !== !1 ? V.value.showClose : !0,
|
|
1736
|
+
labels: f.value.labels,
|
|
1737
|
+
onClose: p(L).closeRightAside
|
|
1677
1738
|
}, {
|
|
1678
|
-
title:
|
|
1679
|
-
|
|
1680
|
-
V("h2", No, Q(c.value.labels.rightAsideTitle), 1)
|
|
1681
|
-
], !0)
|
|
1739
|
+
title: S(() => [
|
|
1740
|
+
g.$slots["layout-right-aside-title"] ? C(g.$slots, "layout-right-aside-title", {}, void 0, !0, 0) : (P(), F("h2", so, H(f.value.labels.rightAsideTitle), 1))
|
|
1682
1741
|
]),
|
|
1683
|
-
default:
|
|
1684
|
-
|
|
1742
|
+
default: S(() => [
|
|
1743
|
+
C(g.$slots, "layout-right-aside-content", {}, void 0, !0)
|
|
1685
1744
|
]),
|
|
1686
1745
|
_: 3
|
|
1687
|
-
}, 8, ["show-close", "labels", "onClose"])
|
|
1746
|
+
}, 8, ["show-close", "labels", "onClose"])) : M.value && A.value ? (P(), W($n, {
|
|
1747
|
+
key: 2,
|
|
1748
|
+
mcp: A.value,
|
|
1749
|
+
labels: f.value.labels,
|
|
1750
|
+
onClose: p(L).closeRightAside,
|
|
1751
|
+
onAddServer: w[12] || (w[12] = (O) => n("mcp-add-server", O)),
|
|
1752
|
+
onRemoveServer: w[13] || (w[13] = (O) => n("mcp-remove-server", O)),
|
|
1753
|
+
onUpdateServerEnabled: w[14] || (w[14] = (O) => n("mcp-server-enabled-change", O)),
|
|
1754
|
+
onUpdateToolEnabled: w[15] || (w[15] = (O) => n("mcp-tool-enabled-change", O))
|
|
1755
|
+
}, null, 8, ["mcp", "labels", "onClose"])) : U("", !0)
|
|
1688
1756
|
]),
|
|
1689
1757
|
key: "3"
|
|
1690
1758
|
} : void 0
|
|
1691
1759
|
]), 1040, ["style", "onLeftAsideOpenChange", "onRightAsideOpenChange"]));
|
|
1692
1760
|
}
|
|
1693
|
-
}),
|
|
1694
|
-
function
|
|
1695
|
-
const t =
|
|
1696
|
-
function
|
|
1697
|
-
t.value =
|
|
1761
|
+
}), lo = /* @__PURE__ */ Y(ao, [["__scopeId", "data-v-ce27d8ee"]]);
|
|
1762
|
+
function ro(e) {
|
|
1763
|
+
const t = K("");
|
|
1764
|
+
function o(c) {
|
|
1765
|
+
t.value = c;
|
|
1698
1766
|
}
|
|
1699
|
-
async function
|
|
1700
|
-
const
|
|
1701
|
-
if (!
|
|
1767
|
+
async function n(c) {
|
|
1768
|
+
const v = c.text.trim();
|
|
1769
|
+
if (!v)
|
|
1702
1770
|
return !1;
|
|
1703
|
-
const
|
|
1771
|
+
const b = c.text;
|
|
1704
1772
|
try {
|
|
1705
1773
|
t.value = "", await Promise.resolve();
|
|
1706
1774
|
const a = await e.send({
|
|
1707
|
-
...
|
|
1708
|
-
text:
|
|
1775
|
+
...c,
|
|
1776
|
+
text: v
|
|
1709
1777
|
});
|
|
1710
|
-
return !a && t.value === "" && (t.value =
|
|
1778
|
+
return !a && t.value === "" && (t.value = b), a;
|
|
1711
1779
|
} catch (a) {
|
|
1712
|
-
throw t.value === "" && (t.value =
|
|
1780
|
+
throw t.value === "" && (t.value = b), a;
|
|
1713
1781
|
}
|
|
1714
1782
|
}
|
|
1715
1783
|
return {
|
|
1716
1784
|
inputValue: t,
|
|
1717
|
-
setInputValue:
|
|
1718
|
-
send:
|
|
1785
|
+
setInputValue: o,
|
|
1786
|
+
send: n,
|
|
1719
1787
|
abort: e.abort
|
|
1720
1788
|
};
|
|
1721
1789
|
}
|
|
1722
|
-
function
|
|
1723
|
-
const t = h(() =>
|
|
1724
|
-
send: async (
|
|
1725
|
-
}),
|
|
1726
|
-
var
|
|
1727
|
-
const
|
|
1728
|
-
for (const [
|
|
1729
|
-
|
|
1730
|
-
(
|
|
1731
|
-
...
|
|
1732
|
-
loading:
|
|
1790
|
+
function io(e) {
|
|
1791
|
+
const t = h(() => z(e.runtime)), o = h(() => t.value.activeConversation.value), n = K(!1), c = K(/* @__PURE__ */ new Set()), v = K(/* @__PURE__ */ new Set()), b = K(/* @__PURE__ */ new Set()), a = ro({
|
|
1792
|
+
send: async (s) => await f("send", s, () => t.value.actions.send(s)) ?? !1
|
|
1793
|
+
}), r = h(() => {
|
|
1794
|
+
var V, x;
|
|
1795
|
+
const s = o.value, l = t.value.composer.model, i = t.value.composer.mcp, A = {};
|
|
1796
|
+
for (const [G, Q] of Object.entries((i == null ? void 0 : i.tools.value) ?? {}))
|
|
1797
|
+
Q && (A[G] = Q.map(
|
|
1798
|
+
(L) => ({
|
|
1799
|
+
...L,
|
|
1800
|
+
loading: b.value.has(y(G, L.id))
|
|
1733
1801
|
})
|
|
1734
1802
|
));
|
|
1735
|
-
const
|
|
1736
|
-
options:
|
|
1737
|
-
selectedId:
|
|
1738
|
-
features:
|
|
1739
|
-
selecting:
|
|
1740
|
-
pendingFeatureIds: [...
|
|
1741
|
-
} : void 0,
|
|
1742
|
-
servers:
|
|
1743
|
-
(
|
|
1744
|
-
...
|
|
1745
|
-
loading: !!(
|
|
1803
|
+
const M = l ? {
|
|
1804
|
+
options: l.options.value,
|
|
1805
|
+
selectedId: l.selectedId.value,
|
|
1806
|
+
features: l.features.value,
|
|
1807
|
+
selecting: n.value,
|
|
1808
|
+
pendingFeatureIds: [...c.value]
|
|
1809
|
+
} : void 0, $ = i ? {
|
|
1810
|
+
servers: i.servers.value.map(
|
|
1811
|
+
(G) => ({
|
|
1812
|
+
...G,
|
|
1813
|
+
loading: !!(G.loading || v.value.has(G.id))
|
|
1746
1814
|
})
|
|
1747
1815
|
),
|
|
1748
|
-
tools:
|
|
1816
|
+
tools: A
|
|
1749
1817
|
} : void 0;
|
|
1750
1818
|
return {
|
|
1751
1819
|
conversation: {
|
|
1752
1820
|
items: t.value.conversations.value,
|
|
1753
|
-
activeId: (
|
|
1754
|
-
title:
|
|
1821
|
+
activeId: (s == null ? void 0 : s.id) ?? null,
|
|
1822
|
+
title: z(e.title) || (s == null ? void 0 : s.title)
|
|
1755
1823
|
},
|
|
1756
|
-
bubble: { messages: (
|
|
1824
|
+
bubble: { messages: (s == null ? void 0 : s.messages) ?? [] },
|
|
1757
1825
|
sender: {
|
|
1758
|
-
loading: (
|
|
1759
|
-
disabled: !!((
|
|
1760
|
-
submitDisabled: !!((
|
|
1826
|
+
loading: (s == null ? void 0 : s.requestState) === "processing",
|
|
1827
|
+
disabled: !!((V = t.value.composer.disabled) != null && V.value),
|
|
1828
|
+
submitDisabled: !!((x = t.value.composer.submitDisabled) != null && x.value)
|
|
1761
1829
|
},
|
|
1762
|
-
request:
|
|
1763
|
-
state:
|
|
1764
|
-
processingState:
|
|
1765
|
-
error:
|
|
1830
|
+
request: s ? {
|
|
1831
|
+
state: s.requestState,
|
|
1832
|
+
processingState: s.processingState,
|
|
1833
|
+
error: s.lastError ?? void 0
|
|
1766
1834
|
} : void 0,
|
|
1767
|
-
model:
|
|
1768
|
-
mcp:
|
|
1835
|
+
model: M,
|
|
1836
|
+
mcp: $
|
|
1769
1837
|
};
|
|
1770
1838
|
});
|
|
1771
|
-
function
|
|
1772
|
-
const
|
|
1773
|
-
|
|
1839
|
+
function u(s, l, i) {
|
|
1840
|
+
const A = new Set(s.value);
|
|
1841
|
+
i ? A.add(l) : A.delete(l), s.value = A;
|
|
1774
1842
|
}
|
|
1775
|
-
function
|
|
1776
|
-
return `${
|
|
1843
|
+
function y(s, l) {
|
|
1844
|
+
return `${s}:${l}`;
|
|
1777
1845
|
}
|
|
1778
|
-
async function
|
|
1846
|
+
async function f(s, l, i) {
|
|
1779
1847
|
try {
|
|
1780
|
-
return await
|
|
1781
|
-
} catch (
|
|
1782
|
-
e.onActionError({ action:
|
|
1848
|
+
return await i();
|
|
1849
|
+
} catch (A) {
|
|
1850
|
+
e.onActionError({ action: s, payload: l, error: A });
|
|
1783
1851
|
return;
|
|
1784
1852
|
}
|
|
1785
1853
|
}
|
|
1786
|
-
async function
|
|
1787
|
-
if (!
|
|
1788
|
-
|
|
1854
|
+
async function m(s, l, i) {
|
|
1855
|
+
if (!s.value.has(l)) {
|
|
1856
|
+
u(s, l, !0);
|
|
1789
1857
|
try {
|
|
1790
|
-
await
|
|
1858
|
+
await i();
|
|
1791
1859
|
} finally {
|
|
1792
|
-
|
|
1860
|
+
u(s, l, !1);
|
|
1793
1861
|
}
|
|
1794
1862
|
}
|
|
1795
1863
|
}
|
|
1796
|
-
async function
|
|
1797
|
-
const
|
|
1798
|
-
if (!(!
|
|
1799
|
-
|
|
1864
|
+
async function k(s) {
|
|
1865
|
+
const l = t.value.composer.model;
|
|
1866
|
+
if (!(!l || l.selectedId.value === s || n.value)) {
|
|
1867
|
+
n.value = !0;
|
|
1800
1868
|
try {
|
|
1801
|
-
await
|
|
1869
|
+
await f("select-model", { id: s }, () => l.select(s));
|
|
1802
1870
|
} finally {
|
|
1803
|
-
|
|
1871
|
+
n.value = !1;
|
|
1804
1872
|
}
|
|
1805
1873
|
}
|
|
1806
1874
|
}
|
|
1807
|
-
async function
|
|
1808
|
-
const
|
|
1809
|
-
!
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
() =>
|
|
1875
|
+
async function T(s, l) {
|
|
1876
|
+
const i = t.value.composer.model;
|
|
1877
|
+
!i || i.features.value[s] === l || await m(
|
|
1878
|
+
c,
|
|
1879
|
+
s,
|
|
1880
|
+
() => f("set-model-feature", { id: s, enabled: l }, () => i.setFeature(s, l))
|
|
1813
1881
|
);
|
|
1814
1882
|
}
|
|
1815
|
-
async function
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1883
|
+
async function E(s) {
|
|
1884
|
+
const l = t.value.composer.mcp;
|
|
1885
|
+
l && await m(v, s, () => f("add-mcp-server", { id: s }, () => l.addServer(s)));
|
|
1818
1886
|
}
|
|
1819
|
-
async function
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
() =>
|
|
1887
|
+
async function R(s) {
|
|
1888
|
+
const l = t.value.composer.mcp;
|
|
1889
|
+
l && await m(
|
|
1890
|
+
v,
|
|
1891
|
+
s,
|
|
1892
|
+
() => f("remove-mcp-server", { id: s }, () => l.removeServer(s))
|
|
1825
1893
|
);
|
|
1826
1894
|
}
|
|
1827
|
-
async function
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
() =>
|
|
1895
|
+
async function I(s, l) {
|
|
1896
|
+
const i = t.value.composer.mcp, A = i == null ? void 0 : i.servers.value.find((M) => M.id === s);
|
|
1897
|
+
i && A && A.enabled !== l && await m(
|
|
1898
|
+
v,
|
|
1899
|
+
s,
|
|
1900
|
+
() => f("set-mcp-server-enabled", { id: s, enabled: l }, () => i.setServerEnabled(s, l))
|
|
1833
1901
|
);
|
|
1834
1902
|
}
|
|
1835
|
-
async function
|
|
1836
|
-
var
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
() =>
|
|
1903
|
+
async function d(s, l, i) {
|
|
1904
|
+
var V;
|
|
1905
|
+
const A = t.value.composer.mcp, M = (V = A == null ? void 0 : A.tools.value[s]) == null ? void 0 : V.find((x) => x.id === l), $ = y(s, l);
|
|
1906
|
+
A && M && M.enabled !== i && await m(
|
|
1907
|
+
b,
|
|
1908
|
+
$,
|
|
1909
|
+
() => f(
|
|
1842
1910
|
"set-mcp-tool-enabled",
|
|
1843
|
-
{ serverId:
|
|
1844
|
-
() =>
|
|
1911
|
+
{ serverId: s, toolId: l, enabled: i },
|
|
1912
|
+
() => A.setToolEnabled(s, l, i)
|
|
1845
1913
|
)
|
|
1846
1914
|
);
|
|
1847
1915
|
}
|
|
1848
1916
|
return {
|
|
1849
|
-
data:
|
|
1917
|
+
data: r,
|
|
1850
1918
|
inputValue: a.inputValue,
|
|
1851
1919
|
setInputValue: a.setInputValue,
|
|
1852
|
-
send: (
|
|
1853
|
-
abort: () =>
|
|
1854
|
-
var
|
|
1855
|
-
return (
|
|
1920
|
+
send: (s) => a.send(s),
|
|
1921
|
+
abort: () => f("abort", void 0, () => {
|
|
1922
|
+
var s, l;
|
|
1923
|
+
return (l = (s = t.value.actions).abort) == null ? void 0 : l.call(s);
|
|
1856
1924
|
}),
|
|
1857
|
-
createConversation: () =>
|
|
1858
|
-
switchConversation: (
|
|
1859
|
-
renameConversation: (
|
|
1860
|
-
deleteConversation: (
|
|
1861
|
-
selectModel:
|
|
1862
|
-
setModelFeature:
|
|
1863
|
-
addMcpServer:
|
|
1864
|
-
removeMcpServer:
|
|
1865
|
-
setMcpServerEnabled:
|
|
1866
|
-
setMcpToolEnabled:
|
|
1925
|
+
createConversation: () => f("create-conversation", void 0, () => t.value.actions.createConversation()),
|
|
1926
|
+
switchConversation: (s) => f("switch-conversation", { id: s }, () => t.value.actions.switchConversation(s)),
|
|
1927
|
+
renameConversation: (s, l) => f("rename-conversation", { id: s, title: l }, () => t.value.actions.renameConversation(s, l)),
|
|
1928
|
+
deleteConversation: (s) => f("delete-conversation", { id: s }, () => t.value.actions.deleteConversation(s)),
|
|
1929
|
+
selectModel: k,
|
|
1930
|
+
setModelFeature: T,
|
|
1931
|
+
addMcpServer: E,
|
|
1932
|
+
removeMcpServer: R,
|
|
1933
|
+
setMcpServerEnabled: I,
|
|
1934
|
+
setMcpToolEnabled: d
|
|
1867
1935
|
};
|
|
1868
1936
|
}
|
|
1869
|
-
const
|
|
1937
|
+
const Fo = /* @__PURE__ */ Z({
|
|
1870
1938
|
__name: "Chat",
|
|
1871
1939
|
props: {
|
|
1872
1940
|
runtime: {},
|
|
1873
1941
|
ui: {},
|
|
1874
1942
|
title: {},
|
|
1875
|
-
floatingState: {}
|
|
1943
|
+
floatingState: {},
|
|
1944
|
+
rightAsidePanel: {}
|
|
1876
1945
|
},
|
|
1877
|
-
emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "runtime-action-error", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "left-aside-open-change", "right-aside-open-change"],
|
|
1878
|
-
setup(e, {
|
|
1879
|
-
const n = e,
|
|
1946
|
+
emits: ["update:floating-state", "floating-drag-start", "floating-drag", "floating-drag-end", "floating-resize-start", "floating-resize", "floating-resize-end", "runtime-action-error", "history-action", "prompt-click", "bubble-state-change", "bubble-event", "left-aside-open-change", "right-aside-open-change", "update:right-aside-panel"],
|
|
1947
|
+
setup(e, { expose: t, emit: o }) {
|
|
1948
|
+
const n = e, c = o, v = io({
|
|
1880
1949
|
runtime: () => n.runtime,
|
|
1881
1950
|
title: () => n.title,
|
|
1882
|
-
onActionError: (
|
|
1951
|
+
onActionError: (a) => c("runtime-action-error", a)
|
|
1883
1952
|
});
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1953
|
+
t({
|
|
1954
|
+
send: v.send
|
|
1955
|
+
});
|
|
1956
|
+
function b(a) {
|
|
1957
|
+
if (a.action.id === "delete") {
|
|
1958
|
+
v.deleteConversation(a.conversation.id);
|
|
1887
1959
|
return;
|
|
1888
1960
|
}
|
|
1889
|
-
|
|
1961
|
+
c("history-action", a);
|
|
1890
1962
|
}
|
|
1891
|
-
return (
|
|
1892
|
-
data:
|
|
1963
|
+
return (a, r) => (P(), W(lo, {
|
|
1964
|
+
data: p(v).data.value,
|
|
1893
1965
|
ui: n.ui,
|
|
1894
1966
|
"floating-state": n.floatingState,
|
|
1895
|
-
"
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1967
|
+
"right-aside-panel": n.rightAsidePanel,
|
|
1968
|
+
"input-value": p(v).inputValue.value,
|
|
1969
|
+
onCreateConversation: p(v).createConversation,
|
|
1970
|
+
onSwitchConversation: r[0] || (r[0] = ({ id: u }) => p(v).switchConversation(u)),
|
|
1971
|
+
onRenameConversation: r[1] || (r[1] = ({ id: u, title: y }) => p(v).renameConversation(u, y)),
|
|
1972
|
+
onDeleteConversation: r[2] || (r[2] = ({ id: u }) => p(v).deleteConversation(u)),
|
|
1973
|
+
onHistoryAction: b,
|
|
1974
|
+
onPromptClick: r[3] || (r[3] = (u) => c("prompt-click", u)),
|
|
1975
|
+
onBubbleStateChange: r[4] || (r[4] = (u) => c("bubble-state-change", u)),
|
|
1976
|
+
onBubbleEvent: r[5] || (r[5] = (u) => c("bubble-event", u)),
|
|
1977
|
+
onLeftAsideOpenChange: r[6] || (r[6] = (u) => c("left-aside-open-change", u)),
|
|
1978
|
+
onRightAsideOpenChange: r[7] || (r[7] = (u) => c("right-aside-open-change", u)),
|
|
1979
|
+
"onUpdate:rightAsidePanel": r[8] || (r[8] = (u) => c("update:right-aside-panel", u)),
|
|
1980
|
+
"onUpdate:floatingState": r[9] || (r[9] = (u) => c("update:floating-state", u)),
|
|
1981
|
+
onFloatingDragStart: r[10] || (r[10] = (u) => c("floating-drag-start", u)),
|
|
1982
|
+
onFloatingDrag: r[11] || (r[11] = (u) => c("floating-drag", u)),
|
|
1983
|
+
onFloatingDragEnd: r[12] || (r[12] = (u) => c("floating-drag-end", u)),
|
|
1984
|
+
onFloatingResizeStart: r[13] || (r[13] = (u) => c("floating-resize-start", u)),
|
|
1985
|
+
onFloatingResize: r[14] || (r[14] = (u) => c("floating-resize", u)),
|
|
1986
|
+
onFloatingResizeEnd: r[15] || (r[15] = (u) => c("floating-resize-end", u)),
|
|
1987
|
+
onSubmit: p(v).send,
|
|
1988
|
+
onCancel: p(v).abort,
|
|
1989
|
+
onClear: r[16] || (r[16] = () => p(v).setInputValue("")),
|
|
1990
|
+
"onUpdate:inputValue": p(v).setInputValue,
|
|
1991
|
+
onModelSelect: r[17] || (r[17] = ({ id: u }) => p(v).selectModel(u)),
|
|
1992
|
+
onModelFeatureChange: r[18] || (r[18] = ({ id: u, enabled: y }) => p(v).setModelFeature(u, y)),
|
|
1993
|
+
onMcpAddServer: r[19] || (r[19] = ({ id: u }) => p(v).addMcpServer(u)),
|
|
1994
|
+
onMcpRemoveServer: r[20] || (r[20] = ({ id: u }) => p(v).removeMcpServer(u)),
|
|
1995
|
+
onMcpServerEnabledChange: r[21] || (r[21] = ({ id: u, enabled: y }) => p(v).setMcpServerEnabled(u, y)),
|
|
1996
|
+
onMcpToolEnabledChange: r[22] || (r[22] = ({ serverId: u, toolId: y, enabled: f }) => p(v).setMcpToolEnabled(u, y, f))
|
|
1997
|
+
}, J({ _: 2 }, [
|
|
1998
|
+
a.$slots["layout-header"] ? {
|
|
1925
1999
|
name: "layout-header",
|
|
1926
|
-
fn:
|
|
1927
|
-
|
|
2000
|
+
fn: S((u) => [
|
|
2001
|
+
C(a.$slots, "layout-header", q(j(u)))
|
|
1928
2002
|
]),
|
|
1929
2003
|
key: "0"
|
|
1930
2004
|
} : void 0,
|
|
1931
|
-
|
|
2005
|
+
a.$slots["layout-left-aside"] ? {
|
|
1932
2006
|
name: "layout-left-aside",
|
|
1933
|
-
fn:
|
|
1934
|
-
|
|
2007
|
+
fn: S((u) => [
|
|
2008
|
+
C(a.$slots, "layout-left-aside", q(j(u)))
|
|
1935
2009
|
]),
|
|
1936
2010
|
key: "1"
|
|
1937
2011
|
} : void 0,
|
|
1938
|
-
|
|
2012
|
+
a.$slots["layout-right-aside"] ? {
|
|
1939
2013
|
name: "layout-right-aside",
|
|
1940
|
-
fn:
|
|
1941
|
-
|
|
2014
|
+
fn: S((u) => [
|
|
2015
|
+
C(a.$slots, "layout-right-aside", q(j(u)))
|
|
1942
2016
|
]),
|
|
1943
2017
|
key: "2"
|
|
1944
2018
|
} : void 0,
|
|
1945
|
-
|
|
1946
|
-
name: "layout-right-aside-
|
|
1947
|
-
fn:
|
|
1948
|
-
|
|
2019
|
+
a.$slots["layout-right-aside-content"] ? {
|
|
2020
|
+
name: "layout-right-aside-content",
|
|
2021
|
+
fn: S(() => [
|
|
2022
|
+
C(a.$slots, "layout-right-aside-content")
|
|
1949
2023
|
]),
|
|
1950
2024
|
key: "3"
|
|
1951
2025
|
} : void 0,
|
|
1952
|
-
|
|
1953
|
-
name: "layout-
|
|
1954
|
-
fn:
|
|
1955
|
-
|
|
2026
|
+
a.$slots["layout-right-aside-title"] ? {
|
|
2027
|
+
name: "layout-right-aside-title",
|
|
2028
|
+
fn: S(() => [
|
|
2029
|
+
C(a.$slots, "layout-right-aside-title")
|
|
1956
2030
|
]),
|
|
1957
2031
|
key: "4"
|
|
1958
2032
|
} : void 0,
|
|
1959
|
-
|
|
1960
|
-
name: "layout-
|
|
1961
|
-
fn:
|
|
1962
|
-
|
|
2033
|
+
a.$slots["layout-main"] ? {
|
|
2034
|
+
name: "layout-main",
|
|
2035
|
+
fn: S((u) => [
|
|
2036
|
+
C(a.$slots, "layout-main", q(j(u)))
|
|
1963
2037
|
]),
|
|
1964
2038
|
key: "5"
|
|
1965
2039
|
} : void 0,
|
|
1966
|
-
|
|
1967
|
-
name: "
|
|
1968
|
-
fn:
|
|
1969
|
-
|
|
2040
|
+
a.$slots["layout-footer"] ? {
|
|
2041
|
+
name: "layout-footer",
|
|
2042
|
+
fn: S((u) => [
|
|
2043
|
+
C(a.$slots, "layout-footer", q(j(u)))
|
|
1970
2044
|
]),
|
|
1971
2045
|
key: "6"
|
|
1972
2046
|
} : void 0,
|
|
1973
|
-
|
|
1974
|
-
name: "
|
|
1975
|
-
fn:
|
|
1976
|
-
|
|
2047
|
+
a.$slots["composer-before"] ? {
|
|
2048
|
+
name: "composer-before",
|
|
2049
|
+
fn: S((u) => [
|
|
2050
|
+
C(a.$slots, "composer-before", q(j(u)))
|
|
1977
2051
|
]),
|
|
1978
2052
|
key: "7"
|
|
1979
2053
|
} : void 0,
|
|
1980
|
-
|
|
1981
|
-
name: "
|
|
1982
|
-
fn:
|
|
1983
|
-
|
|
2054
|
+
a.$slots["header-notice"] ? {
|
|
2055
|
+
name: "header-notice",
|
|
2056
|
+
fn: S(() => [
|
|
2057
|
+
C(a.$slots, "header-notice")
|
|
1984
2058
|
]),
|
|
1985
2059
|
key: "8"
|
|
1986
2060
|
} : void 0,
|
|
1987
|
-
|
|
1988
|
-
name: "
|
|
1989
|
-
fn:
|
|
1990
|
-
|
|
2061
|
+
a.$slots["request-error"] ? {
|
|
2062
|
+
name: "request-error",
|
|
2063
|
+
fn: S((u) => [
|
|
2064
|
+
C(a.$slots, "request-error", q(j(u)))
|
|
1991
2065
|
]),
|
|
1992
2066
|
key: "9"
|
|
1993
2067
|
} : void 0,
|
|
1994
|
-
|
|
1995
|
-
name: "
|
|
1996
|
-
fn:
|
|
1997
|
-
|
|
2068
|
+
a.$slots["welcome-footer"] ? {
|
|
2069
|
+
name: "welcome-footer",
|
|
2070
|
+
fn: S(() => [
|
|
2071
|
+
C(a.$slots, "welcome-footer")
|
|
1998
2072
|
]),
|
|
1999
2073
|
key: "10"
|
|
2000
2074
|
} : void 0,
|
|
2001
|
-
|
|
2002
|
-
name: "
|
|
2003
|
-
fn:
|
|
2004
|
-
|
|
2075
|
+
a.$slots["prompts-footer"] ? {
|
|
2076
|
+
name: "prompts-footer",
|
|
2077
|
+
fn: S(() => [
|
|
2078
|
+
C(a.$slots, "prompts-footer")
|
|
2005
2079
|
]),
|
|
2006
2080
|
key: "11"
|
|
2007
2081
|
} : void 0,
|
|
2008
|
-
|
|
2009
|
-
name: "bubble-
|
|
2010
|
-
fn:
|
|
2011
|
-
|
|
2082
|
+
a.$slots["bubble-prefix"] ? {
|
|
2083
|
+
name: "bubble-prefix",
|
|
2084
|
+
fn: S(() => [
|
|
2085
|
+
C(a.$slots, "bubble-prefix")
|
|
2012
2086
|
]),
|
|
2013
2087
|
key: "12"
|
|
2014
2088
|
} : void 0,
|
|
2015
|
-
|
|
2016
|
-
name: "bubble-
|
|
2017
|
-
fn:
|
|
2018
|
-
|
|
2089
|
+
a.$slots["bubble-suffix"] ? {
|
|
2090
|
+
name: "bubble-suffix",
|
|
2091
|
+
fn: S(() => [
|
|
2092
|
+
C(a.$slots, "bubble-suffix")
|
|
2019
2093
|
]),
|
|
2020
2094
|
key: "13"
|
|
2021
2095
|
} : void 0,
|
|
2022
|
-
|
|
2023
|
-
name: "bubble-
|
|
2024
|
-
fn:
|
|
2025
|
-
|
|
2096
|
+
a.$slots["bubble-after"] ? {
|
|
2097
|
+
name: "bubble-after",
|
|
2098
|
+
fn: S(() => [
|
|
2099
|
+
C(a.$slots, "bubble-after")
|
|
2026
2100
|
]),
|
|
2027
2101
|
key: "14"
|
|
2028
2102
|
} : void 0,
|
|
2029
|
-
|
|
2030
|
-
name: "
|
|
2031
|
-
fn:
|
|
2032
|
-
|
|
2103
|
+
a.$slots["bubble-content-footer"] ? {
|
|
2104
|
+
name: "bubble-content-footer",
|
|
2105
|
+
fn: S(() => [
|
|
2106
|
+
C(a.$slots, "bubble-content-footer")
|
|
2033
2107
|
]),
|
|
2034
2108
|
key: "15"
|
|
2035
2109
|
} : void 0,
|
|
2036
|
-
|
|
2037
|
-
name: "sender-footer
|
|
2038
|
-
fn:
|
|
2039
|
-
|
|
2110
|
+
a.$slots["sender-footer"] ? {
|
|
2111
|
+
name: "sender-footer",
|
|
2112
|
+
fn: S(() => [
|
|
2113
|
+
C(a.$slots, "sender-footer")
|
|
2040
2114
|
]),
|
|
2041
2115
|
key: "16"
|
|
2116
|
+
} : void 0,
|
|
2117
|
+
a.$slots["sender-footer-right"] ? {
|
|
2118
|
+
name: "sender-footer-right",
|
|
2119
|
+
fn: S(() => [
|
|
2120
|
+
C(a.$slots, "sender-footer-right")
|
|
2121
|
+
]),
|
|
2122
|
+
key: "17"
|
|
2042
2123
|
} : void 0
|
|
2043
|
-
]), 1032, ["data", "ui", "floating-state", "input-value", "onCreateConversation", "onSubmit", "onCancel", "onUpdate:inputValue"]));
|
|
2124
|
+
]), 1032, ["data", "ui", "floating-state", "right-aside-panel", "input-value", "onCreateConversation", "onSubmit", "onCancel", "onUpdate:inputValue"]));
|
|
2044
2125
|
}
|
|
2045
|
-
}),
|
|
2126
|
+
}), Fe = "run_config_metadata", ie = "run_config_context";
|
|
2046
2127
|
function de(e) {
|
|
2047
2128
|
if (e)
|
|
2048
2129
|
return {
|
|
@@ -2052,323 +2133,323 @@ function de(e) {
|
|
|
2052
2133
|
mcp: e.mcp ? {
|
|
2053
2134
|
serverIds: [...e.mcp.serverIds],
|
|
2054
2135
|
toolIds: Object.fromEntries(
|
|
2055
|
-
Object.entries(e.mcp.toolIds).map(([t,
|
|
2136
|
+
Object.entries(e.mcp.toolIds).map(([t, o]) => [t, [...o]])
|
|
2056
2137
|
)
|
|
2057
2138
|
} : void 0
|
|
2058
2139
|
};
|
|
2059
2140
|
}
|
|
2060
|
-
function
|
|
2141
|
+
function We(e) {
|
|
2061
2142
|
return (e == null ? void 0 : e.servers.value.filter((t) => t.installed && t.enabled)) ?? [];
|
|
2062
2143
|
}
|
|
2063
|
-
function
|
|
2064
|
-
return e ?
|
|
2144
|
+
function De(e) {
|
|
2145
|
+
return e ? We(e).every(
|
|
2065
2146
|
(t) => !t.loading && Object.prototype.hasOwnProperty.call(e.tools.value, t.id)
|
|
2066
2147
|
) : !0;
|
|
2067
2148
|
}
|
|
2068
|
-
function
|
|
2149
|
+
function uo(e) {
|
|
2069
2150
|
if (e === void 0)
|
|
2070
2151
|
return;
|
|
2071
|
-
const t =
|
|
2072
|
-
if (!(t.length === 0 || !
|
|
2152
|
+
const t = We(e);
|
|
2153
|
+
if (!(t.length === 0 || !De(e)))
|
|
2073
2154
|
return {
|
|
2074
|
-
serverIds: t.map((
|
|
2155
|
+
serverIds: t.map((o) => o.id),
|
|
2075
2156
|
toolIds: Object.fromEntries(
|
|
2076
|
-
t.map((
|
|
2077
|
-
|
|
2078
|
-
(e.tools.value[
|
|
2157
|
+
t.map((o) => [
|
|
2158
|
+
o.id,
|
|
2159
|
+
(e.tools.value[o.id] ?? []).filter((n) => n.enabled).map((n) => n.id)
|
|
2079
2160
|
])
|
|
2080
2161
|
)
|
|
2081
2162
|
};
|
|
2082
2163
|
}
|
|
2083
|
-
function
|
|
2084
|
-
var
|
|
2085
|
-
const t = e.model,
|
|
2086
|
-
if (!(!t && !
|
|
2164
|
+
function co(e) {
|
|
2165
|
+
var c, v;
|
|
2166
|
+
const t = e.model, o = (v = (c = e.model) == null ? void 0 : c.reasoning) == null ? void 0 : v.value, n = uo(e.mcp);
|
|
2167
|
+
if (!(!t && !o && !n))
|
|
2087
2168
|
return de({
|
|
2088
2169
|
modelId: (t == null ? void 0 : t.selectedId.value) ?? void 0,
|
|
2089
2170
|
features: t ? { ...t.features.value } : void 0,
|
|
2090
|
-
reasoning:
|
|
2091
|
-
mcp:
|
|
2171
|
+
reasoning: o,
|
|
2172
|
+
mcp: n
|
|
2092
2173
|
});
|
|
2093
2174
|
}
|
|
2094
|
-
function
|
|
2175
|
+
function ee(e) {
|
|
2095
2176
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2096
2177
|
}
|
|
2097
|
-
function
|
|
2098
|
-
if (!
|
|
2178
|
+
function fo(e) {
|
|
2179
|
+
if (!ee(e) || !Array.isArray(e.serverIds) || !ee(e.toolIds) || !e.serverIds.every((c) => typeof c == "string" && c.length > 0))
|
|
2099
2180
|
return;
|
|
2100
|
-
const t = e.serverIds,
|
|
2101
|
-
if (
|
|
2181
|
+
const t = e.serverIds, o = new Set(t);
|
|
2182
|
+
if (o.size !== t.length)
|
|
2102
2183
|
return;
|
|
2103
|
-
const
|
|
2104
|
-
if (!(
|
|
2105
|
-
([
|
|
2106
|
-
)) && !t.some((
|
|
2184
|
+
const n = Object.entries(e.toolIds);
|
|
2185
|
+
if (!(n.length !== t.length || !n.every(
|
|
2186
|
+
([c, v]) => o.has(c) && Array.isArray(v) && v.every((b) => typeof b == "string" && b.length > 0) && new Set(v).size === v.length
|
|
2187
|
+
)) && !t.some((c) => !Object.prototype.hasOwnProperty.call(e.toolIds, c)))
|
|
2107
2188
|
return {
|
|
2108
2189
|
serverIds: [...t],
|
|
2109
|
-
toolIds: Object.fromEntries(
|
|
2190
|
+
toolIds: Object.fromEntries(n.map(([c, v]) => [c, [...v]]))
|
|
2110
2191
|
};
|
|
2111
2192
|
}
|
|
2112
|
-
function
|
|
2113
|
-
var
|
|
2114
|
-
const t = (
|
|
2115
|
-
if (!
|
|
2193
|
+
function vo(e) {
|
|
2194
|
+
var c;
|
|
2195
|
+
const t = (c = e == null ? void 0 : e.metadata) == null ? void 0 : c[Fe];
|
|
2196
|
+
if (!ee(t) || t.modelId !== void 0 && typeof t.modelId != "string" || t.features !== void 0 && (!ee(t.features) || Object.values(t.features).some((v) => typeof v != "boolean")))
|
|
2116
2197
|
return;
|
|
2117
|
-
let
|
|
2198
|
+
let o;
|
|
2118
2199
|
if (t.reasoning !== void 0) {
|
|
2119
|
-
if (!
|
|
2200
|
+
if (!ee(t.reasoning) || typeof t.reasoning.enabled != "boolean" || t.reasoning.effort !== void 0 && (typeof t.reasoning.effort != "string" || !Ht.includes(t.reasoning.effort)))
|
|
2120
2201
|
return;
|
|
2121
|
-
|
|
2202
|
+
o = {
|
|
2122
2203
|
enabled: t.reasoning.enabled,
|
|
2123
2204
|
effort: t.reasoning.effort
|
|
2124
2205
|
};
|
|
2125
2206
|
}
|
|
2126
|
-
const
|
|
2127
|
-
if (!(t.mcp !== void 0 && !
|
|
2207
|
+
const n = t.mcp === void 0 ? void 0 : fo(t.mcp);
|
|
2208
|
+
if (!(t.mcp !== void 0 && !n))
|
|
2128
2209
|
return de({
|
|
2129
2210
|
modelId: t.modelId,
|
|
2130
2211
|
features: t.features,
|
|
2131
|
-
reasoning:
|
|
2132
|
-
mcp:
|
|
2212
|
+
reasoning: o,
|
|
2213
|
+
mcp: n
|
|
2133
2214
|
});
|
|
2134
2215
|
}
|
|
2135
|
-
const
|
|
2136
|
-
function
|
|
2137
|
-
return e.trim().slice(0, 20) ||
|
|
2216
|
+
const qe = "新对话";
|
|
2217
|
+
function Ke(e) {
|
|
2218
|
+
return e.trim().slice(0, 20) || qe;
|
|
2138
2219
|
}
|
|
2139
|
-
function
|
|
2140
|
-
return e ||
|
|
2220
|
+
function mo(e) {
|
|
2221
|
+
return e || qe;
|
|
2141
2222
|
}
|
|
2142
|
-
const
|
|
2223
|
+
const Ie = (e) => ({
|
|
2143
2224
|
id: e.id,
|
|
2144
|
-
title:
|
|
2225
|
+
title: mo(e.title),
|
|
2145
2226
|
createdAt: e.createdAt,
|
|
2146
2227
|
updatedAt: e.updatedAt,
|
|
2147
2228
|
metadata: e.metadata
|
|
2148
2229
|
});
|
|
2149
|
-
function
|
|
2150
|
-
const { conversation: t, lastError:
|
|
2151
|
-
const
|
|
2152
|
-
return
|
|
2153
|
-
...
|
|
2154
|
-
messages:
|
|
2155
|
-
requestState:
|
|
2156
|
-
processingState:
|
|
2157
|
-
lastError:
|
|
2230
|
+
function bo(e) {
|
|
2231
|
+
const { conversation: t, lastError: o, titleGenerator: n, send: c, composer: v } = e, b = K({}), a = n ?? Ke, r = h(() => t.activeConversation.value), u = h(() => t.conversations.value.map(Ie)), y = h(() => {
|
|
2232
|
+
const R = r.value;
|
|
2233
|
+
return R ? {
|
|
2234
|
+
...Ie(R),
|
|
2235
|
+
messages: R.engine.messages.value,
|
|
2236
|
+
requestState: R.engine.requestState.value,
|
|
2237
|
+
processingState: R.engine.processingState.value,
|
|
2238
|
+
lastError: b.value[R.id] ?? null
|
|
2158
2239
|
} : null;
|
|
2159
2240
|
});
|
|
2160
|
-
|
|
2161
|
-
var
|
|
2162
|
-
|
|
2241
|
+
o && at(() => {
|
|
2242
|
+
var R;
|
|
2243
|
+
o.value = ((R = y.value) == null ? void 0 : R.lastError) ?? null;
|
|
2163
2244
|
});
|
|
2164
|
-
const
|
|
2245
|
+
const f = v ?? {}, m = h(
|
|
2165
2246
|
() => {
|
|
2166
|
-
var
|
|
2167
|
-
return !!((
|
|
2168
|
-
}
|
|
2169
|
-
),
|
|
2170
|
-
...
|
|
2171
|
-
submitDisabled:
|
|
2172
|
-
},
|
|
2173
|
-
const
|
|
2174
|
-
if (!
|
|
2247
|
+
var R;
|
|
2248
|
+
return !!((R = f.submitDisabled) != null && R.value) || !De(f.mcp);
|
|
2249
|
+
}
|
|
2250
|
+
), k = {
|
|
2251
|
+
...f,
|
|
2252
|
+
submitDisabled: m
|
|
2253
|
+
}, T = c ?? (async (R) => {
|
|
2254
|
+
const I = R.text.trim();
|
|
2255
|
+
if (!I)
|
|
2175
2256
|
return;
|
|
2176
|
-
let
|
|
2177
|
-
|
|
2178
|
-
const
|
|
2179
|
-
await
|
|
2257
|
+
let d = r.value;
|
|
2258
|
+
d ? d.title || t.updateConversationTitle(d.id, a(I)) : d = t.createConversation({ title: a(I) });
|
|
2259
|
+
const s = Math.floor(Date.now() / 1e3);
|
|
2260
|
+
await d.engine.send({
|
|
2180
2261
|
role: "user",
|
|
2181
|
-
content:
|
|
2262
|
+
content: I,
|
|
2182
2263
|
metadata: {
|
|
2183
|
-
createdAt:
|
|
2184
|
-
updatedAt:
|
|
2185
|
-
...
|
|
2186
|
-
[
|
|
2264
|
+
createdAt: s,
|
|
2265
|
+
updatedAt: s,
|
|
2266
|
+
...R.runConfig ? {
|
|
2267
|
+
[Fe]: de(R.runConfig)
|
|
2187
2268
|
} : {}
|
|
2188
2269
|
}
|
|
2189
2270
|
});
|
|
2190
2271
|
});
|
|
2191
|
-
async function
|
|
2192
|
-
var
|
|
2193
|
-
const
|
|
2194
|
-
if (!
|
|
2272
|
+
async function E(R) {
|
|
2273
|
+
var l, i, A, M;
|
|
2274
|
+
const I = R.text.trim();
|
|
2275
|
+
if (!I || (l = k.disabled) != null && l.value || (i = k.submitDisabled) != null && i.value)
|
|
2195
2276
|
return !1;
|
|
2196
|
-
let
|
|
2197
|
-
const
|
|
2198
|
-
...
|
|
2199
|
-
text:
|
|
2200
|
-
runConfig: de(
|
|
2277
|
+
let d = ((A = t.activeConversation.value) == null ? void 0 : A.id) ?? null;
|
|
2278
|
+
const s = {
|
|
2279
|
+
...R,
|
|
2280
|
+
text: I,
|
|
2281
|
+
runConfig: de(co(k))
|
|
2201
2282
|
};
|
|
2202
2283
|
try {
|
|
2203
|
-
const
|
|
2204
|
-
return
|
|
2205
|
-
...
|
|
2206
|
-
[
|
|
2207
|
-
}), await
|
|
2208
|
-
} catch (
|
|
2209
|
-
throw
|
|
2210
|
-
...
|
|
2211
|
-
[
|
|
2212
|
-
}),
|
|
2284
|
+
const $ = Promise.resolve(T(s));
|
|
2285
|
+
return d = ((M = t.activeConversation.value) == null ? void 0 : M.id) ?? d, d && (b.value = {
|
|
2286
|
+
...b.value,
|
|
2287
|
+
[d]: null
|
|
2288
|
+
}), await $, !0;
|
|
2289
|
+
} catch ($) {
|
|
2290
|
+
throw d && (b.value = {
|
|
2291
|
+
...b.value,
|
|
2292
|
+
[d]: $
|
|
2293
|
+
}), $;
|
|
2213
2294
|
}
|
|
2214
2295
|
}
|
|
2215
2296
|
return {
|
|
2216
|
-
conversations:
|
|
2217
|
-
activeConversation:
|
|
2218
|
-
composer:
|
|
2297
|
+
conversations: u,
|
|
2298
|
+
activeConversation: y,
|
|
2299
|
+
composer: k,
|
|
2219
2300
|
actions: {
|
|
2220
|
-
send:
|
|
2301
|
+
send: E,
|
|
2221
2302
|
abort: async () => {
|
|
2222
2303
|
await t.abortActiveRequest();
|
|
2223
2304
|
},
|
|
2224
|
-
createConversation: (
|
|
2225
|
-
t.createConversation(
|
|
2305
|
+
createConversation: (R) => {
|
|
2306
|
+
t.createConversation(R);
|
|
2226
2307
|
},
|
|
2227
|
-
switchConversation: async (
|
|
2228
|
-
await t.switchConversation(
|
|
2308
|
+
switchConversation: async (R) => {
|
|
2309
|
+
await t.switchConversation(R);
|
|
2229
2310
|
},
|
|
2230
|
-
renameConversation: (
|
|
2231
|
-
t.updateConversationTitle(
|
|
2311
|
+
renameConversation: (R, I) => {
|
|
2312
|
+
t.updateConversationTitle(R, I);
|
|
2232
2313
|
},
|
|
2233
|
-
deleteConversation: async (
|
|
2234
|
-
await t.deleteConversation(
|
|
2235
|
-
const { [
|
|
2236
|
-
|
|
2314
|
+
deleteConversation: async (R) => {
|
|
2315
|
+
await t.deleteConversation(R);
|
|
2316
|
+
const { [R]: I, ...d } = b.value;
|
|
2317
|
+
b.value = d;
|
|
2237
2318
|
}
|
|
2238
2319
|
}
|
|
2239
2320
|
};
|
|
2240
2321
|
}
|
|
2241
|
-
function
|
|
2242
|
-
var
|
|
2243
|
-
const t =
|
|
2244
|
-
function
|
|
2245
|
-
return e.find((
|
|
2322
|
+
function go(e) {
|
|
2323
|
+
var r, u, y;
|
|
2324
|
+
const t = K(((r = e[0]) == null ? void 0 : r.id) ?? null), o = K(((y = (u = e[0]) == null ? void 0 : u.reasoning) == null ? void 0 : y.defaultEffort) ?? "high"), n = lt({}), c = h(() => e.find((f) => f.id === t.value));
|
|
2325
|
+
function v(f) {
|
|
2326
|
+
return e.find((m) => m.id === f);
|
|
2246
2327
|
}
|
|
2247
|
-
function
|
|
2248
|
-
var
|
|
2249
|
-
const
|
|
2250
|
-
re.forEach((
|
|
2251
|
-
var
|
|
2252
|
-
(
|
|
2253
|
-
}), (
|
|
2328
|
+
function b(f) {
|
|
2329
|
+
var k, T, E, R, I;
|
|
2330
|
+
const m = f ? v(f) : void 0;
|
|
2331
|
+
re.forEach((d) => {
|
|
2332
|
+
var s;
|
|
2333
|
+
(s = m == null ? void 0 : m.capabilities) != null && s[d] || (n[d] = !1);
|
|
2334
|
+
}), (T = (k = m == null ? void 0 : m.reasoning) == null ? void 0 : k.efforts) != null && T.includes(o.value) || (o.value = ((E = m == null ? void 0 : m.reasoning) == null ? void 0 : E.defaultEffort) ?? ((I = (R = m == null ? void 0 : m.reasoning) == null ? void 0 : R.efforts) == null ? void 0 : I[0]) ?? "high");
|
|
2254
2335
|
}
|
|
2255
2336
|
return {
|
|
2256
2337
|
model: {
|
|
2257
2338
|
options: h(
|
|
2258
|
-
() => e.map(({ id:
|
|
2259
|
-
id:
|
|
2260
|
-
label:
|
|
2261
|
-
capabilities:
|
|
2339
|
+
() => e.map(({ id: f, label: m, capabilities: k }) => ({
|
|
2340
|
+
id: f,
|
|
2341
|
+
label: m,
|
|
2342
|
+
capabilities: k
|
|
2262
2343
|
}))
|
|
2263
2344
|
),
|
|
2264
2345
|
selectedId: h(() => t.value),
|
|
2265
2346
|
features: h(
|
|
2266
2347
|
() => Object.fromEntries(
|
|
2267
|
-
re.map((
|
|
2268
|
-
var
|
|
2348
|
+
re.map((f) => {
|
|
2349
|
+
var m, k;
|
|
2269
2350
|
return [
|
|
2270
|
-
|
|
2271
|
-
!!((
|
|
2351
|
+
f,
|
|
2352
|
+
!!((k = (m = c.value) == null ? void 0 : m.capabilities) != null && k[f] && n[f])
|
|
2272
2353
|
];
|
|
2273
2354
|
})
|
|
2274
2355
|
)
|
|
2275
2356
|
),
|
|
2276
2357
|
reasoning: h(() => {
|
|
2277
|
-
var
|
|
2278
|
-
const
|
|
2358
|
+
var k, T, E;
|
|
2359
|
+
const f = c.value, m = !!((k = f == null ? void 0 : f.capabilities) != null && k.thinking && n.thinking);
|
|
2279
2360
|
return {
|
|
2280
|
-
enabled:
|
|
2281
|
-
effort:
|
|
2361
|
+
enabled: m,
|
|
2362
|
+
effort: m && ((E = (T = f == null ? void 0 : f.reasoning) == null ? void 0 : T.efforts) != null && E.includes(o.value)) ? o.value : void 0
|
|
2282
2363
|
};
|
|
2283
2364
|
}),
|
|
2284
|
-
select(
|
|
2285
|
-
if (
|
|
2286
|
-
throw new Error(`Unknown model: ${
|
|
2287
|
-
t.value =
|
|
2365
|
+
select(f) {
|
|
2366
|
+
if (f !== null && !v(f))
|
|
2367
|
+
throw new Error(`Unknown model: ${f}`);
|
|
2368
|
+
t.value = f, b(f);
|
|
2288
2369
|
},
|
|
2289
|
-
setFeature(
|
|
2290
|
-
var
|
|
2291
|
-
if (
|
|
2292
|
-
if (!Object.prototype.hasOwnProperty.call(((
|
|
2293
|
-
throw new Error(`Unknown model feature: ${
|
|
2294
|
-
if (!((
|
|
2295
|
-
throw new Error(`Current model does not support ${
|
|
2370
|
+
setFeature(f, m) {
|
|
2371
|
+
var k, T, E;
|
|
2372
|
+
if (m) {
|
|
2373
|
+
if (!Object.prototype.hasOwnProperty.call(((k = c.value) == null ? void 0 : k.capabilities) ?? {}, f))
|
|
2374
|
+
throw new Error(`Unknown model feature: ${f}`);
|
|
2375
|
+
if (!((E = (T = c.value) == null ? void 0 : T.capabilities) != null && E[f]))
|
|
2376
|
+
throw new Error(`Current model does not support ${f}`);
|
|
2296
2377
|
}
|
|
2297
|
-
|
|
2378
|
+
n[f] = m;
|
|
2298
2379
|
}
|
|
2299
2380
|
},
|
|
2300
|
-
selectedModel:
|
|
2301
|
-
resolveModel:
|
|
2381
|
+
selectedModel: c,
|
|
2382
|
+
resolveModel: v
|
|
2302
2383
|
};
|
|
2303
2384
|
}
|
|
2304
|
-
const
|
|
2305
|
-
function
|
|
2385
|
+
const Ce = "__chat_provider_model_id";
|
|
2386
|
+
function ho(e) {
|
|
2306
2387
|
return {
|
|
2307
2388
|
name: "chat-provider-request",
|
|
2308
|
-
onBeforeRequest({ customContext: t, requestBody:
|
|
2309
|
-
var
|
|
2310
|
-
const
|
|
2311
|
-
if (
|
|
2312
|
-
throw new Error(`Unknown model for this turn: ${
|
|
2313
|
-
if (!
|
|
2389
|
+
onBeforeRequest({ customContext: t, requestBody: o }) {
|
|
2390
|
+
var b, a, r;
|
|
2391
|
+
const n = t[ie], c = n != null && n.modelId ? e(n.modelId) : null;
|
|
2392
|
+
if (n != null && n.modelId && !c)
|
|
2393
|
+
throw new Error(`Unknown model for this turn: ${n.modelId}`);
|
|
2394
|
+
if (!c || !n)
|
|
2314
2395
|
return;
|
|
2315
|
-
|
|
2316
|
-
const
|
|
2317
|
-
re.forEach((
|
|
2318
|
-
var
|
|
2319
|
-
const
|
|
2320
|
-
if (!
|
|
2321
|
-
const
|
|
2322
|
-
|
|
2323
|
-
}), (
|
|
2324
|
-
[
|
|
2396
|
+
o[Ce] = c.id;
|
|
2397
|
+
const v = n;
|
|
2398
|
+
re.forEach((u) => {
|
|
2399
|
+
var k, T, E, R;
|
|
2400
|
+
const y = (k = c.featureBody) == null ? void 0 : k[u];
|
|
2401
|
+
if (!y) return;
|
|
2402
|
+
const m = (u === "thinking" ? ((T = v.reasoning) == null ? void 0 : T.enabled) ?? ((E = v.features) == null ? void 0 : E.thinking) : (R = v.features) == null ? void 0 : R[u]) ? y.enabled : y.disabled;
|
|
2403
|
+
m && Object.assign(o, m);
|
|
2404
|
+
}), (b = n == null ? void 0 : n.reasoning) != null && b.effort && ((a = c.reasoning) != null && a.effortParam) && ((r = c.reasoning.efforts) != null && r.includes(n.reasoning.effort)) && Object.assign(o, {
|
|
2405
|
+
[c.reasoning.effortParam]: n.reasoning.effort
|
|
2325
2406
|
});
|
|
2326
2407
|
}
|
|
2327
2408
|
};
|
|
2328
2409
|
}
|
|
2329
|
-
function
|
|
2330
|
-
return async (t,
|
|
2331
|
-
const
|
|
2332
|
-
if (typeof
|
|
2410
|
+
function po(e) {
|
|
2411
|
+
return async (t, o) => {
|
|
2412
|
+
const n = t[Ce];
|
|
2413
|
+
if (typeof n != "string" || !n)
|
|
2333
2414
|
throw new Error("No model selected for this turn.");
|
|
2334
|
-
const
|
|
2335
|
-
if (!
|
|
2336
|
-
throw new Error(`Unknown model for this turn: ${
|
|
2337
|
-
const
|
|
2338
|
-
delete
|
|
2339
|
-
const
|
|
2415
|
+
const c = e(n);
|
|
2416
|
+
if (!c)
|
|
2417
|
+
throw new Error(`Unknown model for this turn: ${n}`);
|
|
2418
|
+
const v = { ...t };
|
|
2419
|
+
delete v[Ce];
|
|
2420
|
+
const b = c.timeout, a = b === void 0 ? void 0 : new AbortController(), r = a ? setTimeout(() => a.abort(new Error(`Provider request timed out after ${b}ms.`)), b) : void 0, u = a ? AbortSignal.any([o, a.signal]) : o, y = {
|
|
2340
2421
|
"Content-Type": "application/json",
|
|
2341
|
-
...
|
|
2342
|
-
},
|
|
2343
|
-
|
|
2422
|
+
...c.headers
|
|
2423
|
+
}, f = Object.keys(y).some((m) => m.toLowerCase() === "authorization");
|
|
2424
|
+
c.apiKey && !f && (y.Authorization = `Bearer ${c.apiKey}`);
|
|
2344
2425
|
try {
|
|
2345
|
-
const
|
|
2426
|
+
const m = await fetch(c.apiUrl, {
|
|
2346
2427
|
method: "POST",
|
|
2347
|
-
headers:
|
|
2428
|
+
headers: y,
|
|
2348
2429
|
body: JSON.stringify({
|
|
2349
|
-
...
|
|
2350
|
-
model:
|
|
2430
|
+
...v,
|
|
2431
|
+
model: c.id,
|
|
2351
2432
|
stream: !0
|
|
2352
2433
|
}),
|
|
2353
|
-
signal:
|
|
2434
|
+
signal: u
|
|
2354
2435
|
});
|
|
2355
|
-
if (!
|
|
2356
|
-
const
|
|
2357
|
-
throw new Error(`HTTP ${
|
|
2436
|
+
if (!m.ok) {
|
|
2437
|
+
const k = await m.text().catch(() => "");
|
|
2438
|
+
throw new Error(`HTTP ${m.status}: ${m.statusText}${k ? ` - ${k}` : ""}`);
|
|
2358
2439
|
}
|
|
2359
2440
|
return async function* () {
|
|
2360
2441
|
try {
|
|
2361
|
-
yield*
|
|
2442
|
+
yield* Tt(m, { signal: u });
|
|
2362
2443
|
} finally {
|
|
2363
|
-
|
|
2444
|
+
r !== void 0 && clearTimeout(r);
|
|
2364
2445
|
}
|
|
2365
2446
|
}();
|
|
2366
|
-
} catch (
|
|
2367
|
-
throw
|
|
2447
|
+
} catch (m) {
|
|
2448
|
+
throw r !== void 0 && clearTimeout(r), m;
|
|
2368
2449
|
}
|
|
2369
2450
|
};
|
|
2370
2451
|
}
|
|
2371
|
-
const
|
|
2452
|
+
const yo = {
|
|
2372
2453
|
openai: {
|
|
2373
2454
|
label: "OpenAI",
|
|
2374
2455
|
apiUrl: "https://api.openai.com/v1"
|
|
@@ -2416,327 +2497,327 @@ const dn = {
|
|
|
2416
2497
|
}
|
|
2417
2498
|
}
|
|
2418
2499
|
};
|
|
2419
|
-
function
|
|
2500
|
+
function Ao(e) {
|
|
2420
2501
|
const t = e.trim().replace(/\/+$/, "");
|
|
2421
2502
|
return t.endsWith("/chat/completions") ? t : `${t}/chat/completions`;
|
|
2422
2503
|
}
|
|
2423
|
-
function
|
|
2504
|
+
function Co(e) {
|
|
2424
2505
|
const t = /* @__PURE__ */ new Set();
|
|
2425
|
-
return e.flatMap((
|
|
2426
|
-
const
|
|
2427
|
-
if (!
|
|
2428
|
-
throw new Error(`Unknown provider type: ${String(
|
|
2429
|
-
const
|
|
2430
|
-
return
|
|
2431
|
-
if (t.has(
|
|
2432
|
-
throw new Error(`Duplicate model id: ${
|
|
2433
|
-
return t.add(
|
|
2434
|
-
...
|
|
2435
|
-
providerType:
|
|
2436
|
-
providerLabel:
|
|
2437
|
-
apiUrl:
|
|
2438
|
-
apiKey:
|
|
2439
|
-
headers:
|
|
2440
|
-
timeout:
|
|
2506
|
+
return e.flatMap((o) => {
|
|
2507
|
+
const n = yo[o.type];
|
|
2508
|
+
if (!n)
|
|
2509
|
+
throw new Error(`Unknown provider type: ${String(o.type)}`);
|
|
2510
|
+
const c = o.label ?? n.label, v = Ao(o.apiUrl ?? n.apiUrl);
|
|
2511
|
+
return o.models.map((b) => {
|
|
2512
|
+
if (t.has(b.id))
|
|
2513
|
+
throw new Error(`Duplicate model id: ${b.id}`);
|
|
2514
|
+
return t.add(b.id), {
|
|
2515
|
+
...b,
|
|
2516
|
+
providerType: o.type,
|
|
2517
|
+
providerLabel: c,
|
|
2518
|
+
apiUrl: v,
|
|
2519
|
+
apiKey: o.apiKey,
|
|
2520
|
+
headers: o.headers,
|
|
2521
|
+
timeout: o.timeout,
|
|
2441
2522
|
featureBody: {
|
|
2442
|
-
...
|
|
2443
|
-
...
|
|
2523
|
+
...n.featureBody,
|
|
2524
|
+
...b.featureBody
|
|
2444
2525
|
},
|
|
2445
|
-
reasoning:
|
|
2526
|
+
reasoning: b.reasoning ?? n.reasoning
|
|
2446
2527
|
};
|
|
2447
2528
|
});
|
|
2448
2529
|
});
|
|
2449
2530
|
}
|
|
2450
|
-
function
|
|
2531
|
+
function wo(e) {
|
|
2451
2532
|
return [...e].reverse().find((t) => t.role === "user");
|
|
2452
2533
|
}
|
|
2453
|
-
function
|
|
2534
|
+
function So() {
|
|
2454
2535
|
return {
|
|
2455
2536
|
name: "chat-run-config-context",
|
|
2456
2537
|
onTurnStart({ currentTurn: e, setCustomContext: t }) {
|
|
2457
2538
|
t({
|
|
2458
|
-
[ie]:
|
|
2539
|
+
[ie]: vo(wo(e))
|
|
2459
2540
|
});
|
|
2460
2541
|
}
|
|
2461
2542
|
};
|
|
2462
2543
|
}
|
|
2463
|
-
const
|
|
2464
|
-
function
|
|
2465
|
-
var
|
|
2466
|
-
for (const
|
|
2467
|
-
const
|
|
2468
|
-
if (
|
|
2469
|
-
return { serverId:
|
|
2544
|
+
const be = "__chat_tool_snapshot";
|
|
2545
|
+
function ko(e, t) {
|
|
2546
|
+
var o;
|
|
2547
|
+
for (const n of t.serverIds) {
|
|
2548
|
+
const c = (o = t.toolIds[n]) == null ? void 0 : o.find((v) => `${n}__${v}` === e);
|
|
2549
|
+
if (c)
|
|
2550
|
+
return { serverId: n, toolId: c };
|
|
2470
2551
|
}
|
|
2471
2552
|
return null;
|
|
2472
2553
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return
|
|
2475
|
-
getTools: async ({ customContext:
|
|
2476
|
-
const
|
|
2477
|
-
if (!
|
|
2554
|
+
function Eo(e, t) {
|
|
2555
|
+
return Mt({
|
|
2556
|
+
getTools: async ({ customContext: o, setCustomContext: n }) => {
|
|
2557
|
+
const c = o[ie], v = c == null ? void 0 : c.mcp;
|
|
2558
|
+
if (!v)
|
|
2478
2559
|
return [];
|
|
2479
|
-
const
|
|
2480
|
-
(
|
|
2560
|
+
const b = v.serverIds.find(
|
|
2561
|
+
(r) => !Object.prototype.hasOwnProperty.call(v.toolIds, r)
|
|
2481
2562
|
);
|
|
2482
|
-
if (
|
|
2483
|
-
throw new Error(`Tool selection is missing for this turn: ${
|
|
2484
|
-
let a =
|
|
2485
|
-
return Array.isArray(a) || (a = (await e(
|
|
2486
|
-
[
|
|
2487
|
-
})), a.map((
|
|
2563
|
+
if (b)
|
|
2564
|
+
throw new Error(`Tool selection is missing for this turn: ${b}`);
|
|
2565
|
+
let a = o[be];
|
|
2566
|
+
return Array.isArray(a) || (a = (await e(v.serverIds, v.toolIds)).map((r) => ({ ...r })), n({
|
|
2567
|
+
[be]: a
|
|
2568
|
+
})), a.map((r) => ({
|
|
2488
2569
|
type: "function",
|
|
2489
2570
|
function: {
|
|
2490
|
-
name:
|
|
2491
|
-
description:
|
|
2492
|
-
parameters:
|
|
2571
|
+
name: r.name,
|
|
2572
|
+
description: r.description ?? "",
|
|
2573
|
+
parameters: r.inputSchema ?? { type: "object", properties: {} }
|
|
2493
2574
|
}
|
|
2494
2575
|
}));
|
|
2495
2576
|
},
|
|
2496
|
-
callTool: async (
|
|
2497
|
-
var
|
|
2498
|
-
const
|
|
2499
|
-
if (!
|
|
2500
|
-
throw new Error(`Tool is not enabled in this turn: ${
|
|
2501
|
-
const
|
|
2502
|
-
let
|
|
2503
|
-
if (
|
|
2577
|
+
callTool: async (o, { customContext: n }) => {
|
|
2578
|
+
var m, k;
|
|
2579
|
+
const c = n[ie], v = c == null ? void 0 : c.mcp, b = ((m = o.function) == null ? void 0 : m.name) ?? "", a = v ? ko(b, v) : null, r = n[be], u = Array.isArray(r) ? r.find((T) => T.name === b) : void 0;
|
|
2580
|
+
if (!v || !a || !u || u.serverId !== a.serverId || u.id !== a.toolId)
|
|
2581
|
+
throw new Error(`Tool is not enabled in this turn: ${b}`);
|
|
2582
|
+
const y = (k = o.function) == null ? void 0 : k.arguments;
|
|
2583
|
+
let f = {};
|
|
2584
|
+
if (y && y.trim())
|
|
2504
2585
|
try {
|
|
2505
|
-
|
|
2586
|
+
f = JSON.parse(y);
|
|
2506
2587
|
} catch {
|
|
2507
|
-
throw new Error(`Invalid JSON arguments for MCP tool "${
|
|
2588
|
+
throw new Error(`Invalid JSON arguments for MCP tool "${b}".`);
|
|
2508
2589
|
}
|
|
2509
|
-
return t(
|
|
2590
|
+
return t(u.serverId, u.originalName, f);
|
|
2510
2591
|
}
|
|
2511
2592
|
});
|
|
2512
2593
|
}
|
|
2513
|
-
const
|
|
2514
|
-
function
|
|
2515
|
-
let
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2594
|
+
const Oo = 3e4;
|
|
2595
|
+
function Ve(e, t, o) {
|
|
2596
|
+
let n;
|
|
2597
|
+
const c = new Promise((v, b) => {
|
|
2598
|
+
n = setTimeout(() => b(new Error(`MCP ${o} timed out after ${t}ms.`)), t);
|
|
2518
2599
|
});
|
|
2519
|
-
return Promise.race([e,
|
|
2520
|
-
|
|
2600
|
+
return Promise.race([e, c]).finally(() => {
|
|
2601
|
+
n !== void 0 && clearTimeout(n);
|
|
2521
2602
|
});
|
|
2522
2603
|
}
|
|
2523
|
-
function
|
|
2524
|
-
const
|
|
2604
|
+
function Ro(e, t, o) {
|
|
2605
|
+
const n = typeof t.name == "string" && t.name ? t.name : `tool_${o + 1}`;
|
|
2525
2606
|
return {
|
|
2526
2607
|
serverId: e,
|
|
2527
|
-
id:
|
|
2528
|
-
name: `${e}__${
|
|
2529
|
-
originalName:
|
|
2608
|
+
id: n,
|
|
2609
|
+
name: `${e}__${n}`,
|
|
2610
|
+
originalName: n,
|
|
2530
2611
|
description: t.description,
|
|
2531
2612
|
inputSchema: typeof t.inputSchema == "object" && t.inputSchema !== null ? t.inputSchema : { type: "object", properties: {} }
|
|
2532
2613
|
};
|
|
2533
2614
|
}
|
|
2534
|
-
function
|
|
2535
|
-
var
|
|
2615
|
+
function To(e, t) {
|
|
2616
|
+
var o;
|
|
2536
2617
|
try {
|
|
2537
2618
|
return new URL(t);
|
|
2538
2619
|
} catch {
|
|
2539
|
-
const
|
|
2540
|
-
if (!
|
|
2620
|
+
const n = (o = globalThis.location) == null ? void 0 : o.origin;
|
|
2621
|
+
if (!n)
|
|
2541
2622
|
throw new Error(`MCP server "${e}" requires an absolute baseUrl outside a browser environment.`);
|
|
2542
|
-
return new URL(t,
|
|
2623
|
+
return new URL(t, n);
|
|
2543
2624
|
}
|
|
2544
2625
|
}
|
|
2545
|
-
function
|
|
2626
|
+
function Mo(e) {
|
|
2546
2627
|
const t = /* @__PURE__ */ new Map();
|
|
2547
|
-
for (const
|
|
2548
|
-
if (t.has(
|
|
2549
|
-
t.set(
|
|
2628
|
+
for (const d of e) {
|
|
2629
|
+
if (t.has(d.id)) throw new Error(`Duplicate MCP server id: ${d.id}`);
|
|
2630
|
+
t.set(d.id, d);
|
|
2550
2631
|
}
|
|
2551
|
-
const
|
|
2552
|
-
e.map((
|
|
2553
|
-
id:
|
|
2554
|
-
name:
|
|
2555
|
-
description:
|
|
2556
|
-
installed:
|
|
2632
|
+
const o = ge(
|
|
2633
|
+
e.map((d) => ({
|
|
2634
|
+
id: d.id,
|
|
2635
|
+
name: d.name,
|
|
2636
|
+
description: d.description,
|
|
2637
|
+
installed: d.installed === !0,
|
|
2557
2638
|
enabled: !1,
|
|
2558
|
-
metadata:
|
|
2559
|
-
config:
|
|
2639
|
+
metadata: d.icon ? { icon: d.icon } : void 0,
|
|
2640
|
+
config: d
|
|
2560
2641
|
}))
|
|
2561
|
-
),
|
|
2562
|
-
function
|
|
2563
|
-
const
|
|
2564
|
-
if (!
|
|
2565
|
-
return
|
|
2642
|
+
), n = ge({}), c = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
2643
|
+
function r(d) {
|
|
2644
|
+
const s = o.value.find((l) => l.id === d);
|
|
2645
|
+
if (!s) throw new Error(`Unknown MCP server: ${d}`);
|
|
2646
|
+
return s;
|
|
2566
2647
|
}
|
|
2567
|
-
function
|
|
2568
|
-
const
|
|
2569
|
-
delete
|
|
2648
|
+
function u(d) {
|
|
2649
|
+
const s = { ...n.value };
|
|
2650
|
+
delete s[d], n.value = s, c.delete(d), b.delete(d), v.delete(d), a.set(d, (a.get(d) ?? 0) + 1);
|
|
2570
2651
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const
|
|
2573
|
-
|
|
2574
|
-
...
|
|
2575
|
-
[
|
|
2652
|
+
function y(d, s) {
|
|
2653
|
+
const l = n.value[d];
|
|
2654
|
+
l && (n.value = {
|
|
2655
|
+
...n.value,
|
|
2656
|
+
[d]: l.map((i) => ({ ...i, enabled: s }))
|
|
2576
2657
|
});
|
|
2577
2658
|
}
|
|
2578
|
-
async function
|
|
2579
|
-
var
|
|
2580
|
-
const
|
|
2581
|
-
if (!
|
|
2582
|
-
(
|
|
2583
|
-
const
|
|
2584
|
-
requestInit: { headers:
|
|
2585
|
-
}),
|
|
2659
|
+
async function f(d, s) {
|
|
2660
|
+
var $;
|
|
2661
|
+
const l = t.get(d);
|
|
2662
|
+
if (!l) throw new Error(`Unknown MCP server: ${d}`);
|
|
2663
|
+
($ = l.validate) == null || $.call(l, d);
|
|
2664
|
+
const i = new Lt({ name: `tiny-robot-chat-${d}`, version: "1.0.0" }), A = new $t(To(d, l.baseUrl), {
|
|
2665
|
+
requestInit: { headers: l.headers }
|
|
2666
|
+
}), M = l.timeout ?? Oo;
|
|
2586
2667
|
try {
|
|
2587
|
-
return await
|
|
2668
|
+
return await Ve(i.connect(A), M, "connect"), await Ve(s(i), M, "request");
|
|
2588
2669
|
} finally {
|
|
2589
|
-
await
|
|
2670
|
+
await i.close().catch(() => {
|
|
2590
2671
|
});
|
|
2591
2672
|
}
|
|
2592
2673
|
}
|
|
2593
|
-
async function
|
|
2594
|
-
const
|
|
2595
|
-
if (!
|
|
2596
|
-
const
|
|
2597
|
-
if ((
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2674
|
+
async function m(d, s = !1) {
|
|
2675
|
+
const l = c.get(d);
|
|
2676
|
+
if (!s && l) return l;
|
|
2677
|
+
const i = a.get(d) ?? 0, A = v.get(d);
|
|
2678
|
+
if ((A == null ? void 0 : A.generation) === i) return A.task;
|
|
2679
|
+
const M = f(d, async (V) => (await V.listTools()).tools.map((G, Q) => Ro(d, G, Q))), $ = { generation: i, task: M };
|
|
2680
|
+
v.set(d, $);
|
|
2600
2681
|
try {
|
|
2601
|
-
const
|
|
2602
|
-
return (a.get(
|
|
2682
|
+
const V = await M;
|
|
2683
|
+
return (a.get(d) ?? 0) === i && c.set(d, V), V;
|
|
2603
2684
|
} finally {
|
|
2604
|
-
|
|
2685
|
+
v.get(d) === $ && v.delete(d);
|
|
2605
2686
|
}
|
|
2606
2687
|
}
|
|
2607
|
-
async function
|
|
2608
|
-
const
|
|
2609
|
-
if (
|
|
2610
|
-
await
|
|
2688
|
+
async function k(d, s = !0) {
|
|
2689
|
+
const l = b.get(d);
|
|
2690
|
+
if (l) {
|
|
2691
|
+
await l;
|
|
2611
2692
|
return;
|
|
2612
2693
|
}
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2694
|
+
const i = T(d, s);
|
|
2695
|
+
b.set(d, i);
|
|
2615
2696
|
try {
|
|
2616
|
-
await
|
|
2697
|
+
await i;
|
|
2617
2698
|
} finally {
|
|
2618
|
-
|
|
2699
|
+
b.get(d) === i && b.delete(d);
|
|
2619
2700
|
}
|
|
2620
2701
|
}
|
|
2621
|
-
async function
|
|
2622
|
-
const
|
|
2623
|
-
if (!
|
|
2624
|
-
const
|
|
2625
|
-
let
|
|
2626
|
-
|
|
2702
|
+
async function T(d, s) {
|
|
2703
|
+
const l = r(d);
|
|
2704
|
+
if (!l.installed) throw new Error(`MCP server is not installed: ${d}`);
|
|
2705
|
+
const i = a.get(d) ?? 0, A = l;
|
|
2706
|
+
let M = !1;
|
|
2707
|
+
l.loading = !0, l.error = void 0;
|
|
2627
2708
|
try {
|
|
2628
|
-
const
|
|
2629
|
-
if (!
|
|
2630
|
-
|
|
2631
|
-
...
|
|
2632
|
-
[
|
|
2633
|
-
id:
|
|
2634
|
-
name:
|
|
2635
|
-
description:
|
|
2636
|
-
enabled:
|
|
2709
|
+
const $ = await m(d, !0);
|
|
2710
|
+
if (!A.installed || (a.get(d) ?? 0) !== i) return;
|
|
2711
|
+
n.value = {
|
|
2712
|
+
...n.value,
|
|
2713
|
+
[d]: $.map((V) => ({
|
|
2714
|
+
id: V.id,
|
|
2715
|
+
name: V.originalName,
|
|
2716
|
+
description: V.description,
|
|
2717
|
+
enabled: A.enabled && s
|
|
2637
2718
|
}))
|
|
2638
2719
|
};
|
|
2639
|
-
} catch (
|
|
2640
|
-
throw (a.get(
|
|
2720
|
+
} catch ($) {
|
|
2721
|
+
throw (a.get(d) ?? 0) === i && (A.enabled = !1, A.error = $, M = !0, u(d)), $;
|
|
2641
2722
|
} finally {
|
|
2642
|
-
((a.get(
|
|
2723
|
+
((a.get(d) ?? 0) === i || M) && (A.loading = void 0);
|
|
2643
2724
|
}
|
|
2644
2725
|
}
|
|
2645
|
-
const
|
|
2646
|
-
servers: h(() =>
|
|
2726
|
+
const E = {
|
|
2727
|
+
servers: h(() => o.value.map(({ config: d, ...s }) => ({ ...s }))),
|
|
2647
2728
|
tools: h(
|
|
2648
|
-
() => Object.fromEntries(Object.entries(
|
|
2729
|
+
() => Object.fromEntries(Object.entries(n.value).map(([d, s]) => [d, s.map((l) => ({ ...l }))]))
|
|
2649
2730
|
),
|
|
2650
|
-
async addServer(
|
|
2651
|
-
const
|
|
2652
|
-
if (
|
|
2653
|
-
|
|
2731
|
+
async addServer(d) {
|
|
2732
|
+
const s = r(d);
|
|
2733
|
+
if (s.installed = !0, s.enabled = !0, n.value[d]) {
|
|
2734
|
+
y(d, !0);
|
|
2654
2735
|
return;
|
|
2655
2736
|
}
|
|
2656
|
-
await
|
|
2737
|
+
await k(d), y(d, !0);
|
|
2657
2738
|
},
|
|
2658
|
-
removeServer(
|
|
2659
|
-
const
|
|
2660
|
-
|
|
2739
|
+
removeServer(d) {
|
|
2740
|
+
const s = r(d);
|
|
2741
|
+
s.installed = !1, s.enabled = !1, s.loading = void 0, s.error = void 0, u(d);
|
|
2661
2742
|
},
|
|
2662
|
-
async setServerEnabled(
|
|
2663
|
-
const
|
|
2664
|
-
if (
|
|
2665
|
-
if (
|
|
2666
|
-
if (
|
|
2667
|
-
|
|
2743
|
+
async setServerEnabled(d, s) {
|
|
2744
|
+
const l = r(d);
|
|
2745
|
+
if (s && !l.installed) throw new Error(`MCP server is not installed: ${d}`);
|
|
2746
|
+
if (l.enabled = s, l.error = void 0, s) {
|
|
2747
|
+
if (n.value[d]) {
|
|
2748
|
+
y(d, !0);
|
|
2668
2749
|
return;
|
|
2669
2750
|
}
|
|
2670
|
-
await
|
|
2751
|
+
await k(d), y(d, !0);
|
|
2671
2752
|
} else
|
|
2672
|
-
|
|
2753
|
+
y(d, !1);
|
|
2673
2754
|
},
|
|
2674
|
-
setToolEnabled(
|
|
2675
|
-
const
|
|
2676
|
-
if (!
|
|
2677
|
-
if (!
|
|
2678
|
-
if (!
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2681
|
-
...
|
|
2682
|
-
[
|
|
2683
|
-
},
|
|
2755
|
+
setToolEnabled(d, s, l) {
|
|
2756
|
+
const i = r(d), A = n.value[d];
|
|
2757
|
+
if (!i.installed) throw new Error(`MCP server is not installed: ${d}`);
|
|
2758
|
+
if (!A) throw new Error(`MCP tools are not loaded: ${d}`);
|
|
2759
|
+
if (!A.some(($) => $.id === s)) throw new Error(`Unknown MCP tool: ${d}/${s}`);
|
|
2760
|
+
const M = A.map(($) => $.id === s ? { ...$, enabled: l } : $);
|
|
2761
|
+
n.value = {
|
|
2762
|
+
...n.value,
|
|
2763
|
+
[d]: M
|
|
2764
|
+
}, l ? i.enabled = !0 : M.some(($) => $.enabled) || (i.enabled = !1);
|
|
2684
2765
|
}
|
|
2685
2766
|
};
|
|
2686
|
-
for (const
|
|
2687
|
-
|
|
2767
|
+
for (const d of o.value)
|
|
2768
|
+
d.installed && k(d.id, !1).catch(() => {
|
|
2688
2769
|
});
|
|
2689
|
-
return { runtime:
|
|
2690
|
-
const
|
|
2691
|
-
for (const
|
|
2692
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
2693
|
-
throw new Error(`MCP tool selection is missing for this turn: ${
|
|
2694
|
-
const
|
|
2695
|
-
if (
|
|
2696
|
-
const
|
|
2697
|
-
if (
|
|
2698
|
-
throw new Error(`MCP tools selected for this turn no longer exist on "${
|
|
2699
|
-
|
|
2700
|
-
}
|
|
2701
|
-
return
|
|
2702
|
-
}, callTool: (
|
|
2770
|
+
return { runtime: E, listTools: async (d, s) => {
|
|
2771
|
+
const l = [];
|
|
2772
|
+
for (const i of d) {
|
|
2773
|
+
if (!Object.prototype.hasOwnProperty.call(s, i))
|
|
2774
|
+
throw new Error(`MCP tool selection is missing for this turn: ${i}`);
|
|
2775
|
+
const A = c.get(i) ?? await m(i), M = s[i];
|
|
2776
|
+
if (M.length === 0) continue;
|
|
2777
|
+
const $ = A.filter((V) => M.includes(V.id));
|
|
2778
|
+
if ($.length !== M.length)
|
|
2779
|
+
throw new Error(`MCP tools selected for this turn no longer exist on "${i}".`);
|
|
2780
|
+
l.push(...$);
|
|
2781
|
+
}
|
|
2782
|
+
return l;
|
|
2783
|
+
}, callTool: (d, s, l) => f(d, (i) => i.callTool({ name: s, arguments: l })) };
|
|
2703
2784
|
}
|
|
2704
|
-
function
|
|
2705
|
-
var
|
|
2706
|
-
const t = e.conversation ?? {},
|
|
2785
|
+
function Wo(e) {
|
|
2786
|
+
var m;
|
|
2787
|
+
const t = e.conversation ?? {}, o = e.titleGenerator ?? Ke, n = t.useMessageOptions, c = n == null ? void 0 : n.responseProvider;
|
|
2707
2788
|
if (e.mcp !== void 0 && e.mcpServers !== void 0)
|
|
2708
2789
|
throw new Error("useLocalChatRuntime: mcp and mcpServers cannot be configured at the same time.");
|
|
2709
|
-
if ((
|
|
2790
|
+
if ((m = e.modelProviders) != null && m.length && c)
|
|
2710
2791
|
throw new Error("useLocalChatRuntime: modelProviders and responseProvider cannot be configured at the same time.");
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
const
|
|
2714
|
-
...
|
|
2715
|
-
plugins: [...
|
|
2716
|
-
responseProvider:
|
|
2792
|
+
const v = e.modelProviders ? Co(e.modelProviders) : [], b = v.length > 0 ? go(v) : null, a = e.mcpServers !== void 0 ? Mo(e.mcpServers) : e.mcp, r = e.composer ?? {}, u = [So()];
|
|
2793
|
+
b && u.push(ho(b.resolveModel)), a && u.push(Eo(a.listTools, a.callTool));
|
|
2794
|
+
const y = {
|
|
2795
|
+
...n,
|
|
2796
|
+
plugins: [...u, ...(n == null ? void 0 : n.plugins) ?? []],
|
|
2797
|
+
responseProvider: b ? po(b.resolveModel) : c
|
|
2717
2798
|
};
|
|
2718
|
-
if (!
|
|
2799
|
+
if (!y.responseProvider)
|
|
2719
2800
|
throw new Error("useLocalChatRuntime requires conversation.useMessageOptions.responseProvider or modelProviders.");
|
|
2720
|
-
const
|
|
2801
|
+
const f = Pt({
|
|
2721
2802
|
autoSaveMessages: !0,
|
|
2722
2803
|
...t,
|
|
2723
|
-
useMessageOptions:
|
|
2804
|
+
useMessageOptions: y
|
|
2724
2805
|
});
|
|
2725
|
-
return
|
|
2726
|
-
conversation:
|
|
2727
|
-
titleGenerator:
|
|
2806
|
+
return bo({
|
|
2807
|
+
conversation: f,
|
|
2808
|
+
titleGenerator: o,
|
|
2728
2809
|
composer: {
|
|
2729
|
-
...
|
|
2730
|
-
model:
|
|
2810
|
+
...r,
|
|
2811
|
+
model: b == null ? void 0 : b.model,
|
|
2731
2812
|
mcp: a == null ? void 0 : a.runtime
|
|
2732
2813
|
}
|
|
2733
2814
|
});
|
|
2734
2815
|
}
|
|
2735
2816
|
export {
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2817
|
+
Fo as TrChat,
|
|
2818
|
+
lo as TrChatUI,
|
|
2819
|
+
Bt as useChatHistoryItems,
|
|
2820
|
+
io as useChatRuntimeAdapter,
|
|
2821
|
+
bo as useKitChatRuntime,
|
|
2822
|
+
Wo as useLocalChatRuntime
|
|
2742
2823
|
};
|