@vunk/plus 1.10.2 → 1.11.0
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/components/WebGLRenderer.mjs +1 -1
- package/components/WebGPURenderer.mjs +1 -1
- package/components/broadcasting-markdown/index.mjs +21 -9
- package/components/broadcasting-markdown/src/ctx.d.ts +7 -0
- package/components/broadcasting-markdown/src/index.vue.d.ts +55 -46
- package/components/browserAll.mjs +1 -1
- package/components/index2.mjs +127 -69
- package/components/metahuman-broadcasting/index.d.ts +0 -1
- package/components/metahuman-broadcasting/index.mjs +58 -68
- package/components/metahuman-broadcasting/src/ctx.d.ts +4 -0
- package/components/metahuman-broadcasting/src/index.vue.d.ts +144 -167
- package/components/pixi-frame/index.d.ts +4 -1
- package/components/pixi-frame/index.mjs +2 -2
- package/components/pixi-frame/src/bitmap-generator.vue.d.ts +146 -0
- package/components/pixi-frame/src/bitmap.vue.d.ts +4 -5
- package/components/pixi-frame/src/index.vue.d.ts +4 -5
- package/components/webworkerAll.mjs +1 -1
- package/package.json +4 -20
- package/shared/data/blobToAudioBuffer.d.ts +1 -0
- package/shared/data/imgUrlToBitmap.d.ts +1 -0
- package/shared/data/index.d.ts +2 -0
- package/shared/data/index.mjs +25 -0
- package/shared/StreamingInferenceService.mjs +0 -204
- package/shared/audioToFrames/index.d.ts +0 -19
- package/shared/audioToFrames/index.mjs +0 -44
- package/shared/audioToFrames/src/assets/mask.d.ts +0 -2
- package/shared/audioToFrames/src/audio/StreamingFeatureExtractorService.d.ts +0 -125
- package/shared/audioToFrames/src/audio/index.d.ts +0 -5
- package/shared/audioToFrames/src/audio/index.mjs +0 -375
- package/shared/audioToFrames/src/config.d.ts +0 -4
- package/shared/audioToFrames/src/core/constants.d.ts +0 -17
- package/shared/audioToFrames/src/core/index.d.ts +0 -6
- package/shared/audioToFrames/src/core/index.mjs +0 -24
- package/shared/audioToFrames/src/core/utils.d.ts +0 -26
- package/shared/audioToFrames/src/inference/StreamingInferenceService.d.ts +0 -189
- package/shared/audioToFrames/src/inference/index.d.ts +0 -5
- package/shared/audioToFrames/src/inference/index.mjs +0 -3
- package/shared/audioToFrames/src/media/DataLoaderService.d.ts +0 -59
- package/shared/audioToFrames/src/media/PredictiveFrameLoader.d.ts +0 -81
- package/shared/audioToFrames/src/media/index.d.ts +0 -6
- package/shared/audioToFrames/src/media/index.mjs +0 -236
- package/shared/config.mjs +0 -5
- package/shared/constants.mjs +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, onMounted, openBlock, createElementBlock, Fragment, createVNode, mergeProps, withCtx, renderSlot } from 'vue';
|
|
2
2
|
import { VkBroadcastingMarkdown } from '@vunk/plus/components/broadcasting-markdown';
|
|
3
|
-
import { VkPixiFrameBitmap,
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { useDeferred, useModelComputed } from '@vunk/core/composables';
|
|
3
|
+
import { VkPixiFrameBitmap, VkPixiFrameBitmapGenerator } from '@vunk/plus/components/pixi-frame';
|
|
4
|
+
import { blobToAudioBuffer } from '@vunk/plus/shared/data';
|
|
5
|
+
import { useModelComputed } from '@vunk/core/composables';
|
|
7
6
|
import { setData } from '@vunk/core/shared';
|
|
8
7
|
import { TickerStatus } from '@vunk/shared/enum';
|
|
8
|
+
import { FeatureExtractor, InferenceEngine, loadDataset } from 'sophontalk-services';
|
|
9
9
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
10
10
|
|
|
11
11
|
const props = {
|
|
@@ -58,6 +58,10 @@ const props = {
|
|
|
58
58
|
playAfterCache: {
|
|
59
59
|
type: Number,
|
|
60
60
|
default: 100
|
|
61
|
+
},
|
|
62
|
+
disabled: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
const emits = {
|
|
@@ -77,58 +81,47 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
77
81
|
const props = __props;
|
|
78
82
|
const emit = __emit;
|
|
79
83
|
const paragraphData = ref([]);
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
const extractor = new FeatureExtractor();
|
|
85
|
+
const engine = new InferenceEngine({
|
|
86
|
+
onFrame,
|
|
87
|
+
onError(error) {
|
|
88
|
+
console.error("Inference engine error:", error);
|
|
89
|
+
},
|
|
90
|
+
onProgress
|
|
91
|
+
});
|
|
92
|
+
const silentFrameGenerator = engine.createSilentFrameGenerator();
|
|
93
|
+
const slientFrameStatus = ref(TickerStatus.pending);
|
|
94
|
+
const frames = ref([]);
|
|
84
95
|
const frameStatus = useModelComputed({
|
|
85
96
|
default: TickerStatus.pending,
|
|
86
97
|
key: "status"
|
|
87
98
|
}, props, emit);
|
|
88
|
-
const slientFrameStatus = ref(TickerStatus.pending);
|
|
89
99
|
onMounted(async () => {
|
|
90
|
-
await
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
sourceUrl: props.sourceUrl
|
|
100
|
+
const { dataset, zipBuffer } = await loadDataset({
|
|
101
|
+
jsonUrl: props.datasetUrl,
|
|
102
|
+
zipUrl: props.sourceUrl
|
|
94
103
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
blendingMaskBitmap,
|
|
104
|
+
engine.init({
|
|
105
|
+
modelPath: props.modelUrl,
|
|
98
106
|
dataset,
|
|
99
|
-
|
|
100
|
-
}, {
|
|
101
|
-
onFrame(frame) {
|
|
102
|
-
frameUrls.value.push(frame);
|
|
103
|
-
},
|
|
104
|
-
onProgress(processed, total) {
|
|
105
|
-
if (total < props.playAfterCache && processed === total || processed === props.playAfterCache) {
|
|
106
|
-
frameStatus.value = TickerStatus.play;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
107
|
+
zipBuffer
|
|
109
108
|
});
|
|
110
|
-
|
|
109
|
+
await engine.when();
|
|
110
|
+
slientFrameStatus.value = TickerStatus.play;
|
|
111
111
|
});
|
|
112
|
-
async function requestProcessStreaming(buffer) {
|
|
113
|
-
await streamingInferenceService.when();
|
|
114
|
-
await startedDef.promise;
|
|
115
|
-
try {
|
|
116
|
-
await processStreaming(buffer, {
|
|
117
|
-
onChunkComplete(result) {
|
|
118
|
-
streamingInferenceService.addChunk(result);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
} catch (error) {
|
|
122
|
-
console.error("\u97F3\u9891\u5904\u7406\u9519\u8BEF:", error);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
112
|
async function processingParagraph(item) {
|
|
126
113
|
if (!item.blob) {
|
|
127
114
|
return;
|
|
128
115
|
}
|
|
129
116
|
try {
|
|
130
117
|
const audioBuffer = await blobToAudioBuffer(item.blob);
|
|
131
|
-
await
|
|
118
|
+
const { dimensions, features } = await extractor.process(audioBuffer);
|
|
119
|
+
await engine.when();
|
|
120
|
+
engine.run({
|
|
121
|
+
audioFeatures: features,
|
|
122
|
+
audioDimensions: dimensions,
|
|
123
|
+
reset: false
|
|
124
|
+
});
|
|
132
125
|
} catch (error) {
|
|
133
126
|
console.error("Error processing paragraph:", error);
|
|
134
127
|
}
|
|
@@ -136,30 +129,23 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
136
129
|
function allParagraphCompleted() {
|
|
137
130
|
if (paragraphData.value.length) {
|
|
138
131
|
frameStatus.value = TickerStatus.stop;
|
|
139
|
-
|
|
132
|
+
frames.value.length = 0;
|
|
140
133
|
}
|
|
141
134
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const imageFile = zip.file(image.full_image);
|
|
146
|
-
if (imageFile) {
|
|
147
|
-
const blob = await imageFile.async("blob");
|
|
148
|
-
const url = URL.createObjectURL(blob);
|
|
149
|
-
silentFrameUrls.push(url);
|
|
150
|
-
}
|
|
151
|
-
if (slientFrameStatus.value === TickerStatus.pending) {
|
|
152
|
-
slientFrameStatus.value = TickerStatus.play;
|
|
153
|
-
}
|
|
135
|
+
function onProgress(processed, total) {
|
|
136
|
+
if (total < props.playAfterCache && processed === total || processed === props.playAfterCache) {
|
|
137
|
+
frameStatus.value = TickerStatus.play;
|
|
154
138
|
}
|
|
155
|
-
ready.value = true;
|
|
156
139
|
}
|
|
157
|
-
|
|
140
|
+
function onFrame(frame) {
|
|
141
|
+
frames.value.push(frame);
|
|
142
|
+
}
|
|
143
|
+
const __returned__ = { props, emit, paragraphData, extractor, engine, silentFrameGenerator, slientFrameStatus, frames, frameStatus, processingParagraph, allParagraphCompleted, onProgress, onFrame, get VkBroadcastingMarkdown() {
|
|
158
144
|
return VkBroadcastingMarkdown;
|
|
159
145
|
}, get VkPixiFrameBitmap() {
|
|
160
146
|
return VkPixiFrameBitmap;
|
|
161
|
-
}, get
|
|
162
|
-
return
|
|
147
|
+
}, get VkPixiFrameBitmapGenerator() {
|
|
148
|
+
return VkPixiFrameBitmapGenerator;
|
|
163
149
|
}, get setData() {
|
|
164
150
|
return setData;
|
|
165
151
|
}, get TickerStatus() {
|
|
@@ -181,24 +167,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
181
167
|
"text-to-speech": _ctx.textToSpeech,
|
|
182
168
|
source: _ctx.source,
|
|
183
169
|
processing: $setup.processingParagraph,
|
|
170
|
+
disabled: _ctx.disabled,
|
|
184
171
|
onSetData: _cache[0] || (_cache[0] = ($event) => $setup.setData($setup.paragraphData, $event)),
|
|
185
172
|
onComplete: $setup.allParagraphCompleted
|
|
186
|
-
}),
|
|
173
|
+
}), {
|
|
174
|
+
default: withCtx(({ paragraphs }) => [
|
|
175
|
+
renderSlot(_ctx.$slots, "default", { paragraphs })
|
|
176
|
+
]),
|
|
177
|
+
_: 3
|
|
178
|
+
/* FORWARDED */
|
|
179
|
+
}, 16, ["status", "data", "text-to-speech", "source", "disabled"]),
|
|
187
180
|
createVNode($setup["VkPixiFrameBitmap"], {
|
|
188
181
|
status: $setup.frameStatus,
|
|
189
182
|
"onUpdate:status": _cache[1] || (_cache[1] = ($event) => $setup.frameStatus = $event),
|
|
190
|
-
data: $setup.
|
|
191
|
-
onSetData: _cache[2] || (_cache[2] = ($event) => $setup.setData($setup.
|
|
183
|
+
data: $setup.frames,
|
|
184
|
+
onSetData: _cache[2] || (_cache[2] = ($event) => $setup.setData($setup.frames, $event))
|
|
192
185
|
}, null, 8, ["status", "data"]),
|
|
193
|
-
|
|
194
|
-
key: 0,
|
|
186
|
+
createVNode($setup["VkPixiFrameBitmapGenerator"], {
|
|
195
187
|
status: $setup.slientFrameStatus,
|
|
196
188
|
"onUpdate:status": _cache[3] || (_cache[3] = ($event) => $setup.slientFrameStatus = $event),
|
|
197
|
-
|
|
198
|
-
loop: true,
|
|
199
|
-
prerender: true,
|
|
189
|
+
generator: $setup.silentFrameGenerator,
|
|
200
190
|
visible: $setup.frameStatus !== $setup.TickerStatus.playing
|
|
201
|
-
}, null, 8, ["status", "
|
|
191
|
+
}, null, 8, ["status", "generator", "visible"])
|
|
202
192
|
],
|
|
203
193
|
64
|
|
204
194
|
/* STABLE_FRAGMENT */
|