@opentiny/tiny-robot 0.5.2-alpha.1 → 0.5.2-alpha.14
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/dropdown-menu/index.js +1 -1
- package/dist/extension-manager/index.js +473 -0
- package/dist/floating-ui.dom.js +970 -0
- package/dist/index.d.ts +623 -206
- package/dist/index.js +104 -93
- package/dist/index3.js +95 -92
- package/dist/index4.js +2 -2
- package/dist/index6.js +1 -1
- package/dist/index8.js +87 -102
- package/dist/layout/index.js +1 -1
- package/dist/model-selector/index.js +989 -0
- package/dist/sender/index.js +1213 -2132
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +1 -1
- package/dist/suggestion-popover/index.js +37 -36
- package/dist/useSlotRefs.js +1 -1
- package/dist/useTeleportTarget.js +25 -0
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/README.md +0 -192
- package/README.zh-CN.md +0 -192
package/dist/index.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { B
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
1
|
+
import x from "./attachments/index.js";
|
|
2
|
+
import { B, a as E, b as F } from "./index6.js";
|
|
3
|
+
import { c as je, d as He, u as $e, e as We, f as we, g as ke, h as Ne, i as Ve, j as Ge, k as Ie } from "./index6.js";
|
|
4
|
+
import b from "./container/index.js";
|
|
5
5
|
import C from "./anchor/index.js";
|
|
6
6
|
import z from "./conversations/index.js";
|
|
7
7
|
import y from "./drag-overlay/index.js";
|
|
8
8
|
import L from "./dropdown-menu/index.js";
|
|
9
9
|
import P from "./feedback/index.js";
|
|
10
10
|
import { H as A } from "./index7.js";
|
|
11
|
-
import { u as
|
|
12
|
-
import
|
|
13
|
-
import { Layout as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import w from "./sender
|
|
17
|
-
import k
|
|
18
|
-
import V from "./suggestion-
|
|
11
|
+
import { u as Ke } from "./index7.js";
|
|
12
|
+
import M from "./icon-button/index.js";
|
|
13
|
+
import { Layout as O, LayoutProxyScrollbar as R, LayoutAsideToggle as j } from "./layout/index.js";
|
|
14
|
+
import H from "./model-selector/index.js";
|
|
15
|
+
import { Prompt as $, Prompts as W } from "./prompts/index.js";
|
|
16
|
+
import w from "./sender/index.js";
|
|
17
|
+
import k from "./sender-compat/index.js";
|
|
18
|
+
import N, { SuggestionPillButton as V } from "./suggestion-pills/index.js";
|
|
19
|
+
import G from "./suggestion-popover/index.js";
|
|
19
20
|
import I from "./theme-provider/index.js";
|
|
20
|
-
import { useTheme as
|
|
21
|
+
import { useTheme as Ye } from "./theme-provider/index.js";
|
|
21
22
|
import U from "./welcome/index.js";
|
|
22
23
|
import K from "./mcp-server-picker/index.js";
|
|
23
24
|
import X from "./mcp-add-form/index.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
25
|
+
import { ExtensionCard as Y, ExtensionCardGrid as q } from "./extension-manager/index.js";
|
|
26
|
+
import { u as Je } from "./useSenderContentRegistration.js";
|
|
27
|
+
import { A as J, S as Q, _ as Z, W as ee, D as re } from "./index2.js";
|
|
28
|
+
import { a as Ze, u as er } from "./index2.js";
|
|
29
|
+
import { _ as oe, V as te } from "./index3.js";
|
|
28
30
|
var u = /* @__PURE__ */ ((e) => (e.FileTypeNotAllowed = "file-type-not-allowed", e.FileSizeExceeded = "file-size-exceeded", e.FileCountExceeded = "file-count-exceeded", e))(u || {});
|
|
29
|
-
function
|
|
31
|
+
function ae(e, r) {
|
|
30
32
|
if (!r) return !0;
|
|
31
33
|
const t = r.split(",").map((o) => o.trim());
|
|
32
34
|
return t.includes("*") ? !0 : t.some((o) => {
|
|
@@ -42,12 +44,12 @@ function re(e, r) {
|
|
|
42
44
|
function v(e, r) {
|
|
43
45
|
return e.size <= r;
|
|
44
46
|
}
|
|
45
|
-
function
|
|
47
|
+
function ne(e, r) {
|
|
46
48
|
return e.length <= r;
|
|
47
49
|
}
|
|
48
|
-
function
|
|
50
|
+
function se(e, r) {
|
|
49
51
|
const { accept: t, multiple: o, maxSize: n, maxFiles: l } = r, a = [], s = [];
|
|
50
|
-
if (!
|
|
52
|
+
if (!ne(e, l))
|
|
51
53
|
return {
|
|
52
54
|
acceptedFiles: a,
|
|
53
55
|
rejectedFiles: Array.from(e),
|
|
@@ -57,7 +59,7 @@ function te(e, r) {
|
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
if (e.forEach((i) => {
|
|
60
|
-
|
|
62
|
+
ae(i, t) && v(i, n) ? a.push(i) : s.push(i);
|
|
61
63
|
}), !o && a.length > 1)
|
|
62
64
|
return {
|
|
63
65
|
acceptedFiles: [],
|
|
@@ -88,7 +90,7 @@ function T(e) {
|
|
|
88
90
|
disabled: e.disabled || !1
|
|
89
91
|
};
|
|
90
92
|
}
|
|
91
|
-
const
|
|
93
|
+
const Ae = {
|
|
92
94
|
/**
|
|
93
95
|
* 挂载指令
|
|
94
96
|
* @param el 元素
|
|
@@ -128,13 +130,13 @@ const Ce = {
|
|
|
128
130
|
a.preventDefault(), t = 0, n(!1, null);
|
|
129
131
|
const s = (p = a.dataTransfer) == null ? void 0 : p.files, { onDrop: i, onError: d, accept: m, multiple: c, maxSize: g, maxFiles: D } = e.__vDropzoneOptions__;
|
|
130
132
|
if (s && s.length > 0) {
|
|
131
|
-
const h = Array.from(s), { acceptedFiles: f, rejectedFiles:
|
|
133
|
+
const h = Array.from(s), { acceptedFiles: f, rejectedFiles: S, rejectionReason: _ } = se(h, {
|
|
132
134
|
accept: m,
|
|
133
135
|
multiple: c,
|
|
134
136
|
maxSize: g,
|
|
135
137
|
maxFiles: D
|
|
136
138
|
});
|
|
137
|
-
_ && d({ files:
|
|
139
|
+
_ && d({ files: S, ..._ }), f.length > 0 && i(f);
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
};
|
|
@@ -150,130 +152,139 @@ const Ce = {
|
|
|
150
152
|
unmounted(e) {
|
|
151
153
|
e.__vDropzoneHandlers__ && (e.removeEventListener("dragenter", e.__vDropzoneHandlers__.handleDragEnter), e.removeEventListener("dragover", e.__vDropzoneHandlers__.handleDragOver), e.removeEventListener("dragleave", e.__vDropzoneHandlers__.handleDragLeave), e.removeEventListener("drop", e.__vDropzoneHandlers__.handleDrop), delete e.__vDropzoneHandlers__), delete e.__vDropzoneOptions__;
|
|
152
154
|
}
|
|
153
|
-
},
|
|
154
|
-
S,
|
|
155
|
-
F,
|
|
156
|
-
b,
|
|
155
|
+
}, ie = [
|
|
157
156
|
x,
|
|
157
|
+
B,
|
|
158
158
|
E,
|
|
159
|
+
F,
|
|
160
|
+
b,
|
|
159
161
|
C,
|
|
160
162
|
z,
|
|
161
163
|
y,
|
|
162
164
|
L,
|
|
163
165
|
P,
|
|
164
166
|
A,
|
|
165
|
-
O,
|
|
166
167
|
M,
|
|
168
|
+
O,
|
|
167
169
|
R,
|
|
168
170
|
j,
|
|
169
171
|
H,
|
|
170
|
-
W,
|
|
171
172
|
$,
|
|
173
|
+
W,
|
|
172
174
|
w,
|
|
173
175
|
k,
|
|
174
176
|
N,
|
|
175
177
|
V,
|
|
178
|
+
G,
|
|
176
179
|
I,
|
|
177
180
|
U,
|
|
178
181
|
K,
|
|
179
182
|
X,
|
|
180
183
|
Y,
|
|
181
184
|
q,
|
|
182
|
-
|
|
185
|
+
J,
|
|
186
|
+
Q,
|
|
183
187
|
Z,
|
|
188
|
+
oe,
|
|
189
|
+
te,
|
|
184
190
|
ee,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
], ze = {
|
|
191
|
+
re
|
|
192
|
+
], Me = {
|
|
188
193
|
install(e) {
|
|
189
|
-
|
|
194
|
+
ie.forEach((r) => {
|
|
190
195
|
const t = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
|
|
191
196
|
e.component(`Tr${t}`, r);
|
|
192
197
|
});
|
|
193
198
|
}
|
|
194
199
|
};
|
|
195
200
|
export {
|
|
196
|
-
|
|
201
|
+
J as ActionButton,
|
|
197
202
|
C as Anchor,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
x as Attachments,
|
|
204
|
+
B as Bubble,
|
|
205
|
+
E as BubbleList,
|
|
206
|
+
F as BubbleProvider,
|
|
207
|
+
je as BubbleRendererMatchPriority,
|
|
208
|
+
He as BubbleRenderers,
|
|
209
|
+
Z as ClearButton,
|
|
210
|
+
b as Container,
|
|
206
211
|
z as Conversations,
|
|
207
|
-
|
|
212
|
+
re as DefaultActionButtons,
|
|
208
213
|
y as DragOverlay,
|
|
209
214
|
L as DropdownMenu,
|
|
215
|
+
Y as ExtensionCard,
|
|
216
|
+
q as ExtensionCardGrid,
|
|
210
217
|
P as Feedback,
|
|
211
218
|
A as History,
|
|
212
|
-
|
|
213
|
-
|
|
219
|
+
M as IconButton,
|
|
220
|
+
O as Layout,
|
|
214
221
|
j as LayoutAsideToggle,
|
|
215
222
|
R as LayoutProxyScrollbar,
|
|
216
223
|
X as McpAddForm,
|
|
217
224
|
K as McpServerPicker,
|
|
218
|
-
H as
|
|
225
|
+
H as ModelSelector,
|
|
226
|
+
$ as Prompt,
|
|
219
227
|
W as Prompts,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
Ze as SENDER_CONTEXT_KEY,
|
|
229
|
+
w as Sender,
|
|
230
|
+
k as SenderCompat,
|
|
231
|
+
Q as SubmitButton,
|
|
232
|
+
V as SuggestionPillButton,
|
|
233
|
+
N as SuggestionPills,
|
|
234
|
+
G as SuggestionPopover,
|
|
227
235
|
I as ThemeProvider,
|
|
228
|
-
|
|
236
|
+
J as TrActionButton,
|
|
229
237
|
C as TrAnchor,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
x as TrAttachments,
|
|
239
|
+
B as TrBubble,
|
|
240
|
+
E as TrBubbleList,
|
|
241
|
+
F as TrBubbleProvider,
|
|
242
|
+
Z as TrClearButton,
|
|
243
|
+
b as TrContainer,
|
|
236
244
|
z as TrConversations,
|
|
237
|
-
|
|
245
|
+
re as TrDefaultActionButtons,
|
|
238
246
|
y as TrDragOverlay,
|
|
239
247
|
L as TrDropdownMenu,
|
|
248
|
+
Y as TrExtensionCard,
|
|
249
|
+
q as TrExtensionCardGrid,
|
|
240
250
|
P as TrFeedback,
|
|
241
251
|
A as TrHistory,
|
|
242
|
-
|
|
243
|
-
|
|
252
|
+
M as TrIconButton,
|
|
253
|
+
O as TrLayout,
|
|
244
254
|
j as TrLayoutAsideToggle,
|
|
245
255
|
R as TrLayoutProxyScrollbar,
|
|
246
256
|
X as TrMcpAddForm,
|
|
247
257
|
K as TrMcpServerPicker,
|
|
248
|
-
H as
|
|
258
|
+
H as TrModelSelector,
|
|
259
|
+
$ as TrPrompt,
|
|
249
260
|
W as TrPrompts,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
261
|
+
w as TrSender,
|
|
262
|
+
k as TrSenderCompat,
|
|
263
|
+
Q as TrSubmitButton,
|
|
264
|
+
V as TrSuggestionPillButton,
|
|
265
|
+
N as TrSuggestionPills,
|
|
266
|
+
G as TrSuggestionPopover,
|
|
256
267
|
I as TrThemeProvider,
|
|
257
|
-
|
|
258
|
-
|
|
268
|
+
oe as TrUploadButton,
|
|
269
|
+
te as TrVoiceButton,
|
|
259
270
|
U as TrWelcome,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
271
|
+
ee as TrWordCounter,
|
|
272
|
+
oe as UploadButton,
|
|
273
|
+
te as VoiceButton,
|
|
263
274
|
U as Welcome,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
ee as WordCounter,
|
|
276
|
+
Me as default,
|
|
277
|
+
$e as useAutoScroll,
|
|
278
|
+
We as useBubbleBoxRenderer,
|
|
279
|
+
we as useBubbleContentRenderer,
|
|
280
|
+
ke as useBubbleEventFn,
|
|
281
|
+
Ne as useBubbleStateChangeFn,
|
|
282
|
+
Ve as useMessageContent,
|
|
283
|
+
Ge as useOmitMessageFields,
|
|
284
|
+
Je as useSenderContentRegistration,
|
|
285
|
+
er as useSenderContext,
|
|
286
|
+
Ye as useTheme,
|
|
287
|
+
Ie as useToolCall,
|
|
288
|
+
Ke as useTouchDevice,
|
|
289
|
+
Ae as vDropzone
|
|
279
290
|
};
|
package/dist/index3.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var $ = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { e as
|
|
6
|
-
import { u as
|
|
7
|
-
import { IconImageUpload as
|
|
8
|
-
import { _ as
|
|
9
|
-
const
|
|
2
|
+
var F = (i, o, e) => o in i ? $(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
+
var x = (i, o, e) => F(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { defineComponent as I, toRefs as H, computed as v, watch as V, openBlock as R, createBlock as y, unref as m, ref as A, reactive as P, onUnmounted as j, createElementBlock as U, Fragment as W, normalizeClass as L, createSlots as M, withCtx as z, renderSlot as B, resolveDynamicComponent as N, createCommentVNode as O } from "vue";
|
|
5
|
+
import { e as T } from "./index4.js";
|
|
6
|
+
import { u as b, A as k } from "./index2.js";
|
|
7
|
+
import { IconImageUpload as _, IconVoice as q, IconRecordingWave as G } from "@opentiny/tiny-robot-svgs";
|
|
8
|
+
import { _ as J } from "./_plugin-vue_export-helper.js";
|
|
9
|
+
const ne = /* @__PURE__ */ I({
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
12
12
|
disabled: { type: Boolean },
|
|
@@ -22,48 +22,51 @@ const te = /* @__PURE__ */ B({
|
|
|
22
22
|
},
|
|
23
23
|
emits: ["select", "error"],
|
|
24
24
|
setup(i, { expose: o, emit: e }) {
|
|
25
|
-
const n = i, l = e, { accept: c, multiple:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
const n = i, l = e, { accept: c, multiple: g, reset: f } = H(n), { disabled: a } = b(), t = v(() => n.disabled || a.value), { open: s, files: d } = T(), u = (p) => {
|
|
26
|
+
s({
|
|
27
|
+
accept: c.value,
|
|
28
|
+
multiple: g.value,
|
|
29
|
+
reset: f.value,
|
|
30
|
+
...p
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
V(d, (p) => {
|
|
34
|
+
if (!p || p.length === 0) return;
|
|
35
|
+
const r = Array.from(p);
|
|
36
|
+
if (n.maxCount && r.length > n.maxCount) {
|
|
37
|
+
const h = new Error(`最多只能选择 ${n.maxCount} 个文件`);
|
|
38
|
+
l("error", h);
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
41
|
if (n.maxSize) {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
l("error",
|
|
42
|
+
const h = n.maxSize * 1024 * 1024, E = r.filter((C) => C.size > h);
|
|
43
|
+
if (E.length > 0) {
|
|
44
|
+
const C = new Error(`以下文件超过 ${n.maxSize}MB 限制: ${E.map((D) => D.name).join(", ")}`);
|
|
45
|
+
l("error", C, E);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
l("select",
|
|
49
|
+
l("select", r);
|
|
47
50
|
});
|
|
48
|
-
const
|
|
49
|
-
t.value ||
|
|
51
|
+
const w = () => {
|
|
52
|
+
t.value || u();
|
|
50
53
|
};
|
|
51
54
|
return o({
|
|
52
|
-
open:
|
|
53
|
-
}), (
|
|
54
|
-
icon: i.icon ??
|
|
55
|
+
open: u
|
|
56
|
+
}), (p, r) => (R(), y(k, {
|
|
57
|
+
icon: i.icon ?? m(_),
|
|
55
58
|
disabled: t.value,
|
|
56
59
|
size: i.size,
|
|
57
60
|
tooltip: i.tooltip,
|
|
58
61
|
"tooltip-placement": i.tooltipPlacement,
|
|
59
|
-
onClick:
|
|
62
|
+
onClick: w
|
|
60
63
|
}, null, 8, ["icon", "disabled", "size", "tooltip", "tooltip-placement"]));
|
|
61
64
|
}
|
|
62
65
|
});
|
|
63
|
-
class
|
|
66
|
+
class S {
|
|
64
67
|
constructor(o) {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
x(this, "recognition");
|
|
69
|
+
x(this, "options");
|
|
67
70
|
this.options = o, this.initialize();
|
|
68
71
|
}
|
|
69
72
|
/**
|
|
@@ -82,7 +85,7 @@ class w {
|
|
|
82
85
|
* 检查浏览器是否支持 Web Speech API(实例方法)
|
|
83
86
|
*/
|
|
84
87
|
isSupported() {
|
|
85
|
-
return
|
|
88
|
+
return S.isSupported();
|
|
86
89
|
}
|
|
87
90
|
/**
|
|
88
91
|
* 设置语音识别事件处理器
|
|
@@ -136,8 +139,8 @@ class w {
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
|
-
function
|
|
140
|
-
const o =
|
|
142
|
+
function K(i) {
|
|
143
|
+
const o = A(i), e = P({
|
|
141
144
|
isRecording: !1,
|
|
142
145
|
isSupported: !1,
|
|
143
146
|
error: void 0
|
|
@@ -147,25 +150,25 @@ function J(i) {
|
|
|
147
150
|
e.isRecording = !0, e.error = void 0, (t = (a = o.value).onStart) == null || t.call(a);
|
|
148
151
|
},
|
|
149
152
|
onInterim: (a) => {
|
|
150
|
-
var t,
|
|
151
|
-
(
|
|
153
|
+
var t, s;
|
|
154
|
+
(s = (t = o.value).onInterim) == null || s.call(t, a);
|
|
152
155
|
},
|
|
153
156
|
onFinal: (a) => {
|
|
154
|
-
var t,
|
|
155
|
-
(
|
|
157
|
+
var t, s;
|
|
158
|
+
(s = (t = o.value).onFinal) == null || s.call(t, a);
|
|
156
159
|
},
|
|
157
160
|
onEnd: (a) => {
|
|
158
|
-
var t,
|
|
159
|
-
e.isRecording && (e.isRecording = !1, (
|
|
161
|
+
var t, s;
|
|
162
|
+
e.isRecording && (e.isRecording = !1, (s = (t = o.value).onEnd) == null || s.call(t, a));
|
|
160
163
|
},
|
|
161
164
|
onError: (a) => {
|
|
162
|
-
var t,
|
|
163
|
-
e.error = a, e.isRecording = !1, (
|
|
165
|
+
var t, s;
|
|
166
|
+
e.error = a, e.isRecording = !1, (s = (t = o.value).onError) == null || s.call(t, a);
|
|
164
167
|
}
|
|
165
|
-
}, l =
|
|
168
|
+
}, l = S.isSupported();
|
|
166
169
|
e.isSupported = i.customHandler ? i.customHandler.isSupported() : l;
|
|
167
|
-
const c = i.customHandler ?? (l ? new
|
|
168
|
-
var a, t,
|
|
170
|
+
const c = i.customHandler ?? (l ? new S(i) : null), g = () => {
|
|
171
|
+
var a, t, s, d;
|
|
169
172
|
if (!e.isSupported || !c) {
|
|
170
173
|
const u = new Error("语音识别不受支持");
|
|
171
174
|
e.error = u, (t = (a = o.value).onError) == null || t.call(a, u);
|
|
@@ -180,20 +183,20 @@ function J(i) {
|
|
|
180
183
|
try {
|
|
181
184
|
c.start(n);
|
|
182
185
|
} catch (u) {
|
|
183
|
-
e.error = u instanceof Error ? u : new Error("启动失败"), (d = (
|
|
186
|
+
e.error = u instanceof Error ? u : new Error("启动失败"), (d = (s = o.value).onError) == null || d.call(s, e.error);
|
|
184
187
|
}
|
|
185
|
-
},
|
|
188
|
+
}, f = () => {
|
|
186
189
|
!e.isRecording || !c || (c.stop(), n.onEnd());
|
|
187
190
|
};
|
|
188
|
-
return
|
|
191
|
+
return j(() => {
|
|
189
192
|
e.isRecording && c && (c.stop(), e.isRecording = !1);
|
|
190
193
|
}), {
|
|
191
194
|
speechState: e,
|
|
192
|
-
start:
|
|
193
|
-
stop:
|
|
195
|
+
start: g,
|
|
196
|
+
stop: f
|
|
194
197
|
};
|
|
195
198
|
}
|
|
196
|
-
const
|
|
199
|
+
const Q = /* @__PURE__ */ I({
|
|
197
200
|
__name: "index",
|
|
198
201
|
props: {
|
|
199
202
|
icon: {},
|
|
@@ -208,75 +211,75 @@ const K = /* @__PURE__ */ B({
|
|
|
208
211
|
},
|
|
209
212
|
emits: ["speech-start", "speech-interim", "speech-final", "speech-end", "speech-error"],
|
|
210
213
|
setup(i, { expose: o, emit: e }) {
|
|
211
|
-
const n = i, l = e, { editor: c, disabled:
|
|
214
|
+
const n = i, l = e, { editor: c, disabled: g } = b(), f = v(() => n.disabled || g.value), a = {
|
|
212
215
|
...n.speechConfig,
|
|
213
216
|
onStart: () => {
|
|
214
217
|
l("speech-start");
|
|
215
218
|
},
|
|
216
|
-
onInterim: (
|
|
217
|
-
l("speech-interim",
|
|
219
|
+
onInterim: (r) => {
|
|
220
|
+
l("speech-interim", r);
|
|
218
221
|
},
|
|
219
|
-
onFinal: (
|
|
220
|
-
n.autoInsert && c.value && (c.value.commands.insertContent(
|
|
222
|
+
onFinal: (r) => {
|
|
223
|
+
n.autoInsert && c.value && (c.value.commands.insertContent(r + " "), c.value.commands.focus("end")), l("speech-final", r);
|
|
221
224
|
},
|
|
222
|
-
onEnd: (
|
|
223
|
-
c.value && c.value.commands.focus("end"), l("speech-end",
|
|
225
|
+
onEnd: (r) => {
|
|
226
|
+
c.value && c.value.commands.focus("end"), l("speech-end", r);
|
|
224
227
|
},
|
|
225
|
-
onError: (
|
|
226
|
-
l("speech-error",
|
|
228
|
+
onError: (r) => {
|
|
229
|
+
l("speech-error", r);
|
|
227
230
|
}
|
|
228
|
-
}, { speechState: t, start:
|
|
229
|
-
if (!
|
|
231
|
+
}, { speechState: t, start: s, stop: d } = K(a), u = async () => {
|
|
232
|
+
if (!f.value) {
|
|
230
233
|
if (n.onButtonClick) {
|
|
231
|
-
let
|
|
234
|
+
let r = !1;
|
|
232
235
|
if (await n.onButtonClick(t.isRecording, () => {
|
|
233
|
-
|
|
234
|
-
}),
|
|
236
|
+
r = !0;
|
|
237
|
+
}), r) return;
|
|
235
238
|
}
|
|
236
|
-
t.isRecording ? d() :
|
|
239
|
+
t.isRecording ? d() : s();
|
|
237
240
|
}
|
|
238
|
-
},
|
|
241
|
+
}, w = v(() => n.icon ?? q), p = v(() => n.recordingIcon ?? G);
|
|
239
242
|
return o({
|
|
240
|
-
start:
|
|
243
|
+
start: s,
|
|
241
244
|
stop: d,
|
|
242
245
|
speechState: t
|
|
243
|
-
}), (
|
|
244
|
-
|
|
246
|
+
}), (r, h) => (R(), U(W, null, [
|
|
247
|
+
m(t).isSupported ? (R(), y(k, {
|
|
245
248
|
key: 0,
|
|
246
|
-
icon:
|
|
247
|
-
disabled:
|
|
249
|
+
icon: w.value,
|
|
250
|
+
disabled: f.value,
|
|
248
251
|
size: i.size,
|
|
249
252
|
tooltip: i.tooltip,
|
|
250
253
|
"tooltip-placement": i.tooltipPlacement,
|
|
251
|
-
class:
|
|
254
|
+
class: L({ "is-recording": m(t).isRecording }),
|
|
252
255
|
onClick: u
|
|
253
|
-
},
|
|
254
|
-
|
|
256
|
+
}, M({ _: 2 }, [
|
|
257
|
+
r.$slots.icon ? {
|
|
255
258
|
name: "icon",
|
|
256
|
-
fn:
|
|
257
|
-
|
|
258
|
-
isRecording:
|
|
259
|
+
fn: z(() => [
|
|
260
|
+
B(r.$slots, "icon", {
|
|
261
|
+
isRecording: m(t).isRecording
|
|
259
262
|
}, void 0, !0)
|
|
260
263
|
]),
|
|
261
264
|
key: "0"
|
|
262
|
-
} :
|
|
265
|
+
} : m(t).isRecording ? {
|
|
263
266
|
name: "icon",
|
|
264
|
-
fn:
|
|
265
|
-
(
|
|
267
|
+
fn: z(() => [
|
|
268
|
+
(R(), y(N(p.value)))
|
|
266
269
|
]),
|
|
267
270
|
key: "1"
|
|
268
271
|
} : void 0
|
|
269
|
-
]), 1032, ["icon", "disabled", "size", "tooltip", "tooltip-placement", "class"])) :
|
|
270
|
-
|
|
271
|
-
isRecording:
|
|
272
|
-
stop:
|
|
272
|
+
]), 1032, ["icon", "disabled", "size", "tooltip", "tooltip-placement", "class"])) : O("", !0),
|
|
273
|
+
B(r.$slots, "recording-overlay", {
|
|
274
|
+
isRecording: m(t).isRecording,
|
|
275
|
+
stop: m(d)
|
|
273
276
|
}, void 0, !0)
|
|
274
277
|
], 64));
|
|
275
278
|
}
|
|
276
|
-
}),
|
|
279
|
+
}), ie = /* @__PURE__ */ J(Q, [["__scopeId", "data-v-2a013fc9"]]);
|
|
277
280
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
ie as V,
|
|
282
|
+
S as W,
|
|
283
|
+
ne as _,
|
|
284
|
+
K as u
|
|
282
285
|
};
|
package/dist/index4.js
CHANGED
|
@@ -814,7 +814,7 @@ function lt(e = {}) {
|
|
|
814
814
|
return { width: r, height: s };
|
|
815
815
|
}
|
|
816
816
|
export {
|
|
817
|
-
|
|
817
|
+
rt as a,
|
|
818
818
|
lt as b,
|
|
819
819
|
tt as c,
|
|
820
820
|
et as d,
|
|
@@ -831,6 +831,6 @@ export {
|
|
|
831
831
|
Je as o,
|
|
832
832
|
Ke as p,
|
|
833
833
|
B as t,
|
|
834
|
-
|
|
834
|
+
x as u,
|
|
835
835
|
qe as w
|
|
836
836
|
};
|
package/dist/index6.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as M, watch as U, toValue as k, onMounted as xe, onUnmounted as We, nextTick as te, defineComponent as I, openBlock as v, createElementBlock as E, renderSlot as C, computed as x, unref as R, normalizeClass as G, createVNode as V, onBeforeUnmount as Ve, Fragment as D, createElementVNode as B, mergeProps as w, toDisplayString as z, withDirectives as Q, vShow as ee, createBlock as A, resolveDynamicComponent as J, normalizeProps as P, guardReactiveProps as H, createCommentVNode as ae, watchEffect as ne, useCssModule as ze, renderList as W, markRaw as F, inject as T, provide as L, reactive as Xe, readonly as qe, withCtx as $ } from "vue";
|
|
2
2
|
import { _ as O } from "./_plugin-vue_export-helper.js";
|
|
3
3
|
import { IconLoading as Be, IconAtom as Ze, IconArrowDown as Re, IconPlugin as me, IconError as Qe, IconCancelled as et } from "@opentiny/tiny-robot-svgs";
|
|
4
|
-
import { l as tt, w as nt, g as ot,
|
|
4
|
+
import { l as tt, w as nt, g as ot, u as st } from "./index4.js";
|
|
5
5
|
function _e(t, e) {
|
|
6
6
|
const n = U(t, (o, l) => {
|
|
7
7
|
l === !0 && o === !1 && (e(), n());
|