@opentiny/tiny-robot 0.3.0-alpha.9 → 0.3.0-rc.0
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/action-group/index.js +14 -14
- package/dist/attachments/index.js +526 -0
- package/dist/bubble/index.js +2067 -1322
- package/dist/container/index.js +33 -33
- package/dist/drag-overlay/index.js +57 -0
- package/dist/dropdown-menu/index.js +117 -50
- package/dist/feedback/index.js +75 -75
- package/dist/flow-layout-buttons/index.js +29 -29
- package/dist/history/index.js +71 -72
- package/dist/index.d.ts +1029 -451
- package/dist/index.js +207 -63
- package/dist/index2.js +477 -388
- package/dist/index3.js +98 -88
- package/dist/loading.js +4 -0
- package/dist/mcp-server-picker/index.js +736 -0
- package/dist/no-data.js +4 -0
- package/dist/sender/index.js +900 -782
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +15 -15
- package/dist/suggestion-popover/index.js +185 -183
- package/dist/useSlotRefs.js +6 -6
- package/dist/utils.js +8 -2
- package/package.json +5 -9
- package/dist/close.js +0 -29
- package/dist/index4.js +0 -315
- package/dist/index5.js +0 -637
- package/dist/index6.js +0 -2156
- package/dist/index7.js +0 -4749
- package/dist/question/index.js +0 -429
- package/dist/suggestion/index.js +0 -497
- package/dist/tiny-robot-svgs.js +0 -590
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
import { defineComponent as M, ref as D, computed as y, createElementBlock as d, openBlock as s, normalizeClass as K, createElementVNode as e, createBlock as x, createCommentVNode as k, toDisplayString as U, renderSlot as j, Fragment as I, unref as u, createVNode as g, withCtx as S, Transition as Y, withDirectives as F, renderList as H, vShow as ve, useModel as G, vModelText as O, watch as Q, onUnmounted as fe, mergeModels as X, normalizeStyle as he, createTextVNode as ye } from "vue";
|
|
2
|
+
import { TinyPopconfirm as ke, TinySwitch as ee, TinyRadioGroup as re, TinyTabs as be, TinyTabItem as te, TinyInput as le, TinySelect as Te, TinyOption as Ce, TinyModal as oe } from "@opentiny/vue";
|
|
3
|
+
import { IconArrowRight as Pe, IconArrowDown as $e, IconDelete as xe, IconClose as de, IconEmptySearch as we, IconPlus as Se, IconSearch as ae } from "@opentiny/tiny-robot-svgs";
|
|
4
|
+
import { _ as E } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
import { _ as De } from "../no-data.js";
|
|
6
|
+
import { d as Ve, o as Ue } from "../index2.js";
|
|
7
|
+
const Be = { class: "plugin-card__main" }, Ae = ["src"], Fe = { class: "plugin-card__content" }, Ie = { class: "plugin-card__info" }, Me = { class: "plugin-card__name" }, Ee = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "plugin-card__count"
|
|
10
|
+
}, Le = ["title"], Oe = { class: "plugin-card__actions" }, Re = { class: "plugin-card__operations" }, Ne = { title: "移除插件" }, ze = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "plugin-card__add"
|
|
13
|
+
}, qe = { class: "plugin-card__tools" }, je = { class: "plugin-card__tool" }, He = { class: "plugin-card__content" }, Qe = { class: "plugin-card__info" }, Je = { class: "plugin-card__name" }, Ge = ["title"], We = { class: "plugin-card__actions plugin-card__actions--tool" }, Ke = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "plugin-card__divider"
|
|
16
|
+
}, Xe = /* @__PURE__ */ M({
|
|
17
|
+
__name: "PluginCard",
|
|
18
|
+
props: {
|
|
19
|
+
plugin: {},
|
|
20
|
+
mode: { default: "installed" },
|
|
21
|
+
showToolCount: { type: Boolean, default: !0 }
|
|
22
|
+
},
|
|
23
|
+
emits: ["toggle-plugin", "toggle-tool", "add-plugin", "delete-plugin"],
|
|
24
|
+
setup(m, { emit: p }) {
|
|
25
|
+
const t = m, r = p, c = D(t.plugin.expanded || !1), b = y(() => {
|
|
26
|
+
var i;
|
|
27
|
+
return ((i = t.plugin.tools) == null ? void 0 : i.length) || 0;
|
|
28
|
+
}), v = y(() => b.value > 0), T = y(() => ({
|
|
29
|
+
"plugin-card--expandable": v.value,
|
|
30
|
+
"plugin-card--expanded": c.value,
|
|
31
|
+
[`plugin-card--${t.mode}`]: !0
|
|
32
|
+
})), V = () => {
|
|
33
|
+
v.value && (c.value = !c.value);
|
|
34
|
+
}, a = y(() => {
|
|
35
|
+
if (!v.value)
|
|
36
|
+
return { checked: t.plugin.enabled || !1, indeterminate: !1 };
|
|
37
|
+
const i = t.plugin.tools.filter((w) => w.enabled), C = t.plugin.tools.length;
|
|
38
|
+
return i.length === 0 ? { checked: !1, indeterminate: !1 } : i.length === C ? { checked: !0, indeterminate: !1 } : { checked: !0, indeterminate: !0 };
|
|
39
|
+
}), h = (i) => {
|
|
40
|
+
v.value && t.plugin.tools.forEach((C) => {
|
|
41
|
+
C.enabled !== i && (C.enabled = i, r("toggle-tool", C.id, i));
|
|
42
|
+
}), r("toggle-plugin", i);
|
|
43
|
+
}, R = (i, C) => {
|
|
44
|
+
r("toggle-tool", i, C);
|
|
45
|
+
}, _ = () => {
|
|
46
|
+
r("delete-plugin");
|
|
47
|
+
}, P = y(() => t.plugin.added || !1), N = () => {
|
|
48
|
+
const i = !P.value;
|
|
49
|
+
r("add-plugin", i);
|
|
50
|
+
}, z = (i) => i ? "关闭插件" : "打开插件";
|
|
51
|
+
return (i, C) => (s(), d("div", {
|
|
52
|
+
class: K(["plugin-card", T.value])
|
|
53
|
+
}, [
|
|
54
|
+
e("div", Be, [
|
|
55
|
+
e("img", {
|
|
56
|
+
src: i.plugin.icon,
|
|
57
|
+
class: "plugin-card__icon"
|
|
58
|
+
}, null, 8, Ae),
|
|
59
|
+
e("div", Fe, [
|
|
60
|
+
e("div", Ie, [
|
|
61
|
+
e("span", Me, U(i.plugin.name), 1),
|
|
62
|
+
i.showToolCount && b.value ? (s(), d("span", Ee, U(b.value) + " 个工具 ", 1)) : k("", !0)
|
|
63
|
+
]),
|
|
64
|
+
e("div", {
|
|
65
|
+
class: "plugin-card__desc",
|
|
66
|
+
title: i.plugin.description
|
|
67
|
+
}, U(i.plugin.description), 9, Le)
|
|
68
|
+
]),
|
|
69
|
+
e("div", Oe, [
|
|
70
|
+
j(i.$slots, "actions", {
|
|
71
|
+
plugin: i.plugin,
|
|
72
|
+
expanded: c.value,
|
|
73
|
+
mode: i.mode
|
|
74
|
+
}, () => [
|
|
75
|
+
i.mode === "installed" ? (s(), d(I, { key: 0 }, [
|
|
76
|
+
v.value ? (s(), d("div", {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: "plugin-card__expand",
|
|
79
|
+
onClick: V
|
|
80
|
+
}, [
|
|
81
|
+
j(i.$slots, "expand-icon", { expanded: c.value }, () => [
|
|
82
|
+
c.value ? (s(), x(u($e), {
|
|
83
|
+
key: 1,
|
|
84
|
+
class: "common-icon"
|
|
85
|
+
})) : (s(), x(u(Pe), {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: "common-icon"
|
|
88
|
+
}))
|
|
89
|
+
], !0)
|
|
90
|
+
])) : k("", !0),
|
|
91
|
+
e("div", Re, [
|
|
92
|
+
g(u(ke), {
|
|
93
|
+
title: "确定移除该插件吗?",
|
|
94
|
+
style: { height: "16px" },
|
|
95
|
+
type: "info",
|
|
96
|
+
onConfirm: _,
|
|
97
|
+
trigger: "click"
|
|
98
|
+
}, {
|
|
99
|
+
reference: S(() => [
|
|
100
|
+
j(i.$slots, "delete-icon", {}, () => [
|
|
101
|
+
e("span", Ne, [
|
|
102
|
+
g(u(xe), { class: "common-icon" })
|
|
103
|
+
])
|
|
104
|
+
], !0)
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}),
|
|
108
|
+
g(u(ee), {
|
|
109
|
+
title: z(a.value.checked),
|
|
110
|
+
"model-value": a.value.checked,
|
|
111
|
+
indeterminate: a.value.indeterminate,
|
|
112
|
+
"onUpdate:modelValue": h
|
|
113
|
+
}, null, 8, ["title", "model-value", "indeterminate"])
|
|
114
|
+
])
|
|
115
|
+
], 64)) : i.mode === "market" ? (s(), d("div", ze, [
|
|
116
|
+
j(i.$slots, "add-button", {}, () => [
|
|
117
|
+
e("div", {
|
|
118
|
+
class: K(["plugin-card__add-button", { "plugin-card__add-button--added": P.value }]),
|
|
119
|
+
onClick: N
|
|
120
|
+
}, [
|
|
121
|
+
e("span", null, U(P.value ? "已添加" : "添加"), 1)
|
|
122
|
+
], 2)
|
|
123
|
+
], !0)
|
|
124
|
+
])) : k("", !0)
|
|
125
|
+
], !0)
|
|
126
|
+
])
|
|
127
|
+
]),
|
|
128
|
+
v.value ? (s(), x(Y, {
|
|
129
|
+
key: 0,
|
|
130
|
+
name: "plugin-card-slide"
|
|
131
|
+
}, {
|
|
132
|
+
default: S(() => [
|
|
133
|
+
F(e("div", qe, [
|
|
134
|
+
C[1] || (C[1] = e("div", { class: "plugin-card__divider" }, null, -1)),
|
|
135
|
+
(s(!0), d(I, null, H(i.plugin.tools, (w, A) => {
|
|
136
|
+
var q;
|
|
137
|
+
return s(), d("div", {
|
|
138
|
+
key: w.id,
|
|
139
|
+
class: "plugin-card__tool-item"
|
|
140
|
+
}, [
|
|
141
|
+
e("div", je, [
|
|
142
|
+
C[0] || (C[0] = e("div", { class: "plugin-card__icon plugin-card__icon--placeholder" }, null, -1)),
|
|
143
|
+
e("div", He, [
|
|
144
|
+
e("div", Qe, [
|
|
145
|
+
e("span", Je, U(w.name), 1)
|
|
146
|
+
]),
|
|
147
|
+
e("div", {
|
|
148
|
+
class: "plugin-card__desc",
|
|
149
|
+
title: w.description
|
|
150
|
+
}, U(w.description), 9, Ge)
|
|
151
|
+
]),
|
|
152
|
+
e("div", We, [
|
|
153
|
+
g(u(ee), {
|
|
154
|
+
title: z(w.enabled),
|
|
155
|
+
"model-value": w.enabled,
|
|
156
|
+
"onUpdate:modelValue": (W) => R(w.id, W)
|
|
157
|
+
}, null, 8, ["title", "model-value", "onUpdate:modelValue"])
|
|
158
|
+
])
|
|
159
|
+
]),
|
|
160
|
+
A < (((q = i.plugin.tools) == null ? void 0 : q.length) || 0) - 1 ? (s(), d("div", Ke)) : k("", !0)
|
|
161
|
+
]);
|
|
162
|
+
}), 128))
|
|
163
|
+
], 512), [
|
|
164
|
+
[ve, c.value]
|
|
165
|
+
])
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
})) : k("", !0)
|
|
169
|
+
], 2));
|
|
170
|
+
}
|
|
171
|
+
}), se = /* @__PURE__ */ E(Xe, [["__scopeId", "data-v-dc13ac19"]]), Ye = { class: "code-editor__container" }, Ze = { class: "code-editor__section" }, et = { class: "code-editor__area" }, tt = /* @__PURE__ */ M({
|
|
172
|
+
__name: "CodeEditor",
|
|
173
|
+
props: {
|
|
174
|
+
codeData: { required: !0 },
|
|
175
|
+
codeDataModifiers: {}
|
|
176
|
+
},
|
|
177
|
+
emits: ["update:codeData"],
|
|
178
|
+
setup(m) {
|
|
179
|
+
const p = G(m, "codeData");
|
|
180
|
+
return (t, r) => (s(), d("div", Ye, [
|
|
181
|
+
e("div", Ze, [
|
|
182
|
+
r[1] || (r[1] = e("div", { class: "code-editor__header" }, [
|
|
183
|
+
e("span", { class: "code-editor__title" }, "ai_plugin(填写json)")
|
|
184
|
+
], -1)),
|
|
185
|
+
e("div", et, [
|
|
186
|
+
F(e("textarea", {
|
|
187
|
+
"onUpdate:modelValue": r[0] || (r[0] = (c) => p.value = c),
|
|
188
|
+
class: "code-editor__textarea",
|
|
189
|
+
placeholder: "请输入 JSON 配置..."
|
|
190
|
+
}, null, 512), [
|
|
191
|
+
[O, p.value]
|
|
192
|
+
])
|
|
193
|
+
])
|
|
194
|
+
])
|
|
195
|
+
]));
|
|
196
|
+
}
|
|
197
|
+
}), lt = /* @__PURE__ */ E(tt, [["__scopeId", "data-v-87ddff5d"]]), ot = { class: "form-editor__container" }, at = { class: "form-editor__item" }, st = { class: "form-editor__item" }, nt = { class: "form-editor__item" }, it = { class: "form-editor__item" }, rt = { class: "form-editor__item" }, dt = { class: "form-editor__item" }, ut = ["src"], ne = "https://res.hc-cdn.com/tinyui-design/1.1.0.20250526191525/home/images/tiny-ng.svg", ct = /* @__PURE__ */ M({
|
|
198
|
+
__name: "FormEditor",
|
|
199
|
+
props: {
|
|
200
|
+
formData: { required: !0 },
|
|
201
|
+
formDataModifiers: {}
|
|
202
|
+
},
|
|
203
|
+
emits: ["update:formData"],
|
|
204
|
+
setup(m) {
|
|
205
|
+
const p = D(""), t = G(m, "formData"), r = [
|
|
206
|
+
{ label: "sse", text: "服务器发送事件(SSE)" },
|
|
207
|
+
{ label: "streamableHttp", text: "流式HTTP(Streamable HTTP)" }
|
|
208
|
+
], { open: c, files: b } = Ve({
|
|
209
|
+
accept: "image/*",
|
|
210
|
+
// 只接受图片文件
|
|
211
|
+
multiple: !1
|
|
212
|
+
// 只允许选择单个文件
|
|
213
|
+
}), v = () => {
|
|
214
|
+
p.value && p.value !== ne && (URL.revokeObjectURL(p.value), p.value = "");
|
|
215
|
+
};
|
|
216
|
+
Q(b, (V) => {
|
|
217
|
+
if (V && V.length > 0) {
|
|
218
|
+
const a = V[0];
|
|
219
|
+
if (!a.type.startsWith("image/"))
|
|
220
|
+
return;
|
|
221
|
+
const h = 5 * 1024 * 1024;
|
|
222
|
+
if (a.size > h)
|
|
223
|
+
return;
|
|
224
|
+
v(), p.value = URL.createObjectURL(a), t.value.thumbnail = a;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const T = () => {
|
|
228
|
+
c();
|
|
229
|
+
};
|
|
230
|
+
return fe(() => {
|
|
231
|
+
v();
|
|
232
|
+
}), (V, a) => (s(), d("form", ot, [
|
|
233
|
+
e("div", at, [
|
|
234
|
+
a[5] || (a[5] = e("label", { class: "form-editor__label" }, "名称", -1)),
|
|
235
|
+
F(e("input", {
|
|
236
|
+
"onUpdate:modelValue": a[0] || (a[0] = (h) => t.value.name = h),
|
|
237
|
+
class: "form-editor__input",
|
|
238
|
+
type: "text",
|
|
239
|
+
placeholder: "请输入插件名称"
|
|
240
|
+
}, null, 512), [
|
|
241
|
+
[O, t.value.name]
|
|
242
|
+
])
|
|
243
|
+
]),
|
|
244
|
+
e("div", st, [
|
|
245
|
+
a[6] || (a[6] = e("label", { class: "form-editor__label" }, "描述", -1)),
|
|
246
|
+
F(e("textarea", {
|
|
247
|
+
"onUpdate:modelValue": a[1] || (a[1] = (h) => t.value.description = h),
|
|
248
|
+
class: "form-editor__textarea",
|
|
249
|
+
placeholder: "请输入插件描述"
|
|
250
|
+
}, null, 512), [
|
|
251
|
+
[O, t.value.description]
|
|
252
|
+
])
|
|
253
|
+
]),
|
|
254
|
+
e("div", nt, [
|
|
255
|
+
a[7] || (a[7] = e("label", { class: "form-editor__label" }, "类型", -1)),
|
|
256
|
+
g(u(re), {
|
|
257
|
+
modelValue: t.value.type,
|
|
258
|
+
"onUpdate:modelValue": a[2] || (a[2] = (h) => t.value.type = h),
|
|
259
|
+
options: r,
|
|
260
|
+
class: "form-editor__radio-group"
|
|
261
|
+
}, null, 8, ["modelValue"])
|
|
262
|
+
]),
|
|
263
|
+
e("div", it, [
|
|
264
|
+
a[8] || (a[8] = e("label", { class: "form-editor__label" }, "URL", -1)),
|
|
265
|
+
F(e("input", {
|
|
266
|
+
"onUpdate:modelValue": a[3] || (a[3] = (h) => t.value.url = h),
|
|
267
|
+
class: "form-editor__input",
|
|
268
|
+
type: "url",
|
|
269
|
+
placeholder: "请输入插件URL"
|
|
270
|
+
}, null, 512), [
|
|
271
|
+
[O, t.value.url]
|
|
272
|
+
])
|
|
273
|
+
]),
|
|
274
|
+
e("div", rt, [
|
|
275
|
+
a[9] || (a[9] = e("label", { class: "form-editor__label" }, "请求头", -1)),
|
|
276
|
+
F(e("textarea", {
|
|
277
|
+
"onUpdate:modelValue": a[4] || (a[4] = (h) => t.value.headers = h),
|
|
278
|
+
class: "form-editor__textarea",
|
|
279
|
+
placeholder: "请输入请求头,格式为JSON"
|
|
280
|
+
}, null, 512), [
|
|
281
|
+
[O, t.value.headers]
|
|
282
|
+
])
|
|
283
|
+
]),
|
|
284
|
+
e("div", dt, [
|
|
285
|
+
a[11] || (a[11] = e("label", { class: "form-editor__label" }, "缩略图", -1)),
|
|
286
|
+
e("div", {
|
|
287
|
+
class: "form-editor__file-upload",
|
|
288
|
+
onClick: T
|
|
289
|
+
}, [
|
|
290
|
+
e("img", {
|
|
291
|
+
src: p.value || ne,
|
|
292
|
+
alt: "缩略图预览",
|
|
293
|
+
class: "form-editor__file-preview-image"
|
|
294
|
+
}, null, 8, ut),
|
|
295
|
+
a[10] || (a[10] = e("div", { class: "form-editor__file-overlay" }, [
|
|
296
|
+
e("div", { class: "form-editor__file-icon" })
|
|
297
|
+
], -1))
|
|
298
|
+
])
|
|
299
|
+
])
|
|
300
|
+
]));
|
|
301
|
+
}
|
|
302
|
+
}), pt = /* @__PURE__ */ E(ct, [["__scopeId", "data-v-7cd7ea10"]]), mt = {
|
|
303
|
+
key: 0,
|
|
304
|
+
class: "plugin-editor__backdrop"
|
|
305
|
+
}, _t = { class: "plugin-editor__header" }, gt = { class: "plugin-editor__content" }, vt = { class: "plugin-editor__add-type" }, ft = {
|
|
306
|
+
key: 0,
|
|
307
|
+
class: "plugin-editor__form-editor"
|
|
308
|
+
}, ht = {
|
|
309
|
+
key: 1,
|
|
310
|
+
class: "plugin-editor__code-editor"
|
|
311
|
+
}, yt = /* @__PURE__ */ M({
|
|
312
|
+
__name: "PluginModal",
|
|
313
|
+
props: {
|
|
314
|
+
visible: { type: Boolean, required: !0 },
|
|
315
|
+
visibleModifiers: {}
|
|
316
|
+
},
|
|
317
|
+
emits: /* @__PURE__ */ X(["update:visible", "confirm"], ["update:visible"]),
|
|
318
|
+
setup(m, { emit: p }) {
|
|
319
|
+
const t = p, r = G(m, "visible"), c = D(null), b = D({
|
|
320
|
+
name: "",
|
|
321
|
+
description: "",
|
|
322
|
+
type: "sse",
|
|
323
|
+
url: "",
|
|
324
|
+
headers: "",
|
|
325
|
+
thumbnail: null
|
|
326
|
+
}), v = D(""), T = D("form"), V = [
|
|
327
|
+
{ label: "form", text: "表单添加" },
|
|
328
|
+
{ label: "code", text: "代码添加" }
|
|
329
|
+
], a = () => {
|
|
330
|
+
r.value = !1;
|
|
331
|
+
};
|
|
332
|
+
Ue(c, () => {
|
|
333
|
+
r.value && a();
|
|
334
|
+
});
|
|
335
|
+
const h = () => {
|
|
336
|
+
T.value === "form" ? t("confirm", "form", b.value) : t("confirm", "code", v.value), a();
|
|
337
|
+
};
|
|
338
|
+
return (R, _) => (s(), d(I, null, [
|
|
339
|
+
r.value ? (s(), d("div", mt)) : k("", !0),
|
|
340
|
+
g(Y, { name: "plugin-editor" }, {
|
|
341
|
+
default: S(() => [
|
|
342
|
+
r.value ? (s(), d("div", {
|
|
343
|
+
key: 0,
|
|
344
|
+
class: "plugin-editor",
|
|
345
|
+
ref_key: "dialogRef",
|
|
346
|
+
ref: c
|
|
347
|
+
}, [
|
|
348
|
+
e("div", _t, [
|
|
349
|
+
_[3] || (_[3] = e("h3", { class: "plugin-editor__title" }, "添加插件", -1)),
|
|
350
|
+
g(u(de), {
|
|
351
|
+
class: "plugin-editor__close",
|
|
352
|
+
onClick: a
|
|
353
|
+
})
|
|
354
|
+
]),
|
|
355
|
+
e("div", gt, [
|
|
356
|
+
e("div", vt, [
|
|
357
|
+
_[4] || (_[4] = e("span", { class: "plugin-editor__add-type-label" }, "添加方式", -1)),
|
|
358
|
+
g(u(re), {
|
|
359
|
+
modelValue: T.value,
|
|
360
|
+
"onUpdate:modelValue": _[0] || (_[0] = (P) => T.value = P),
|
|
361
|
+
type: "button",
|
|
362
|
+
options: V
|
|
363
|
+
}, null, 8, ["modelValue"])
|
|
364
|
+
]),
|
|
365
|
+
T.value === "form" ? (s(), d("div", ft, [
|
|
366
|
+
g(pt, {
|
|
367
|
+
"form-data": b.value,
|
|
368
|
+
"onUpdate:formData": _[1] || (_[1] = (P) => b.value = P)
|
|
369
|
+
}, null, 8, ["form-data"])
|
|
370
|
+
])) : k("", !0),
|
|
371
|
+
T.value === "code" ? (s(), d("div", ht, [
|
|
372
|
+
g(lt, {
|
|
373
|
+
"code-data": v.value,
|
|
374
|
+
"onUpdate:codeData": _[2] || (_[2] = (P) => v.value = P)
|
|
375
|
+
}, null, 8, ["code-data"])
|
|
376
|
+
])) : k("", !0)
|
|
377
|
+
]),
|
|
378
|
+
e("div", { class: "plugin-editor__footer" }, [
|
|
379
|
+
e("div", {
|
|
380
|
+
class: "button cancel",
|
|
381
|
+
onClick: a
|
|
382
|
+
}, _[5] || (_[5] = [
|
|
383
|
+
e("span", null, "取消", -1)
|
|
384
|
+
])),
|
|
385
|
+
e("div", {
|
|
386
|
+
class: "button confirm",
|
|
387
|
+
onClick: h
|
|
388
|
+
}, _[6] || (_[6] = [
|
|
389
|
+
e("span", null, "确定", -1)
|
|
390
|
+
]))
|
|
391
|
+
])
|
|
392
|
+
], 512)) : k("", !0)
|
|
393
|
+
]),
|
|
394
|
+
_: 1
|
|
395
|
+
})
|
|
396
|
+
], 64));
|
|
397
|
+
}
|
|
398
|
+
}), kt = /* @__PURE__ */ E(yt, [["__scopeId", "data-v-192c66c9"]]), bt = {
|
|
399
|
+
class: "empty-state",
|
|
400
|
+
role: "status",
|
|
401
|
+
"aria-live": "polite"
|
|
402
|
+
}, Tt = {
|
|
403
|
+
key: 1,
|
|
404
|
+
src: De,
|
|
405
|
+
class: "empty-state__illustration"
|
|
406
|
+
}, Ct = { class: "empty-state__message" }, Pt = /* @__PURE__ */ M({
|
|
407
|
+
__name: "NoData",
|
|
408
|
+
props: {
|
|
409
|
+
searchQuery: { default: "" }
|
|
410
|
+
},
|
|
411
|
+
setup(m) {
|
|
412
|
+
const p = m, t = y(() => {
|
|
413
|
+
var c;
|
|
414
|
+
return !!((c = p.searchQuery) != null && c.trim());
|
|
415
|
+
}), r = y(() => t.value ? "暂无搜索结果" : "暂无数据");
|
|
416
|
+
return (c, b) => (s(), d("section", bt, [
|
|
417
|
+
t.value ? (s(), x(u(we), {
|
|
418
|
+
key: 0,
|
|
419
|
+
class: "empty-state__illustration"
|
|
420
|
+
})) : (s(), d("img", Tt)),
|
|
421
|
+
e("p", Ct, U(r.value), 1)
|
|
422
|
+
]));
|
|
423
|
+
}
|
|
424
|
+
}), ie = /* @__PURE__ */ E(Pt, [["__scopeId", "data-v-839781e5"]]), $t = { class: "mcp-server-picker__header" }, xt = { class: "mcp-server-picker__header-left" }, wt = { class: "mcp-server-picker__header-right" }, St = { class: "mcp-server-picker__content" }, Dt = { class: "mcp-server-picker__content-item" }, Vt = {
|
|
425
|
+
key: 0,
|
|
426
|
+
class: "mcp-server-picker__content-installed-search"
|
|
427
|
+
}, Ut = {
|
|
428
|
+
key: 1,
|
|
429
|
+
class: "mcp-server-picker__content-installed-list"
|
|
430
|
+
}, Bt = {
|
|
431
|
+
key: 0,
|
|
432
|
+
class: "mcp-server-picker__loading"
|
|
433
|
+
}, At = {
|
|
434
|
+
key: 0,
|
|
435
|
+
class: "mcp-server-picker__content-market-header"
|
|
436
|
+
}, Ft = {
|
|
437
|
+
key: 0,
|
|
438
|
+
style: { width: "168px" }
|
|
439
|
+
}, It = {
|
|
440
|
+
key: 1,
|
|
441
|
+
style: { width: "264px", "flex-shrink": "0" }
|
|
442
|
+
}, Mt = {
|
|
443
|
+
key: 1,
|
|
444
|
+
class: "mcp-server-picker__content-market-list"
|
|
445
|
+
}, Et = {
|
|
446
|
+
key: 0,
|
|
447
|
+
class: "mcp-server-picker__loading"
|
|
448
|
+
}, Lt = /* @__PURE__ */ M({
|
|
449
|
+
__name: "index",
|
|
450
|
+
props: /* @__PURE__ */ X({
|
|
451
|
+
installedPlugins: { default: () => [] },
|
|
452
|
+
marketPlugins: { default: () => [] },
|
|
453
|
+
searchPlaceholder: { default: "搜索插件" },
|
|
454
|
+
enableSearch: { type: Boolean, default: !0 },
|
|
455
|
+
installedSearchFn: { type: Function, default: (m, p) => m ? p.name.toLowerCase().includes(m.toLowerCase()) : !0 },
|
|
456
|
+
marketSearchFn: { type: Function, default: (m, p) => m ? p.name.toLowerCase().includes(m.toLowerCase()) : !0 },
|
|
457
|
+
marketCategoryOptions: { default: () => [] },
|
|
458
|
+
marketCategoryPlaceholder: { default: "按照分类筛选" },
|
|
459
|
+
enableMarketCategoryFilter: { type: Boolean, default: !0 },
|
|
460
|
+
defaultActiveTab: { default: "installed" },
|
|
461
|
+
showInstalledTab: { type: Boolean, default: !0 },
|
|
462
|
+
showMarketTab: { type: Boolean, default: !0 },
|
|
463
|
+
visible: { type: Boolean },
|
|
464
|
+
popupConfig: { default: () => ({
|
|
465
|
+
type: "fixed",
|
|
466
|
+
position: {},
|
|
467
|
+
drawer: { direction: "right" }
|
|
468
|
+
}) },
|
|
469
|
+
activeCount: {},
|
|
470
|
+
installedTabTitle: { default: "已添加插件" },
|
|
471
|
+
marketTabTitle: { default: "市场" },
|
|
472
|
+
title: { default: "插件" },
|
|
473
|
+
showCustomAddButton: { type: Boolean, default: !0 },
|
|
474
|
+
customAddButtonText: { default: "自定义添加" },
|
|
475
|
+
allowPluginToggle: { type: Boolean, default: !0 },
|
|
476
|
+
allowToolToggle: { type: Boolean, default: !0 },
|
|
477
|
+
allowPluginDelete: { type: Boolean, default: !0 },
|
|
478
|
+
allowPluginAdd: { type: Boolean, default: !0 },
|
|
479
|
+
loading: { type: Boolean, default: !1 },
|
|
480
|
+
marketLoading: { type: Boolean, default: !1 }
|
|
481
|
+
}, {
|
|
482
|
+
visible: { type: Boolean, required: !0 },
|
|
483
|
+
visibleModifiers: {}
|
|
484
|
+
}),
|
|
485
|
+
emits: /* @__PURE__ */ X(["market-category-change", "tab-change", "plugin-toggle", "plugin-delete", "plugin-add", "plugin-create", "tool-toggle", "refresh", "update:activeCount", "update:visible"], ["update:visible"]),
|
|
486
|
+
setup(m, { emit: p }) {
|
|
487
|
+
const t = m, r = p, c = D(t.defaultActiveTab), b = D(""), v = D(""), T = D(""), V = y(
|
|
488
|
+
() => c.value === "installed" ? t.searchPlaceholder : "搜索市场插件"
|
|
489
|
+
), a = y(() => t.installedPlugins), h = y(() => t.marketPlugins), R = y(() => !a.value || a.value.length === 0 ? 0 : a.value.filter((l) => l.enabled).length);
|
|
490
|
+
Q(
|
|
491
|
+
R,
|
|
492
|
+
(l) => {
|
|
493
|
+
r("update:activeCount", l);
|
|
494
|
+
},
|
|
495
|
+
{ immediate: !0 }
|
|
496
|
+
), Q(c, (l, n) => {
|
|
497
|
+
l !== n && r("tab-change", l);
|
|
498
|
+
});
|
|
499
|
+
const _ = y(() => a.value.filter((l) => t.installedSearchFn(b.value, l))), P = y(() => {
|
|
500
|
+
const { category: l, search: n } = {
|
|
501
|
+
category: T.value,
|
|
502
|
+
search: v.value
|
|
503
|
+
}, f = (o) => {
|
|
504
|
+
const $ = !l || o.category === l, B = !n || t.marketSearchFn(n, o);
|
|
505
|
+
return $ && B;
|
|
506
|
+
};
|
|
507
|
+
return h.value.filter(f);
|
|
508
|
+
}), N = y(() => c.value === "installed" ? _.value.length > 0 : P.value.length > 0);
|
|
509
|
+
Q(T, (l) => {
|
|
510
|
+
r("market-category-change", l);
|
|
511
|
+
});
|
|
512
|
+
const z = (l, n) => {
|
|
513
|
+
var f;
|
|
514
|
+
t.allowPluginToggle && (r("plugin-toggle", l, n), (f = l.tools) != null && f.length && (n ? l.tools.filter(($) => $.enabled).length === 0 && l.tools.forEach(($) => {
|
|
515
|
+
r("tool-toggle", l, $.id, !0);
|
|
516
|
+
}) : l.tools.forEach((o) => {
|
|
517
|
+
o.enabled && r("tool-toggle", l, o.id, !1);
|
|
518
|
+
})));
|
|
519
|
+
}, i = (l, n, f) => {
|
|
520
|
+
var o;
|
|
521
|
+
if (t.allowToolToggle && (r("tool-toggle", l, n, f), (o = l.tools) != null && o.length)) {
|
|
522
|
+
const $ = l.tools.filter((L) => L.id !== n).some((L) => L.enabled), B = f || $;
|
|
523
|
+
l.enabled !== B && r("plugin-toggle", l, B);
|
|
524
|
+
}
|
|
525
|
+
}, C = (l) => {
|
|
526
|
+
t.allowPluginDelete && (oe.message({
|
|
527
|
+
message: `${l.name} 已移除`,
|
|
528
|
+
status: "success"
|
|
529
|
+
}), r("plugin-delete", l));
|
|
530
|
+
}, w = (l, n) => {
|
|
531
|
+
t.allowPluginAdd && (n && oe.message({
|
|
532
|
+
message: `${l.name} 已添加`,
|
|
533
|
+
status: "success"
|
|
534
|
+
}), r("plugin-add", l, n));
|
|
535
|
+
}, A = D(!1), q = () => {
|
|
536
|
+
A.value = !0;
|
|
537
|
+
}, W = (l, n) => {
|
|
538
|
+
r("plugin-create", l, n), A.value = !1;
|
|
539
|
+
}, ue = G(m, "visible"), ce = () => {
|
|
540
|
+
r("update:visible", !1);
|
|
541
|
+
}, pe = y(() => {
|
|
542
|
+
const { type: l, position: n, drawer: f } = t.popupConfig || {}, o = {
|
|
543
|
+
"z-index": "1000",
|
|
544
|
+
position: "fixed"
|
|
545
|
+
};
|
|
546
|
+
return l === "fixed" ? {
|
|
547
|
+
...o,
|
|
548
|
+
...me(n)
|
|
549
|
+
} : l === "drawer" ? {
|
|
550
|
+
...o,
|
|
551
|
+
..._e(f)
|
|
552
|
+
} : o;
|
|
553
|
+
}), me = (l = {}) => {
|
|
554
|
+
const n = {};
|
|
555
|
+
return Object.entries(l).forEach(([f, o]) => {
|
|
556
|
+
o !== void 0 && (n[f] = typeof o == "number" ? `${o}px` : o);
|
|
557
|
+
}), Object.keys(n).length === 0 ? {
|
|
558
|
+
top: "50%",
|
|
559
|
+
left: "50%",
|
|
560
|
+
transform: "translate(-50%, -50%)"
|
|
561
|
+
} : n;
|
|
562
|
+
}, _e = (l = { direction: "right" }) => {
|
|
563
|
+
const { direction: n } = l, f = {
|
|
564
|
+
top: "0",
|
|
565
|
+
bottom: "0",
|
|
566
|
+
height: "100%"
|
|
567
|
+
};
|
|
568
|
+
return n === "left" ? {
|
|
569
|
+
...f,
|
|
570
|
+
left: "0",
|
|
571
|
+
"border-right": "1px solid rgb(219, 219, 219)"
|
|
572
|
+
} : {
|
|
573
|
+
...f,
|
|
574
|
+
right: "0",
|
|
575
|
+
"border-left": "1px solid rgb(219, 219, 219)"
|
|
576
|
+
};
|
|
577
|
+
}, Z = y(() => {
|
|
578
|
+
const { type: l, drawer: n } = t.popupConfig || {};
|
|
579
|
+
return l !== "drawer" ? "" : `drawer-${(n == null ? void 0 : n.direction) || "right"}`;
|
|
580
|
+
}), ge = y(() => {
|
|
581
|
+
const { type: l } = t.popupConfig || {};
|
|
582
|
+
return l === "drawer" ? Z.value : "fade";
|
|
583
|
+
});
|
|
584
|
+
return (l, n) => (s(), x(Y, { name: ge.value }, {
|
|
585
|
+
default: S(() => {
|
|
586
|
+
var f;
|
|
587
|
+
return [
|
|
588
|
+
ue.value ? (s(), d("div", {
|
|
589
|
+
key: 0,
|
|
590
|
+
class: K(["mcp-server-picker", [`popup-type-${((f = t.popupConfig) == null ? void 0 : f.type) || "fixed"}`, Z.value]]),
|
|
591
|
+
style: he(pe.value)
|
|
592
|
+
}, [
|
|
593
|
+
e("div", $t, [
|
|
594
|
+
e("div", xt, U(t.title), 1),
|
|
595
|
+
e("div", wt, [
|
|
596
|
+
t.showCustomAddButton ? (s(), d("div", {
|
|
597
|
+
key: 0,
|
|
598
|
+
class: "mcp-server-picker__header-right-item",
|
|
599
|
+
onClick: q
|
|
600
|
+
}, [
|
|
601
|
+
g(u(Se), { style: { "font-size": "16px", cursor: "pointer" } }),
|
|
602
|
+
e("span", null, U(t.customAddButtonText), 1)
|
|
603
|
+
])) : k("", !0),
|
|
604
|
+
g(u(de), {
|
|
605
|
+
class: "mcp-server-picker__header-right-close",
|
|
606
|
+
onClick: ce
|
|
607
|
+
})
|
|
608
|
+
])
|
|
609
|
+
]),
|
|
610
|
+
e("div", St, [
|
|
611
|
+
g(u(be), {
|
|
612
|
+
modelValue: c.value,
|
|
613
|
+
"onUpdate:modelValue": n[3] || (n[3] = (o) => c.value = o)
|
|
614
|
+
}, {
|
|
615
|
+
default: S(() => [
|
|
616
|
+
t.showInstalledTab ? (s(), x(u(te), {
|
|
617
|
+
key: 0,
|
|
618
|
+
title: t.installedTabTitle,
|
|
619
|
+
name: "installed"
|
|
620
|
+
}, {
|
|
621
|
+
default: S(() => [
|
|
622
|
+
e("div", Dt, [
|
|
623
|
+
t.enableSearch ? (s(), d("div", Vt, [
|
|
624
|
+
g(u(le), {
|
|
625
|
+
modelValue: b.value,
|
|
626
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => b.value = o),
|
|
627
|
+
placeholder: t.searchPlaceholder
|
|
628
|
+
}, {
|
|
629
|
+
suffix: S(() => [
|
|
630
|
+
g(u(ae), { style: { "font-size": "16px", cursor: "pointer" } })
|
|
631
|
+
]),
|
|
632
|
+
_: 1
|
|
633
|
+
}, 8, ["modelValue", "placeholder"])
|
|
634
|
+
])) : k("", !0),
|
|
635
|
+
N.value ? (s(), d("div", Ut, [
|
|
636
|
+
t.loading ? (s(), d("div", Bt, "加载中...")) : (s(!0), d(I, { key: 1 }, H(_.value, (o) => {
|
|
637
|
+
var $;
|
|
638
|
+
return s(), x(u(se), {
|
|
639
|
+
key: o.id,
|
|
640
|
+
plugin: o,
|
|
641
|
+
mode: "installed",
|
|
642
|
+
expandable: !!(($ = o.tools) != null && $.length),
|
|
643
|
+
onTogglePlugin: (B) => z(o, B),
|
|
644
|
+
onToggleTool: (B, L) => i(o, B, L),
|
|
645
|
+
onDeletePlugin: () => C(o)
|
|
646
|
+
}, null, 8, ["plugin", "expandable", "onTogglePlugin", "onToggleTool", "onDeletePlugin"]);
|
|
647
|
+
}), 128))
|
|
648
|
+
])) : (s(), x(u(ie), {
|
|
649
|
+
key: 2,
|
|
650
|
+
"search-query": b.value
|
|
651
|
+
}, null, 8, ["search-query"]))
|
|
652
|
+
])
|
|
653
|
+
]),
|
|
654
|
+
_: 1
|
|
655
|
+
}, 8, ["title"])) : k("", !0),
|
|
656
|
+
t.showMarketTab ? (s(), x(u(te), {
|
|
657
|
+
key: 1,
|
|
658
|
+
title: t.marketTabTitle,
|
|
659
|
+
name: "market"
|
|
660
|
+
}, {
|
|
661
|
+
default: S(() => [
|
|
662
|
+
t.enableSearch || t.enableMarketCategoryFilter ? (s(), d("div", At, [
|
|
663
|
+
t.enableMarketCategoryFilter ? (s(), d("div", Ft, [
|
|
664
|
+
g(u(Te), {
|
|
665
|
+
modelValue: T.value,
|
|
666
|
+
"onUpdate:modelValue": n[1] || (n[1] = (o) => T.value = o),
|
|
667
|
+
placeholder: t.marketCategoryPlaceholder
|
|
668
|
+
}, {
|
|
669
|
+
default: S(() => [
|
|
670
|
+
(s(!0), d(I, null, H(t.marketCategoryOptions, (o) => (s(), x(u(Ce), {
|
|
671
|
+
key: o.value,
|
|
672
|
+
label: o.label,
|
|
673
|
+
value: o.value
|
|
674
|
+
}, {
|
|
675
|
+
default: S(() => [
|
|
676
|
+
ye(U(o.label), 1)
|
|
677
|
+
]),
|
|
678
|
+
_: 2
|
|
679
|
+
}, 1032, ["label", "value"]))), 128))
|
|
680
|
+
]),
|
|
681
|
+
_: 1
|
|
682
|
+
}, 8, ["modelValue", "placeholder"])
|
|
683
|
+
])) : k("", !0),
|
|
684
|
+
t.enableSearch ? (s(), d("div", It, [
|
|
685
|
+
g(u(le), {
|
|
686
|
+
modelValue: v.value,
|
|
687
|
+
"onUpdate:modelValue": n[2] || (n[2] = (o) => v.value = o),
|
|
688
|
+
placeholder: V.value
|
|
689
|
+
}, {
|
|
690
|
+
suffix: S(() => [
|
|
691
|
+
g(u(ae), { style: { "font-size": "16px", cursor: "pointer" } })
|
|
692
|
+
]),
|
|
693
|
+
_: 1
|
|
694
|
+
}, 8, ["modelValue", "placeholder"])
|
|
695
|
+
])) : k("", !0)
|
|
696
|
+
])) : k("", !0),
|
|
697
|
+
N.value ? (s(), d("div", Mt, [
|
|
698
|
+
t.marketLoading ? (s(), d("div", Et, "加载中...")) : (s(!0), d(I, { key: 1 }, H(P.value, (o) => (s(), x(u(se), {
|
|
699
|
+
key: o.id,
|
|
700
|
+
plugin: o,
|
|
701
|
+
mode: "market",
|
|
702
|
+
expandable: !1,
|
|
703
|
+
"show-tool-count": !1,
|
|
704
|
+
onAddPlugin: ($) => w(o, $)
|
|
705
|
+
}, null, 8, ["plugin", "onAddPlugin"]))), 128))
|
|
706
|
+
])) : (s(), x(u(ie), {
|
|
707
|
+
key: 2,
|
|
708
|
+
"search-query": v.value || T.value
|
|
709
|
+
}, null, 8, ["search-query"]))
|
|
710
|
+
]),
|
|
711
|
+
_: 1
|
|
712
|
+
}, 8, ["title"])) : k("", !0)
|
|
713
|
+
]),
|
|
714
|
+
_: 1
|
|
715
|
+
}, 8, ["modelValue"])
|
|
716
|
+
]),
|
|
717
|
+
g(u(kt), {
|
|
718
|
+
visible: A.value,
|
|
719
|
+
"onUpdate:visible": n[4] || (n[4] = (o) => A.value = o),
|
|
720
|
+
onConfirm: W
|
|
721
|
+
}, null, 8, ["visible"])
|
|
722
|
+
], 6)) : k("", !0)
|
|
723
|
+
];
|
|
724
|
+
}),
|
|
725
|
+
_: 1
|
|
726
|
+
}, 8, ["name"]));
|
|
727
|
+
}
|
|
728
|
+
}), J = /* @__PURE__ */ E(Lt, [["__scopeId", "data-v-3db8e1e1"]]);
|
|
729
|
+
J.name = "McpServerPicker";
|
|
730
|
+
const Ot = function(m) {
|
|
731
|
+
m.component(J.name, J);
|
|
732
|
+
};
|
|
733
|
+
J.install = Ot;
|
|
734
|
+
export {
|
|
735
|
+
J as default
|
|
736
|
+
};
|