@opentiny/tiny-robot 0.3.0-alpha.20 → 0.3.0-alpha.21
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/bubble/index.js +7 -7
- package/dist/index.d.ts +92 -46
- package/dist/index.js +35 -31
- package/dist/mcp-add-form/index.js +212 -0
- package/dist/mcp-server-picker/index.js +312 -495
- package/dist/sender/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/theme-provider/index.js +37 -36
- package/package.json +3 -3
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { defineComponent as g, ref as b, useModel as k, watch as O, onUnmounted as R, createElementBlock as f, openBlock as v, createElementVNode as t, withDirectives as p, vModelText as _, createVNode as y, unref as D, createCommentVNode as $ } from "vue";
|
|
2
|
+
import { TinyRadioGroup as E } from "@opentiny/vue";
|
|
3
|
+
import { d as L } from "../index2.js";
|
|
4
|
+
import { _ as T } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
const M = { class: "form-editor__container" }, S = { class: "form-editor__item" }, F = { class: "form-editor__item" }, I = { class: "form-editor__item" }, N = { class: "form-editor__item" }, H = { class: "form-editor__item" }, w = { class: "form-editor__item" }, A = ["src"], C = "https://res.hc-cdn.com/tinyui-design/1.1.0.20250526191525/home/images/tiny-ng.svg", P = /* @__PURE__ */ g({
|
|
6
|
+
__name: "FormEditor",
|
|
7
|
+
props: {
|
|
8
|
+
formData: { required: !0 },
|
|
9
|
+
formDataModifiers: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:formData"],
|
|
12
|
+
setup(i) {
|
|
13
|
+
const d = b(""), o = k(i, "formData"), s = [
|
|
14
|
+
{ label: "streamableHttp", text: "流式HTTP(Streamable HTTP)" },
|
|
15
|
+
{ label: "sse", text: "服务器发送事件(SSE)" }
|
|
16
|
+
], { open: n, files: u } = L({
|
|
17
|
+
accept: "image/*",
|
|
18
|
+
// 只接受图片文件
|
|
19
|
+
multiple: !1
|
|
20
|
+
// 只允许选择单个文件
|
|
21
|
+
}), r = () => {
|
|
22
|
+
d.value && d.value !== C && (URL.revokeObjectURL(d.value), d.value = "");
|
|
23
|
+
};
|
|
24
|
+
O(u, (m) => {
|
|
25
|
+
if (m && m.length > 0) {
|
|
26
|
+
const e = m[0];
|
|
27
|
+
if (!e.type.startsWith("image/"))
|
|
28
|
+
return;
|
|
29
|
+
const a = 5 * 1024 * 1024;
|
|
30
|
+
if (e.size > a)
|
|
31
|
+
return;
|
|
32
|
+
r(), d.value = URL.createObjectURL(e), o.value.thumbnail = e;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const x = () => {
|
|
36
|
+
n();
|
|
37
|
+
};
|
|
38
|
+
return R(() => {
|
|
39
|
+
r();
|
|
40
|
+
}), (m, e) => (v(), f("form", M, [
|
|
41
|
+
t("div", S, [
|
|
42
|
+
e[5] || (e[5] = t("label", { class: "form-editor__label" }, "名称", -1)),
|
|
43
|
+
p(t("input", {
|
|
44
|
+
"onUpdate:modelValue": e[0] || (e[0] = (a) => o.value.name = a),
|
|
45
|
+
class: "form-editor__input",
|
|
46
|
+
type: "text",
|
|
47
|
+
placeholder: "请输入插件名称"
|
|
48
|
+
}, null, 512), [
|
|
49
|
+
[_, o.value.name]
|
|
50
|
+
])
|
|
51
|
+
]),
|
|
52
|
+
t("div", F, [
|
|
53
|
+
e[6] || (e[6] = t("label", { class: "form-editor__label" }, "描述", -1)),
|
|
54
|
+
p(t("textarea", {
|
|
55
|
+
"onUpdate:modelValue": e[1] || (e[1] = (a) => o.value.description = a),
|
|
56
|
+
class: "form-editor__textarea",
|
|
57
|
+
placeholder: "请输入插件描述"
|
|
58
|
+
}, null, 512), [
|
|
59
|
+
[_, o.value.description]
|
|
60
|
+
])
|
|
61
|
+
]),
|
|
62
|
+
t("div", I, [
|
|
63
|
+
e[7] || (e[7] = t("label", { class: "form-editor__label custom-label" }, "类型", -1)),
|
|
64
|
+
y(D(E), {
|
|
65
|
+
modelValue: o.value.type,
|
|
66
|
+
"onUpdate:modelValue": e[2] || (e[2] = (a) => o.value.type = a),
|
|
67
|
+
options: s,
|
|
68
|
+
class: "form-editor__radio-group"
|
|
69
|
+
}, null, 8, ["modelValue"])
|
|
70
|
+
]),
|
|
71
|
+
t("div", N, [
|
|
72
|
+
e[8] || (e[8] = t("label", { class: "form-editor__label" }, "URL", -1)),
|
|
73
|
+
p(t("input", {
|
|
74
|
+
"onUpdate:modelValue": e[3] || (e[3] = (a) => o.value.url = a),
|
|
75
|
+
class: "form-editor__input",
|
|
76
|
+
type: "url",
|
|
77
|
+
placeholder: "请输入插件URL"
|
|
78
|
+
}, null, 512), [
|
|
79
|
+
[_, o.value.url]
|
|
80
|
+
])
|
|
81
|
+
]),
|
|
82
|
+
t("div", H, [
|
|
83
|
+
e[9] || (e[9] = t("label", { class: "form-editor__label" }, "请求头", -1)),
|
|
84
|
+
p(t("textarea", {
|
|
85
|
+
"onUpdate:modelValue": e[4] || (e[4] = (a) => o.value.headers = a),
|
|
86
|
+
class: "form-editor__textarea",
|
|
87
|
+
placeholder: "请输入请求头,格式为JSON"
|
|
88
|
+
}, null, 512), [
|
|
89
|
+
[_, o.value.headers]
|
|
90
|
+
])
|
|
91
|
+
]),
|
|
92
|
+
t("div", w, [
|
|
93
|
+
e[11] || (e[11] = t("label", { class: "form-editor__label custom-label" }, "缩略图", -1)),
|
|
94
|
+
t("div", {
|
|
95
|
+
class: "form-editor__file-upload",
|
|
96
|
+
onClick: x
|
|
97
|
+
}, [
|
|
98
|
+
t("img", {
|
|
99
|
+
src: d.value || C,
|
|
100
|
+
alt: "缩略图预览",
|
|
101
|
+
class: "form-editor__file-preview-image"
|
|
102
|
+
}, null, 8, A),
|
|
103
|
+
e[10] || (e[10] = t("div", { class: "form-editor__file-overlay" }, [
|
|
104
|
+
t("div", { class: "form-editor__file-icon" })
|
|
105
|
+
], -1))
|
|
106
|
+
])
|
|
107
|
+
])
|
|
108
|
+
]));
|
|
109
|
+
}
|
|
110
|
+
}), h = /* @__PURE__ */ T(P, [["__scopeId", "data-v-94f8726e"]]), j = { class: "code-editor__container" }, q = { class: "code-editor__section" }, z = { class: "code-editor__area" }, B = /* @__PURE__ */ g({
|
|
111
|
+
__name: "CodeEditor",
|
|
112
|
+
props: {
|
|
113
|
+
codeData: { required: !0 },
|
|
114
|
+
codeDataModifiers: {}
|
|
115
|
+
},
|
|
116
|
+
emits: ["update:codeData"],
|
|
117
|
+
setup(i) {
|
|
118
|
+
const d = k(i, "codeData");
|
|
119
|
+
return (o, s) => (v(), f("div", j, [
|
|
120
|
+
t("div", q, [
|
|
121
|
+
t("div", z, [
|
|
122
|
+
p(t("textarea", {
|
|
123
|
+
"onUpdate:modelValue": s[0] || (s[0] = (n) => d.value = n),
|
|
124
|
+
class: "code-editor__textarea",
|
|
125
|
+
placeholder: "请输入 JSON 配置..."
|
|
126
|
+
}, null, 512), [
|
|
127
|
+
[_, d.value]
|
|
128
|
+
])
|
|
129
|
+
])
|
|
130
|
+
])
|
|
131
|
+
]));
|
|
132
|
+
}
|
|
133
|
+
}), J = /* @__PURE__ */ T(B, [["__scopeId", "data-v-9907c109"]]), G = { class: "mcp-add-form" }, W = { class: "mcp-add-form__content" }, K = { class: "mcp-add-form__add-type" }, Q = { key: 0 }, X = { key: 1 }, Y = /* @__PURE__ */ g({
|
|
134
|
+
__name: "index",
|
|
135
|
+
props: {
|
|
136
|
+
addType: { default: "form" },
|
|
137
|
+
formData: {},
|
|
138
|
+
codeData: {}
|
|
139
|
+
},
|
|
140
|
+
emits: ["update:addType", "confirm", "cancel"],
|
|
141
|
+
setup(i, { emit: d }) {
|
|
142
|
+
const o = i, s = d, n = b(
|
|
143
|
+
o.formData || {
|
|
144
|
+
name: "",
|
|
145
|
+
description: "",
|
|
146
|
+
type: "streamableHttp",
|
|
147
|
+
url: "",
|
|
148
|
+
headers: "",
|
|
149
|
+
thumbnail: null
|
|
150
|
+
}
|
|
151
|
+
), u = b(o.codeData || ""), r = b(o.addType), x = [
|
|
152
|
+
{ label: "form", text: "表单添加" },
|
|
153
|
+
{ label: "code", text: "代码添加" }
|
|
154
|
+
], m = () => {
|
|
155
|
+
s("cancel");
|
|
156
|
+
}, e = () => {
|
|
157
|
+
r.value === "form" ? s("confirm", "form", n.value) : s("confirm", "code", u.value);
|
|
158
|
+
}, a = (V) => {
|
|
159
|
+
s("update:addType", V);
|
|
160
|
+
};
|
|
161
|
+
return (V, l) => (v(), f("div", G, [
|
|
162
|
+
t("div", W, [
|
|
163
|
+
t("div", K, [
|
|
164
|
+
l[3] || (l[3] = t("span", { class: "mcp-add-form__add-type-label" }, "添加方式", -1)),
|
|
165
|
+
y(D(E), {
|
|
166
|
+
modelValue: r.value,
|
|
167
|
+
"onUpdate:modelValue": [
|
|
168
|
+
l[0] || (l[0] = (c) => r.value = c),
|
|
169
|
+
a
|
|
170
|
+
],
|
|
171
|
+
type: "button",
|
|
172
|
+
options: x
|
|
173
|
+
}, null, 8, ["modelValue"])
|
|
174
|
+
]),
|
|
175
|
+
r.value === "form" ? (v(), f("div", Q, [
|
|
176
|
+
y(D(h), {
|
|
177
|
+
"form-data": n.value,
|
|
178
|
+
"onUpdate:formData": l[1] || (l[1] = (c) => n.value = c)
|
|
179
|
+
}, null, 8, ["form-data"])
|
|
180
|
+
])) : $("", !0),
|
|
181
|
+
r.value === "code" ? (v(), f("div", X, [
|
|
182
|
+
y(D(J), {
|
|
183
|
+
"code-data": u.value,
|
|
184
|
+
"onUpdate:codeData": l[2] || (l[2] = (c) => u.value = c)
|
|
185
|
+
}, null, 8, ["code-data"])
|
|
186
|
+
])) : $("", !0)
|
|
187
|
+
]),
|
|
188
|
+
t("div", { class: "mcp-add-form__footer" }, [
|
|
189
|
+
t("div", {
|
|
190
|
+
class: "button cancel",
|
|
191
|
+
onClick: m
|
|
192
|
+
}, [...l[4] || (l[4] = [
|
|
193
|
+
t("span", null, "取消", -1)
|
|
194
|
+
])]),
|
|
195
|
+
t("div", {
|
|
196
|
+
class: "button confirm",
|
|
197
|
+
onClick: e
|
|
198
|
+
}, [...l[5] || (l[5] = [
|
|
199
|
+
t("span", null, "确定", -1)
|
|
200
|
+
])])
|
|
201
|
+
])
|
|
202
|
+
]));
|
|
203
|
+
}
|
|
204
|
+
}), U = /* @__PURE__ */ T(Y, [["__scopeId", "data-v-c4bac4dc"]]);
|
|
205
|
+
U.name = "TrMcpAddForm";
|
|
206
|
+
const Z = function(i) {
|
|
207
|
+
i.component(U.name, U);
|
|
208
|
+
};
|
|
209
|
+
U.install = Z;
|
|
210
|
+
export {
|
|
211
|
+
U as default
|
|
212
|
+
};
|