@opentiny/tiny-robot 0.3.1-alpha.8 → 0.3.1-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/base-popper/index.js +1 -1
- package/dist/bubble/index.js +4017 -11
- package/dist/chat-input/index.js +3154 -0
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/history/index.js +1 -1
- package/dist/index.d.ts +684 -968
- package/dist/index.js +104 -108
- package/dist/index2.js +90 -90
- package/dist/index3.js +150 -155
- package/dist/index4.js +295 -319
- package/dist/index5.js +279 -507
- package/dist/index6.js +146 -286
- package/dist/loading.js +4 -0
- package/dist/mcp-server-picker/index.js +57 -58
- package/dist/sender/index.js +6 -3261
- package/dist/sender-compat/index.js +109 -105
- package/dist/style.css +1 -1
- package/dist/suggestion-popover/index.js +185 -184
- package/package.json +17 -17
- package/dist/index7.js +0 -161
- /package/dist/{sender-actions → chat-input-actions}/index.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as H, computed as
|
|
2
|
-
import
|
|
3
|
-
import { _ as z, V as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as H, computed as h, ref as I, openBlock as g, createBlock as b, unref as S, createSlots as J, withCtx as r, renderSlot as i, normalizeProps as v, mergeProps as y, createCommentVNode as d, guardReactiveProps as V } from "vue";
|
|
2
|
+
import $ from "../chat-input/index.js";
|
|
3
|
+
import { _ as z, V as R } from "../index3.js";
|
|
4
|
+
const k = /* @__PURE__ */ H({
|
|
5
5
|
__name: "index",
|
|
6
6
|
props: {
|
|
7
7
|
autofocus: { type: Boolean },
|
|
@@ -28,119 +28,125 @@ const w = /* @__PURE__ */ H({
|
|
|
28
28
|
stopText: {}
|
|
29
29
|
},
|
|
30
30
|
emits: ["update:modelValue", "update:templateData", "submit", "clear", "speech-start", "speech-end", "speech-interim", "speech-error", "suggestion-select", "focus", "blur", "escape-press", "cancel", "reset-template", "files-selected"],
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
get: () =>
|
|
31
|
+
setup(o, { expose: W, emit: L }) {
|
|
32
|
+
const l = o, s = L, w = h({
|
|
33
|
+
get: () => l.modelValue ?? "",
|
|
34
34
|
set: (e) => {
|
|
35
|
-
|
|
35
|
+
s("update:modelValue", e);
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
37
|
+
}), P = h(() => l.defaultValue), c = I(), B = I(), j = h(() => {
|
|
38
38
|
var n;
|
|
39
39
|
const e = [];
|
|
40
|
-
if ((n =
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
items:
|
|
45
|
-
popupWidth:
|
|
46
|
-
activeSuggestionKeys:
|
|
40
|
+
if ((n = l.suggestions) != null && n.length) {
|
|
41
|
+
const a = $.Suggestion;
|
|
42
|
+
a && e.push(
|
|
43
|
+
a.configure({
|
|
44
|
+
items: l.suggestions,
|
|
45
|
+
popupWidth: l.suggestionPopupWidth,
|
|
46
|
+
activeSuggestionKeys: l.activeSuggestionKeys,
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
-
onSelect: (
|
|
49
|
-
|
|
48
|
+
onSelect: (u) => {
|
|
49
|
+
s("suggestion-select", u.content);
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
}),
|
|
57
|
-
var
|
|
54
|
+
const t = $.Template;
|
|
55
|
+
return t && e.push(t.configure({})), e;
|
|
56
|
+
}), D = h(() => {
|
|
57
|
+
var t, n;
|
|
58
58
|
const e = {};
|
|
59
|
-
return (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
return (t = l.buttonGroup) != null && t.submit && (e.submit = l.buttonGroup.submit), (n = l.buttonGroup) != null && n.file && (e.clear = {
|
|
60
|
+
disabled: l.buttonGroup.file.disabled,
|
|
61
|
+
tooltip: l.buttonGroup.file.disabled ? "无法清空" : "清空输入"
|
|
62
|
+
}), Object.keys(e).length > 0 ? e : void 0;
|
|
63
|
+
}), G = h(() => {
|
|
64
|
+
if (typeof l.speech != "boolean")
|
|
65
|
+
return l.speech;
|
|
63
66
|
}), K = (e) => {
|
|
64
|
-
var
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
+
var a;
|
|
68
|
+
const t = (a = c.value) == null ? void 0 : a.editor;
|
|
69
|
+
if (!t) {
|
|
67
70
|
console.warn("[sender-compat] Editor not ready, cannot set template data");
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
73
|
if (!e || e.length === 0) {
|
|
71
|
-
|
|
74
|
+
t.commands.clearContent();
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
74
77
|
const n = e.map(
|
|
75
|
-
(
|
|
78
|
+
(u) => u.type === "template" ? { ...u, type: "block" } : u
|
|
76
79
|
);
|
|
77
|
-
|
|
80
|
+
t.commands.setTemplateData(n), t.commands.focusFirstTemplate();
|
|
78
81
|
}, O = (e) => {
|
|
79
|
-
|
|
82
|
+
s("submit", e);
|
|
80
83
|
}, A = () => {
|
|
81
|
-
|
|
84
|
+
s("clear");
|
|
82
85
|
}, N = () => {
|
|
83
|
-
|
|
86
|
+
s("cancel");
|
|
84
87
|
}, U = (e) => {
|
|
85
|
-
|
|
88
|
+
s("focus", e);
|
|
86
89
|
}, q = (e) => {
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
|
|
90
|
+
s("blur", e);
|
|
91
|
+
}, C = (e) => {
|
|
92
|
+
s("files-selected", e);
|
|
93
|
+
}, T = () => {
|
|
94
|
+
s("speech-start");
|
|
92
95
|
}, x = (e) => {
|
|
93
|
-
|
|
96
|
+
s("speech-end", e);
|
|
94
97
|
}, E = (e) => {
|
|
95
|
-
|
|
98
|
+
s("speech-interim", e);
|
|
96
99
|
}, F = (e) => {
|
|
97
|
-
|
|
100
|
+
s("speech-error", e);
|
|
98
101
|
};
|
|
99
|
-
return
|
|
102
|
+
return W({
|
|
100
103
|
focus: () => {
|
|
101
|
-
var e,
|
|
102
|
-
(
|
|
104
|
+
var e, t;
|
|
105
|
+
(t = (e = c.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
103
106
|
},
|
|
104
107
|
blur: () => {
|
|
105
|
-
var e,
|
|
106
|
-
(
|
|
108
|
+
var e, t;
|
|
109
|
+
(t = (e = c.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
107
110
|
},
|
|
108
111
|
clear: () => {
|
|
109
|
-
var e,
|
|
110
|
-
(
|
|
112
|
+
var e, t;
|
|
113
|
+
(t = (e = c.value) == null ? void 0 : e.clear) == null || t.call(e);
|
|
111
114
|
},
|
|
112
115
|
submit: () => {
|
|
113
|
-
var e,
|
|
114
|
-
(
|
|
116
|
+
var e, t;
|
|
117
|
+
(t = (e = c.value) == null ? void 0 : e.submit) == null || t.call(e);
|
|
115
118
|
},
|
|
116
119
|
setTemplateData: K,
|
|
117
120
|
startSpeech: () => {
|
|
118
121
|
var e;
|
|
119
|
-
(e =
|
|
122
|
+
(e = B.value) == null || e.start();
|
|
120
123
|
},
|
|
121
124
|
stopSpeech: () => {
|
|
122
125
|
var e;
|
|
123
|
-
(e =
|
|
126
|
+
(e = B.value) == null || e.stop();
|
|
124
127
|
}
|
|
125
|
-
}), (e,
|
|
126
|
-
ref_key: "
|
|
127
|
-
ref:
|
|
128
|
-
modelValue:
|
|
129
|
-
"onUpdate:modelValue":
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
}), (e, t) => (g(), b(S($), {
|
|
129
|
+
ref_key: "chatInputRef",
|
|
130
|
+
ref: c,
|
|
131
|
+
modelValue: w.value,
|
|
132
|
+
"onUpdate:modelValue": [
|
|
133
|
+
t[0] || (t[0] = (n) => w.value = n),
|
|
134
|
+
t[1] || (t[1] = (n) => w.value = n)
|
|
135
|
+
],
|
|
136
|
+
"default-value": P.value,
|
|
137
|
+
mode: o.mode,
|
|
138
|
+
placeholder: o.placeholder,
|
|
139
|
+
disabled: o.disabled,
|
|
140
|
+
loading: o.loading,
|
|
141
|
+
"submit-type": o.submitType,
|
|
142
|
+
"max-length": o.maxLength,
|
|
143
|
+
"show-word-limit": o.showWordLimit,
|
|
144
|
+
"auto-size": o.autoSize,
|
|
145
|
+
clearable: o.clearable,
|
|
146
|
+
autofocus: o.autofocus,
|
|
147
|
+
extensions: j.value,
|
|
148
|
+
"default-actions": D.value,
|
|
149
|
+
"stop-text": o.stopText,
|
|
144
150
|
onSubmit: O,
|
|
145
151
|
onClear: A,
|
|
146
152
|
onCancel: N,
|
|
@@ -148,45 +154,43 @@ const w = /* @__PURE__ */ H({
|
|
|
148
154
|
onBlur: q
|
|
149
155
|
}, J({
|
|
150
156
|
"actions-inline": r((n) => {
|
|
151
|
-
var
|
|
157
|
+
var a, u, p, m, f;
|
|
152
158
|
return [
|
|
153
|
-
|
|
154
|
-
...(
|
|
155
|
-
tooltip: (
|
|
156
|
-
}, { onSelect:
|
|
157
|
-
|
|
159
|
+
o.allowFiles ? (g(), b(S(z), y({ key: 0 }, {
|
|
160
|
+
...(a = o.buttonGroup) == null ? void 0 : a.file,
|
|
161
|
+
tooltip: (p = (u = o.buttonGroup) == null ? void 0 : u.file) == null ? void 0 : p.tooltips
|
|
162
|
+
}, { onSelect: C }), null, 16)) : d("", !0),
|
|
163
|
+
o.allowSpeech ? (g(), b(S(R), {
|
|
158
164
|
key: 1,
|
|
159
165
|
ref_key: "voiceRef",
|
|
160
|
-
ref:
|
|
161
|
-
"speech-config":
|
|
162
|
-
icon: (
|
|
163
|
-
onSpeechStart:
|
|
166
|
+
ref: B,
|
|
167
|
+
"speech-config": G.value,
|
|
168
|
+
icon: (f = (m = o.buttonGroup) == null ? void 0 : m.voice) == null ? void 0 : f.icon,
|
|
169
|
+
onSpeechStart: T,
|
|
164
170
|
onSpeechEnd: x,
|
|
165
171
|
onSpeechInterim: E,
|
|
166
172
|
onSpeechError: F
|
|
167
173
|
}, null, 8, ["speech-config", "icon"])) : d("", !0),
|
|
168
|
-
e.$slots.actions ? i(e.$slots, "actions", y(
|
|
174
|
+
e.$slots.actions ? i(e.$slots, "actions", v(y({ key: 2 }, n))) : d("", !0)
|
|
169
175
|
];
|
|
170
176
|
}),
|
|
171
177
|
footer: r((n) => [
|
|
172
|
-
i(e.$slots, "footer-left",
|
|
173
|
-
i(e.$slots, "footer",
|
|
178
|
+
i(e.$slots, "footer-left", v(V(n))),
|
|
179
|
+
i(e.$slots, "footer", v(V(n)))
|
|
174
180
|
]),
|
|
175
181
|
"footer-right": r((n) => {
|
|
176
|
-
var
|
|
182
|
+
var a, u, p, m, f;
|
|
177
183
|
return [
|
|
178
|
-
e.$slots["footer-right"] ? i(e.$slots, "footer-right", y(
|
|
179
|
-
|
|
180
|
-
...(
|
|
181
|
-
tooltip: (
|
|
182
|
-
}, { onSelect:
|
|
183
|
-
|
|
184
|
+
e.$slots["footer-right"] ? i(e.$slots, "footer-right", v(y({ key: 0 }, n))) : d("", !0),
|
|
185
|
+
o.allowFiles ? (g(), b(S(z), y({ key: 1 }, {
|
|
186
|
+
...(a = o.buttonGroup) == null ? void 0 : a.file,
|
|
187
|
+
tooltip: (p = (u = o.buttonGroup) == null ? void 0 : u.file) == null ? void 0 : p.tooltips
|
|
188
|
+
}, { onSelect: C }), null, 16)) : d("", !0),
|
|
189
|
+
o.allowSpeech ? (g(), b(S(R), {
|
|
184
190
|
key: 2,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
icon: (h = (f = t.buttonGroup) == null ? void 0 : f.voice) == null ? void 0 : h.icon,
|
|
189
|
-
onSpeechStart: G,
|
|
191
|
+
"speech-config": G.value,
|
|
192
|
+
icon: (f = (m = o.buttonGroup) == null ? void 0 : m.voice) == null ? void 0 : f.icon,
|
|
193
|
+
onSpeechStart: T,
|
|
190
194
|
onSpeechEnd: x,
|
|
191
195
|
onSpeechInterim: E,
|
|
192
196
|
onSpeechError: F
|
|
@@ -212,18 +216,18 @@ const w = /* @__PURE__ */ H({
|
|
|
212
216
|
e.$slots.content ? {
|
|
213
217
|
name: "content",
|
|
214
218
|
fn: r((n) => [
|
|
215
|
-
i(e.$slots, "content",
|
|
219
|
+
i(e.$slots, "content", v(V(n)))
|
|
216
220
|
]),
|
|
217
221
|
key: "2"
|
|
218
222
|
} : void 0
|
|
219
223
|
]), 1032, ["modelValue", "default-value", "mode", "placeholder", "disabled", "loading", "submit-type", "max-length", "show-word-limit", "auto-size", "clearable", "autofocus", "extensions", "default-actions", "stop-text"]));
|
|
220
224
|
}
|
|
221
225
|
});
|
|
222
|
-
|
|
223
|
-
const M = function(
|
|
224
|
-
|
|
226
|
+
k.name = "TrSenderCompat";
|
|
227
|
+
const M = function(o) {
|
|
228
|
+
o.component(k.name, k);
|
|
225
229
|
};
|
|
226
|
-
|
|
230
|
+
k.install = M;
|
|
227
231
|
export {
|
|
228
|
-
|
|
232
|
+
k as default
|
|
229
233
|
};
|