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.
@@ -1,66 +1,66 @@
1
- import { env as g } from "onnxruntime-web";
2
- const p = 16e3, v = 25, k = 10, P = 80, b = 4, N = 0.97, L = 1e-10, y = 20, C = !0, R = !0, w = 25, D = 1e3 / w, h = {
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
- }, F = (s) => {
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
- }, B = (s, e, t) => {
10
+ }, G = (s, e, r) => {
11
11
  if (e <= 1) return { nextIndex: 0, nextDirection: 1 };
12
- let r = s + t, n = t;
13
- return r >= e ? (r = e - 2, n = -1) : r < 0 && (r = 1, n = 1), { nextIndex: r, nextDirection: n };
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 G(s = {}) {
15
+ async function I(s = {}) {
16
16
  const {
17
17
  jsonUrl: e = h.jsonUrl,
18
- zipUrl: t = h.zipUrl
19
- } = s, [r, n] = await Promise.all([
18
+ zipUrl: r = h.zipUrl
19
+ } = s, [t, n] = await Promise.all([
20
20
  fetch(e),
21
- fetch(t)
21
+ fetch(r)
22
22
  ]);
23
- if (!r.ok) throw new Error(`无法加载 ${e}`);
24
- if (!n.ok) throw new Error(`无法加载 ${t}`);
25
- const o = await r.json(), c = await n.arrayBuffer();
26
- return { dataset: o, zipBuffer: c };
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 I {
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 t = e.getChannelData(0), r = e.numberOfChannels > 1 ? e.getChannelData(1) : void 0, n = {
38
- leftChannel: t,
39
- rightChannel: r,
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
- }, o = [t.buffer];
42
- return r && o.push(r.buffer), new Promise((c, u) => {
43
- const i = (a) => {
44
- a.data?.status === "success" ? (this.worker.removeEventListener("message", i), this.worker.removeEventListener("error", l), c(a.data.payload)) : a.data?.status === "error" && (this.worker.removeEventListener("message", i), this.worker.removeEventListener("error", l), u(new Error(a.data.error || "特征提取失败")));
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", i), this.worker.removeEventListener("error", l), u(a);
46
+ this.worker.removeEventListener("message", o), this.worker.removeEventListener("error", l), u(a);
47
47
  };
48
- this.worker.addEventListener("message", i), this.worker.addEventListener("error", l), this.worker.postMessage(n, o);
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 E = "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=";
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, t) => {
59
- this.resolve = e, this.reject = t;
58
+ this.promise = new Promise((e, r) => {
59
+ this.resolve = e, this.reject = r;
60
60
  });
61
61
  }
62
62
  }
63
- class m {
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, t) {
73
+ handleMessage(e, r) {
74
74
  if (e !== "silent-frame") return !1;
75
- const r = t?.frame;
76
- if (!r) return !0;
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(r);
79
+ this.pending = null, n.resolve(t);
80
80
  } else
81
- r.close?.();
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 t = e?.signal, r = () => {
90
+ const r = e?.signal, t = () => {
91
91
  this.cancel();
92
92
  };
93
- t?.addEventListener("abort", r);
93
+ r?.addEventListener("abort", t);
94
94
  try {
95
- for (; !t?.aborted; ) {
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
- t?.removeEventListener("abort", r);
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
- class Q {
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 m(this.worker), this.worker.onmessage = this.handleMessage.bind(this);
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: t, payload: r } = e.data;
126
- if (!this.silentPull.handleMessage(t, r))
127
- switch (t) {
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?.(r.totalFrames);
155
+ this.handlers.onStart?.(t.totalFrames), this.emitter.emit("start", t.totalFrames);
133
156
  break;
134
157
  case "frame":
135
- this.handlers.onFrame?.(r.frame, r.index);
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?.(r.processed, r.total);
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?.(r);
167
+ this.handlers.onError?.(t), this.emitter.emit("error", t);
145
168
  break;
146
169
  }
147
170
  }
148
171
  init(e) {
149
- const t = new d();
172
+ const r = new d();
150
173
  if (e.blendingMask instanceof ImageBitmap)
151
- t.resolve(e.blendingMask);
174
+ r.resolve(e.blendingMask);
152
175
  else {
153
- const r = new Image();
154
- r.src = e.blendingMask || E, r.decode().then(() => createImageBitmap(r)).then((n) => {
155
- t.resolve(n);
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
- t.promise.then((r) => {
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: r,
166
- wasmPaths: e.wasmPaths || g.wasm.wasmPaths
188
+ blendingMask: t,
189
+ wasmPaths: e.wasmPaths || m.wasm.wasmPaths
167
190
  },
168
- [e.zipBuffer, r]
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: e.audioFeatures,
208
+ audioFeatures: r,
180
209
  audioDimensions: e.audioDimensions,
181
210
  reset: e.reset !== !1
182
211
  },
183
- [e.audioFeatures.buffer]
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
- y as DEFAULT_LOW_FREQ,
226
+ C as DEFAULT_LOW_FREQ,
198
227
  L as ENERGY_FLOOR,
199
228
  D as FRAME_INTERVAL_MS,
200
- v as FRAME_LENGTH_MS,
201
- k as FRAME_SHIFT_MS,
202
- I as FeatureExtractor,
203
- Q as InferenceEngine,
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
- b as NUM_SEQUENCE_FRAMES,
206
- N as PREEMPH_COEFF,
207
- C as REMOVE_DC_OFFSET,
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
- p as SAMPLE_RATE,
210
- w as TARGET_FPS,
211
- B as calculatePingPongState,
238
+ v as SAMPLE_RATE,
239
+ g as TARGET_FPS,
240
+ G as calculatePingPongState,
212
241
  h as env,
213
- F as getBorder,
214
- G as loadDataset
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,3 @@
1
+ import { default as VkMetahumanBroadcasting } from './src/index.vue';
2
+ export { VkMetahumanBroadcasting, };
3
+ export default VkMetahumanBroadcasting;
@@ -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.10",
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/shared": "^0.9.1",
34
- "fft.js": "^4.0.4",
35
- "jszip": "^3.10.1",
36
- "onnxruntime-web": "^1.22.0",
37
- "vue": "^3.5.17"
38
- },
39
- "devDependencies": {
40
- "@rollup/plugin-replace": "^6.0.3",
41
- "@vitejs/plugin-vue": "^6.0.0",
42
- "@vue/tsconfig": "^0.7.0",
43
- "typescript": "~5.8.3",
44
- "vite": "^7.0.2",
45
- "vite-plugin-dts": "^4.5.4",
46
- "vite-plugin-static-copy": "^3.1.0",
47
- "vue-tsc": "^3.0.1"
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
+ }