sophontalk-services 0.0.10 → 0.0.12
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-lib/sophontalk-services.es.js +101 -72
- package/dist-lib/types/App.vue.d.ts +1 -3
- package/dist-lib/types/api/application/index.d.ts +17 -0
- package/dist-lib/types/api/init.d.ts +1 -0
- package/dist-lib/types/components/metahuman-broadcasting/index.d.ts +3 -0
- package/dist-lib/types/components/metahuman-broadcasting/src/ctx.d.ts +57 -0
- package/dist-lib/types/components/metahuman-broadcasting/src/index.vue.d.ts +69 -0
- package/dist-lib/types/router/index.d.ts +1 -0
- package/dist-lib/types/services/inference-engine.d.ts +17 -0
- package/dist-lib/types/views/home/index.vue.d.ts +4 -0
- package/dist-lib/types/views/metahuman/api.d.ts +1 -0
- package/dist-lib/types/views/metahuman/index.vue.d.ts +2 -0
- package/package.json +54 -49
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { env as
|
|
2
|
-
const
|
|
1
|
+
import { env as m } from "onnxruntime-web";
|
|
2
|
+
const v = 16e3, k = 25, b = 10, P = 80, N = 4, y = 0.97, L = 1e-10, C = 20, F = !0, R = !0, g = 25, D = 1e3 / g, h = {
|
|
3
3
|
workersPath: "/workers/",
|
|
4
4
|
jsonUrl: "/complete_dataset.json",
|
|
5
5
|
zipUrl: "/processed_images.zip"
|
|
6
|
-
},
|
|
6
|
+
}, B = (s) => {
|
|
7
7
|
if (s === 128) return 4;
|
|
8
8
|
if (s === 96) return 3;
|
|
9
9
|
throw new Error(`Unsupported crop size: ${s}. Only nano (96) and tiny (128) are supported.`);
|
|
10
|
-
},
|
|
10
|
+
}, G = (s, e, r) => {
|
|
11
11
|
if (e <= 1) return { nextIndex: 0, nextDirection: 1 };
|
|
12
|
-
let
|
|
13
|
-
return
|
|
12
|
+
let t = s + r, n = r;
|
|
13
|
+
return t >= e ? (t = e - 2, n = -1) : t < 0 && (t = 1, n = 1), { nextIndex: t, nextDirection: n };
|
|
14
14
|
};
|
|
15
|
-
async function
|
|
15
|
+
async function I(s = {}) {
|
|
16
16
|
const {
|
|
17
17
|
jsonUrl: e = h.jsonUrl,
|
|
18
|
-
zipUrl:
|
|
19
|
-
} = s, [
|
|
18
|
+
zipUrl: r = h.zipUrl
|
|
19
|
+
} = s, [t, n] = await Promise.all([
|
|
20
20
|
fetch(e),
|
|
21
|
-
fetch(
|
|
21
|
+
fetch(r)
|
|
22
22
|
]);
|
|
23
|
-
if (!
|
|
24
|
-
if (!n.ok) throw new Error(`无法加载 ${
|
|
25
|
-
const
|
|
26
|
-
return { dataset:
|
|
23
|
+
if (!t.ok) throw new Error(`无法加载 ${e}`);
|
|
24
|
+
if (!n.ok) throw new Error(`无法加载 ${r}`);
|
|
25
|
+
const i = await t.json(), c = await n.arrayBuffer();
|
|
26
|
+
return { dataset: i, zipBuffer: c };
|
|
27
27
|
}
|
|
28
28
|
function f(s) {
|
|
29
29
|
return s[s.length - 1] === "/" ? s.slice(0, -1) : s;
|
|
30
30
|
}
|
|
31
|
-
class
|
|
31
|
+
class Q {
|
|
32
32
|
worker = new Worker(
|
|
33
33
|
`${f(h.workersPath)}/feature.worker.js`,
|
|
34
34
|
{ type: "module" }
|
|
35
35
|
);
|
|
36
36
|
async process(e) {
|
|
37
|
-
const
|
|
38
|
-
leftChannel:
|
|
39
|
-
rightChannel:
|
|
37
|
+
const r = e.getChannelData(0), t = e.numberOfChannels > 1 ? e.getChannelData(1) : void 0, n = {
|
|
38
|
+
leftChannel: r,
|
|
39
|
+
rightChannel: t,
|
|
40
40
|
sampleRate: e.sampleRate
|
|
41
|
-
},
|
|
42
|
-
return
|
|
43
|
-
const
|
|
44
|
-
a.data?.status === "success" ? (this.worker.removeEventListener("message",
|
|
41
|
+
}, i = [r.buffer];
|
|
42
|
+
return t && i.push(t.buffer), new Promise((c, u) => {
|
|
43
|
+
const o = (a) => {
|
|
44
|
+
a.data?.status === "success" ? (this.worker.removeEventListener("message", o), this.worker.removeEventListener("error", l), c(a.data.payload)) : a.data?.status === "error" && (this.worker.removeEventListener("message", o), this.worker.removeEventListener("error", l), u(new Error(a.data.error || "特征提取失败")));
|
|
45
45
|
}, l = (a) => {
|
|
46
|
-
this.worker.removeEventListener("message",
|
|
46
|
+
this.worker.removeEventListener("message", o), this.worker.removeEventListener("error", l), u(a);
|
|
47
47
|
};
|
|
48
|
-
this.worker.addEventListener("message",
|
|
48
|
+
this.worker.addEventListener("message", o), this.worker.addEventListener("error", l), this.worker.postMessage(n, i);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
dispose() {
|
|
52
52
|
this.worker.terminate();
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const w = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAAAAADH8yjkAAADsElEQVRoBbXBsaoYBAwF0KTP0vBQgppBNGNn6VTu5Cj55ODoFDoV545RHKIuUlLqq/5EPIfp2cPzh2f0f/j09PHpEz97ePEonzHd+/efff/hiZ+/sG/t8YHuPb2f3+YDP37+8vuXXz2nex//fPfLu7/5iy9f/fDqmxd078Pvb39++xfr169/fP2d0L399c1Pb/5gNQRc6N52ZQ2rIeBC97Yra1gNARe6t11Zw2oIuNC97coaVkPAhe5tV9awGgIudG+7sobVEHChe9uVNayGgAvd266sYTUEXOjedmUNqyHgQve2K2tYDQEXurddWcNqCLjQve3KGlZDwIXubVfWsBoCLnRvu7KG1RBwoXvblTWshoAL3duurGE1BFzo3nZlDash4EL3titrWA0BF7q3XVnDagi40L3tyhpWQ8CF7m1X1rAaAi50b7uyhtUQcKF725U1rIaAC93brqxhNQRc6N52ZQ2rIeBC97Yra1gNARe6t11Zw2oIuNC97coaVkPAhe5tV9awGgIudG+7sobVEHChe9uVNayGgAvd266sYTUEXOjedmUNqyHgQve2K2tYDQEXurddWcNqCLjQve3KGlZDwIXubVfWsBoCLnRvu7KG1RBwoXvblTWshoAL3duurGE1BFzo3nZlDash4EL3titrWA0BF7q3XVnDagi40L3tyhpWQ8CF7m1X1rAaAi50b7uyhtUQcKF725U1rIaAC93brqxhNQRc6N52ZQ2rIeBC97Yra1gNARe6t11Zw2oIuNC97coaVkPAhe5tV9awGgIudG+7sobVEHChe9uVNayGgAvd266sYTUEXOjedmUNqyHgQve2K2tYDQEXurddWcNqCLjQve3KGlZDwIXubVfWsBoCLnRvu7KG1RBwoXvblTWshoAL3duurGE1BFzo3nZlDash4EL3titrWA0BF7q3XVnDagi40L3tyhpWQ8CF7m1X1rAaAi50b7uyhtUQcKF725U1rIaAC93brqxhNQRc6N52ZQ2rIeBC97Yra1gNARe6t11Zw2oIuNC97coaVkPAhe5tV9awGgIudG+7sobVEHChe9uVNayGgAvd266sYTUEXOjedmUNqyHgQve2K2tYDQEXurddWcNqCLjQve3KGtavX//4+juhe/vrm5/e/MFffPnqh1ffvKB7H35/+/Pbv/jx85ffv/zqOd37+Oe7X979zc9f2Lf2+ED3nt7Pb/OBnz28eJTPmO79+8++//DE9Ozh+cMz+j98evr49Ok/l/tDxY3JIlEAAAAASUVORK5CYII=";
|
|
56
56
|
class d {
|
|
57
57
|
constructor() {
|
|
58
|
-
this.promise = new Promise((e,
|
|
59
|
-
this.resolve = e, this.reject =
|
|
58
|
+
this.promise = new Promise((e, r) => {
|
|
59
|
+
this.resolve = e, this.reject = r;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
class
|
|
63
|
+
class E {
|
|
64
64
|
pending = null;
|
|
65
65
|
worker;
|
|
66
66
|
constructor(e) {
|
|
@@ -70,15 +70,15 @@ class m {
|
|
|
70
70
|
* 将 message 分发给 silent 子模块处理。
|
|
71
71
|
* @returns true 表示已处理并消费该消息;false 表示不是 silent 消息
|
|
72
72
|
*/
|
|
73
|
-
handleMessage(e,
|
|
73
|
+
handleMessage(e, r) {
|
|
74
74
|
if (e !== "silent-frame") return !1;
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
75
|
+
const t = r?.frame;
|
|
76
|
+
if (!t) return !0;
|
|
77
77
|
if (this.pending) {
|
|
78
78
|
const n = this.pending;
|
|
79
|
-
this.pending = null, n.resolve(
|
|
79
|
+
this.pending = null, n.resolve(t);
|
|
80
80
|
} else
|
|
81
|
-
|
|
81
|
+
t.close?.();
|
|
82
82
|
return !0;
|
|
83
83
|
}
|
|
84
84
|
getNext() {
|
|
@@ -87,18 +87,18 @@ class m {
|
|
|
87
87
|
return this.pending = e, this.worker.postMessage({ type: "silent-next" }), e.promise;
|
|
88
88
|
}
|
|
89
89
|
async *createGenerator(e) {
|
|
90
|
-
const
|
|
90
|
+
const r = e?.signal, t = () => {
|
|
91
91
|
this.cancel();
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
r?.addEventListener("abort", t);
|
|
94
94
|
try {
|
|
95
|
-
for (; !
|
|
95
|
+
for (; !r?.aborted; ) {
|
|
96
96
|
const n = await this.getNext();
|
|
97
97
|
if (!n) break;
|
|
98
98
|
yield n;
|
|
99
99
|
}
|
|
100
100
|
} finally {
|
|
101
|
-
|
|
101
|
+
r?.removeEventListener("abort", t);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -110,62 +110,85 @@ class m {
|
|
|
110
110
|
this.pending = null, e.resolve(null);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
function A(s) {
|
|
114
|
+
return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, r) {
|
|
115
|
+
var t = s.get(e);
|
|
116
|
+
t ? t.push(r) : s.set(e, [r]);
|
|
117
|
+
}, off: function(e, r) {
|
|
118
|
+
var t = s.get(e);
|
|
119
|
+
t && (r ? t.splice(t.indexOf(r) >>> 0, 1) : s.set(e, []));
|
|
120
|
+
}, emit: function(e, r) {
|
|
121
|
+
var t = s.get(e);
|
|
122
|
+
t && t.slice().map(function(n) {
|
|
123
|
+
n(r);
|
|
124
|
+
}), (t = s.get("*")) && t.slice().map(function(n) {
|
|
125
|
+
n(e, r);
|
|
126
|
+
});
|
|
127
|
+
} };
|
|
128
|
+
}
|
|
129
|
+
class U {
|
|
114
130
|
worker;
|
|
115
131
|
handlers = {};
|
|
116
132
|
silentPull;
|
|
133
|
+
emitter = A();
|
|
117
134
|
def = new d();
|
|
118
135
|
constructor(e = {}) {
|
|
119
136
|
this.handlers = e, this.worker = new Worker(
|
|
120
137
|
`${f(h.workersPath)}/inference.worker.js`,
|
|
121
138
|
{ type: "module" }
|
|
122
|
-
), this.silentPull = new
|
|
139
|
+
), this.silentPull = new E(this.worker), this.worker.onmessage = this.handleMessage.bind(this);
|
|
140
|
+
}
|
|
141
|
+
on(e, r) {
|
|
142
|
+
this.emitter.on(e, r);
|
|
143
|
+
}
|
|
144
|
+
off(e, r) {
|
|
145
|
+
this.emitter.off(e, r);
|
|
123
146
|
}
|
|
124
147
|
handleMessage(e) {
|
|
125
|
-
const { type:
|
|
126
|
-
if (!this.silentPull.handleMessage(
|
|
127
|
-
switch (
|
|
148
|
+
const { type: r, payload: t } = e.data;
|
|
149
|
+
if (!this.silentPull.handleMessage(r, t))
|
|
150
|
+
switch (r) {
|
|
128
151
|
case "ready":
|
|
129
|
-
this.handlers.onReady?.(), this.def.resolve(this);
|
|
152
|
+
this.handlers.onReady?.(), this.emitter.emit("ready"), this.def.resolve(this);
|
|
130
153
|
break;
|
|
131
154
|
case "start":
|
|
132
|
-
this.handlers.onStart?.(
|
|
155
|
+
this.handlers.onStart?.(t.totalFrames), this.emitter.emit("start", t.totalFrames);
|
|
133
156
|
break;
|
|
134
157
|
case "frame":
|
|
135
|
-
this.handlers.onFrame?.(
|
|
158
|
+
this.handlers.onFrame?.(t.frame, t.index), this.emitter.emit("frame", { frame: t.frame, index: t.index });
|
|
136
159
|
break;
|
|
137
160
|
case "progress":
|
|
138
|
-
this.handlers.onProgress?.(
|
|
161
|
+
this.handlers.onProgress?.(t.processed, t.total), this.emitter.emit("progress", { processed: t.processed, total: t.total });
|
|
139
162
|
break;
|
|
140
163
|
case "done":
|
|
141
|
-
this.handlers.onDone?.();
|
|
164
|
+
this.handlers.onDone?.(), this.emitter.emit("done");
|
|
142
165
|
break;
|
|
143
166
|
case "error":
|
|
144
|
-
this.handlers.onError?.(
|
|
167
|
+
this.handlers.onError?.(t), this.emitter.emit("error", t);
|
|
145
168
|
break;
|
|
146
169
|
}
|
|
147
170
|
}
|
|
148
171
|
init(e) {
|
|
149
|
-
const
|
|
172
|
+
const r = new d();
|
|
150
173
|
if (e.blendingMask instanceof ImageBitmap)
|
|
151
|
-
|
|
174
|
+
r.resolve(e.blendingMask);
|
|
152
175
|
else {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
176
|
+
const t = new Image();
|
|
177
|
+
t.src = e.blendingMask || w, t.decode().then(() => createImageBitmap(t)).then((n) => {
|
|
178
|
+
r.resolve(n);
|
|
156
179
|
});
|
|
157
180
|
}
|
|
158
|
-
|
|
181
|
+
r.promise.then((t) => {
|
|
159
182
|
this.worker.postMessage(
|
|
160
183
|
{
|
|
161
184
|
type: "init",
|
|
162
185
|
modelPath: e.modelPath,
|
|
163
186
|
dataset: e.dataset,
|
|
164
187
|
zipBuffer: e.zipBuffer,
|
|
165
|
-
blendingMask:
|
|
166
|
-
wasmPaths: e.wasmPaths ||
|
|
188
|
+
blendingMask: t,
|
|
189
|
+
wasmPaths: e.wasmPaths || m.wasm.wasmPaths
|
|
167
190
|
},
|
|
168
|
-
[e.zipBuffer,
|
|
191
|
+
[e.zipBuffer, t]
|
|
169
192
|
);
|
|
170
193
|
});
|
|
171
194
|
}
|
|
@@ -173,14 +196,20 @@ class Q {
|
|
|
173
196
|
return this.def.promise;
|
|
174
197
|
}
|
|
175
198
|
run(e) {
|
|
199
|
+
if (e.audioFeatures.buffer.byteLength === 0) {
|
|
200
|
+
const t = "Audio features buffer is detached; pass a fresh buffer or avoid reusing transferred data.";
|
|
201
|
+
this.handlers.onError?.(t), this.emitter.emit("error", t);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const r = new Float32Array(e.audioFeatures);
|
|
176
205
|
this.worker.postMessage(
|
|
177
206
|
{
|
|
178
207
|
type: "run",
|
|
179
|
-
audioFeatures:
|
|
208
|
+
audioFeatures: r,
|
|
180
209
|
audioDimensions: e.audioDimensions,
|
|
181
210
|
reset: e.reset !== !1
|
|
182
211
|
},
|
|
183
|
-
[
|
|
212
|
+
[r.buffer]
|
|
184
213
|
);
|
|
185
214
|
}
|
|
186
215
|
createSilentFrameGenerator(e) {
|
|
@@ -194,22 +223,22 @@ class Q {
|
|
|
194
223
|
}
|
|
195
224
|
}
|
|
196
225
|
export {
|
|
197
|
-
|
|
226
|
+
C as DEFAULT_LOW_FREQ,
|
|
198
227
|
L as ENERGY_FLOOR,
|
|
199
228
|
D as FRAME_INTERVAL_MS,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
229
|
+
k as FRAME_LENGTH_MS,
|
|
230
|
+
b as FRAME_SHIFT_MS,
|
|
231
|
+
Q as FeatureExtractor,
|
|
232
|
+
U as InferenceEngine,
|
|
204
233
|
P as NUM_MEL_BINS,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
234
|
+
N as NUM_SEQUENCE_FRAMES,
|
|
235
|
+
y as PREEMPH_COEFF,
|
|
236
|
+
F as REMOVE_DC_OFFSET,
|
|
208
237
|
R as ROUND_TO_POWER_OF_TWO,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
238
|
+
v as SAMPLE_RATE,
|
|
239
|
+
g as TARGET_FPS,
|
|
240
|
+
G as calculatePingPongState,
|
|
212
241
|
h as env,
|
|
213
|
-
|
|
214
|
-
|
|
242
|
+
B as getBorder,
|
|
243
|
+
I as loadDataset
|
|
215
244
|
};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
-
playbackCanvas: HTMLCanvasElement;
|
|
3
|
-
}, HTMLDivElement>;
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
4
2
|
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function speechToText(query: {
|
|
2
|
+
application_id: string;
|
|
3
|
+
file: File;
|
|
4
|
+
}): Promise<import('@vunk/shared/fetch').RequestResponse<string>>;
|
|
5
|
+
export declare function textToSpeech(query: {
|
|
6
|
+
application_id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}): Promise<Blob>;
|
|
9
|
+
/**
|
|
10
|
+
* @description: 新建聊天
|
|
11
|
+
*/
|
|
12
|
+
export declare function cChatId(query: {
|
|
13
|
+
application_id: string;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
export declare function authentication(query: {
|
|
16
|
+
access_token: string;
|
|
17
|
+
}): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TickerStatus } from '@vunk/shared/enum';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
export declare const props: {
|
|
4
|
+
/**
|
|
5
|
+
* @description 传入文本
|
|
6
|
+
*/
|
|
7
|
+
source: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @description 文本转语音的函数
|
|
13
|
+
*/
|
|
14
|
+
textToSpeech: {
|
|
15
|
+
type: PropType<(text: string) => Promise<Blob>>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description 模型地址
|
|
20
|
+
*/
|
|
21
|
+
modelUrl: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @description 数据集地址
|
|
27
|
+
*/
|
|
28
|
+
datasetUrl: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @description zip 资源包地址
|
|
34
|
+
*/
|
|
35
|
+
sourceUrl: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @description 播报状态
|
|
41
|
+
* @default TickerStatus.pending
|
|
42
|
+
*/
|
|
43
|
+
status: {
|
|
44
|
+
type: PropType<TickerStatus>;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @description 缓存多少帧后开始播放
|
|
49
|
+
*/
|
|
50
|
+
playAfterCache: {
|
|
51
|
+
type: NumberConstructor;
|
|
52
|
+
default: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const emits: {
|
|
56
|
+
'update:status': null;
|
|
57
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TickerStatus } from '@vunk/shared/enum';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
3
|
+
source: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
7
|
+
textToSpeech: {
|
|
8
|
+
type: import('vue').PropType<(text: string) => Promise<Blob>>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
modelUrl: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
datasetUrl: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
sourceUrl: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
status: {
|
|
24
|
+
type: import('vue').PropType<TickerStatus>;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
playAfterCache: {
|
|
28
|
+
type: NumberConstructor;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
32
|
+
"update:status": (...args: any[]) => void;
|
|
33
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
|
+
source: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
textToSpeech: {
|
|
39
|
+
type: import('vue').PropType<(text: string) => Promise<Blob>>;
|
|
40
|
+
required: true;
|
|
41
|
+
};
|
|
42
|
+
modelUrl: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
46
|
+
datasetUrl: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
sourceUrl: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
status: {
|
|
55
|
+
type: import('vue').PropType<TickerStatus>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
playAfterCache: {
|
|
59
|
+
type: NumberConstructor;
|
|
60
|
+
default: number;
|
|
61
|
+
};
|
|
62
|
+
}>> & Readonly<{
|
|
63
|
+
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
64
|
+
}>, {
|
|
65
|
+
source: string;
|
|
66
|
+
status: TickerStatus;
|
|
67
|
+
playAfterCache: number;
|
|
68
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
69
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const router: import('vue-router').Router;
|
|
@@ -19,12 +19,29 @@ export type InferenceEventHandler = {
|
|
|
19
19
|
onDone?: () => void;
|
|
20
20
|
onError?: (error: string) => void;
|
|
21
21
|
};
|
|
22
|
+
export type InferenceEvents = {
|
|
23
|
+
ready: void;
|
|
24
|
+
start: number;
|
|
25
|
+
frame: {
|
|
26
|
+
frame: ImageBitmap;
|
|
27
|
+
index: number;
|
|
28
|
+
};
|
|
29
|
+
progress: {
|
|
30
|
+
processed: number;
|
|
31
|
+
total: number;
|
|
32
|
+
};
|
|
33
|
+
done: void;
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
22
36
|
export declare class InferenceEngine {
|
|
23
37
|
private worker;
|
|
24
38
|
private handlers;
|
|
25
39
|
private silentPull;
|
|
40
|
+
private emitter;
|
|
26
41
|
private readonly def;
|
|
27
42
|
constructor(handlers?: InferenceEventHandler);
|
|
43
|
+
on<Key extends keyof InferenceEvents>(type: Key, handler: (event: InferenceEvents[Key]) => void): void;
|
|
44
|
+
off<Key extends keyof InferenceEvents>(type: Key, handler: (event: InferenceEvents[Key]) => void): void;
|
|
28
45
|
private handleMessage;
|
|
29
46
|
init(options: InferenceInitOptions): void;
|
|
30
47
|
when(): Promise<InferenceEngine>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
playbackCanvas: HTMLCanvasElement;
|
|
3
|
+
}, HTMLDivElement>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function textToSpeech(text: string): Promise<Blob>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,49 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sophontalk-services",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"dev": "vite",
|
|
7
|
-
"build": "vue-tsc -b && vite build",
|
|
8
|
-
"build:lib": "vite build --config vite.lib.config.ts",
|
|
9
|
-
"preview": "vite preview"
|
|
10
|
-
},
|
|
11
|
-
"main": "./dist-lib/sophontalk-services.es.js",
|
|
12
|
-
"module": "./dist-lib/sophontalk-services.es.js",
|
|
13
|
-
"types": "./dist-lib/types/services/index.d.ts",
|
|
14
|
-
"files": [
|
|
15
|
-
"dist-lib"
|
|
16
|
-
],
|
|
17
|
-
"exports": {
|
|
18
|
-
".": {
|
|
19
|
-
"types": "./dist-lib/types/services/index.d.ts",
|
|
20
|
-
"import": "./dist-lib/sophontalk-services.es.js"
|
|
21
|
-
},
|
|
22
|
-
"./workers/inference.worker": {
|
|
23
|
-
"types": "./dist-lib/types/inference.worker.d.ts",
|
|
24
|
-
"import": "./dist-lib/workers/inference.worker.js"
|
|
25
|
-
},
|
|
26
|
-
"./workers/feature.worker": {
|
|
27
|
-
"types": "./dist-lib/types/feature.worker.d.ts",
|
|
28
|
-
"import": "./dist-lib/workers/feature.worker.js"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@alexanderolsen/libsamplerate-js": "^2.1.2",
|
|
33
|
-
"@vunk/
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"vue
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "sophontalk-services",
|
|
3
|
+
"version": "0.0.12",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vue-tsc -b && vite build",
|
|
8
|
+
"build:lib": "vite build --config vite.lib.config.ts",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist-lib/sophontalk-services.es.js",
|
|
12
|
+
"module": "./dist-lib/sophontalk-services.es.js",
|
|
13
|
+
"types": "./dist-lib/types/services/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist-lib"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist-lib/types/services/index.d.ts",
|
|
20
|
+
"import": "./dist-lib/sophontalk-services.es.js"
|
|
21
|
+
},
|
|
22
|
+
"./workers/inference.worker": {
|
|
23
|
+
"types": "./dist-lib/types/inference.worker.d.ts",
|
|
24
|
+
"import": "./dist-lib/workers/inference.worker.js"
|
|
25
|
+
},
|
|
26
|
+
"./workers/feature.worker": {
|
|
27
|
+
"types": "./dist-lib/types/feature.worker.d.ts",
|
|
28
|
+
"import": "./dist-lib/workers/feature.worker.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@alexanderolsen/libsamplerate-js": "^2.1.2",
|
|
33
|
+
"@vunk/core": "^1.6.7",
|
|
34
|
+
"@vunk/plus": "1.10.3",
|
|
35
|
+
"@vunk/shared": "^0.9.1",
|
|
36
|
+
"fft.js": "^4.0.4",
|
|
37
|
+
"jszip": "^3.10.1",
|
|
38
|
+
"mitt": "^3.0.1",
|
|
39
|
+
"onnxruntime-web": "^1.22.0",
|
|
40
|
+
"pixi.js": "^8.14.3",
|
|
41
|
+
"vue": "^3.5.17",
|
|
42
|
+
"vue-router": "^4.4.5"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
46
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
47
|
+
"@vue/tsconfig": "^0.7.0",
|
|
48
|
+
"typescript": "~5.8.3",
|
|
49
|
+
"vite": "^7.0.2",
|
|
50
|
+
"vite-plugin-dts": "^4.5.4",
|
|
51
|
+
"vite-plugin-static-copy": "^3.1.0",
|
|
52
|
+
"vue-tsc": "^3.0.1"
|
|
53
|
+
}
|
|
54
|
+
}
|