@inupedia/spotlight-vue 0.8.5 → 0.9.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/dist/assets/spotlight-vue.css +1 -1
- package/dist/avatar/speech/live2dTtsPlayback.d.ts +15 -2
- package/dist/avatar/speech/live2dTtsPlayback.d.ts.map +1 -1
- package/dist/avatar/speech/live2dTtsPlayback.js +77 -15
- package/dist/avatar/speech/spotlightSpeech.d.ts.map +1 -1
- package/dist/avatar/speech/spotlightSpeech.js +44 -36
- package/dist/avatar/spine/live2dApp.d.ts +3 -0
- package/dist/avatar/spine/live2dApp.d.ts.map +1 -1
- package/dist/avatar/spine/live2dApp.js +30 -18
- package/dist/avatar/spine/spineAvatar.d.ts +4 -0
- package/dist/avatar/spine/spineAvatar.d.ts.map +1 -1
- package/dist/avatar/spine/spineAvatar.js +114 -83
- package/dist/avatar/spine/spineLipSync.d.ts +1 -0
- package/dist/avatar/spine/spineLipSync.d.ts.map +1 -1
- package/dist/avatar/spine/spineLipSync.js +41 -36
- package/dist/avatar/voice/avatarDirector.d.ts +8 -0
- package/dist/avatar/voice/avatarDirector.d.ts.map +1 -0
- package/dist/avatar/voice/avatarDirector.js +6 -0
- package/dist/avatar/voice/config.d.ts +5 -0
- package/dist/avatar/voice/config.d.ts.map +1 -0
- package/dist/avatar/voice/config.js +5 -0
- package/dist/avatar/voice/panelHidePolicy.d.ts +6 -0
- package/dist/avatar/voice/panelHidePolicy.d.ts.map +1 -0
- package/dist/avatar/voice/panelHidePolicy.js +6 -0
- package/dist/avatar/voice/voiceSession.d.ts +5 -0
- package/dist/avatar/voice/voiceSession.d.ts.map +1 -0
- package/dist/avatar/voice/voiceSession.js +14 -0
- package/dist/components/Live2dPanel.vue.d.ts.map +1 -1
- package/dist/components/Live2dPanel.vue.js +2 -2
- package/dist/components/Live2dPanel2.vue.js +31 -27
- package/dist/components/SpotlightShell.vue.d.ts.map +1 -1
- package/dist/components/SpotlightShell.vue.js +5 -2
- package/dist/components/SpotlightShell2.vue.js +289 -222
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -22
- package/dist/mountShell.d.ts.map +1 -1
- package/dist/mountShell.js +13 -10
- package/dist/plugin.js +1 -1
- package/dist/remote/audio.d.ts.map +1 -1
- package/dist/remote/audio.js +19 -18
- package/dist/remote/runPipeline.d.ts +10 -3
- package/dist/remote/runPipeline.d.ts.map +1 -1
- package/dist/remote/runPipeline.js +120 -111
- package/dist/store/live2dSpeechStore.d.ts +2 -2
- package/dist/store/memoryPreferenceStore.d.ts +1 -1
- package/dist/store/pipeline/constants.d.ts +2 -0
- package/dist/store/pipeline/constants.d.ts.map +1 -1
- package/dist/store/pipeline/constants.js +2 -0
- package/dist/store/runtime/types.d.ts +1 -1
- package/dist/store/runtime/types.d.ts.map +1 -1
- package/dist/store/spotlightStore.d.ts +11 -13
- package/dist/store/spotlightStore.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/avatar/speech/live2dBriefingSummarizer.js +0 -91
- package/dist/avatar/speech/live2dStreamSpeech.js +0 -4
- package/dist/avatar/speech/llmUtils.js +0 -18
|
@@ -1,100 +1,131 @@
|
|
|
1
|
-
import { Application as
|
|
2
|
-
import { Spine as
|
|
3
|
-
import { buildWavEnvelope as
|
|
4
|
-
import { resolveAvatarSkeletonUrl as
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
let
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
let
|
|
15
|
-
function
|
|
16
|
-
if (!
|
|
17
|
-
const i =
|
|
18
|
-
if (!
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function C() {
|
|
23
|
-
if (!t || !c || !s || s.ended) return;
|
|
24
|
-
const e = s.currentTime * 1e3, n = E(c, e);
|
|
25
|
-
H(_, O(n));
|
|
1
|
+
import { Application as _, Assets as E } from "pixi.js";
|
|
2
|
+
import { Spine as C } from "@pixi-spine/all-3.8";
|
|
3
|
+
import { buildWavEnvelope as D, envelopeLevelAt as H, mouthAttachmentForLevel as M, MOUTH_SLOT as b } from "./spineLipSync.js";
|
|
4
|
+
import { resolveAvatarSkeletonUrl as z } from "../config.js";
|
|
5
|
+
const h = "idle", v = "hello", k = "mouth_smile";
|
|
6
|
+
let I;
|
|
7
|
+
function V(t) {
|
|
8
|
+
I = t;
|
|
9
|
+
}
|
|
10
|
+
let S = !1, p = null;
|
|
11
|
+
function O() {
|
|
12
|
+
p != null && (window.clearTimeout(p), p = null);
|
|
13
|
+
}
|
|
14
|
+
let o = null, e = null, a = null, A = null, w = !1, f = !1, c = null, d = null, r = null, u = null;
|
|
15
|
+
function U(t, n) {
|
|
16
|
+
if (!e) return;
|
|
17
|
+
const i = e.skeleton, l = i.findSlot(t);
|
|
18
|
+
if (!l) return;
|
|
19
|
+
const s = i.getAttachment(l.data.index, n);
|
|
20
|
+
l.setAttachment(s ?? null);
|
|
26
21
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
22
|
+
function N() {
|
|
23
|
+
if (!e) return;
|
|
24
|
+
if (r) {
|
|
25
|
+
const i = new Uint8Array(r.fftSize);
|
|
26
|
+
r.getByteTimeDomainData(i);
|
|
27
|
+
let l = 0;
|
|
28
|
+
for (const y of i) {
|
|
29
|
+
const m = (y - 128) / 128;
|
|
30
|
+
l += m * m;
|
|
31
|
+
}
|
|
32
|
+
const s = Math.min(1, Math.sqrt(l / i.length) * 4);
|
|
33
|
+
U(b, M(s));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!c || !d) return;
|
|
37
|
+
const t = d(), n = H(c, t);
|
|
38
|
+
U(b, M(n));
|
|
39
|
+
}
|
|
40
|
+
function T() {
|
|
41
|
+
e?.state.hasAnimation(k) && e.state.setAnimation(1, k, !0);
|
|
29
42
|
}
|
|
30
43
|
function L() {
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function
|
|
37
|
-
if (!
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const n =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
e && e.state.setEmptyAnimation(1, 0);
|
|
45
|
+
}
|
|
46
|
+
function R() {
|
|
47
|
+
e && (e.state.hasAnimation(h) && e.state.setAnimation(0, h, !0), T());
|
|
48
|
+
}
|
|
49
|
+
function X() {
|
|
50
|
+
if (!e?.state.hasAnimation(v) || S) return;
|
|
51
|
+
O(), S = !0;
|
|
52
|
+
const t = e.state;
|
|
53
|
+
t.setAnimation(0, v, !1), t.hasAnimation(h) && t.addAnimation(0, h, !0, 0), f ? L() : T(), e.update(0);
|
|
54
|
+
const n = t.data.skeletonData.findAnimation(v), i = n ? (n.duration + 0.15) * 1e3 : 2500;
|
|
55
|
+
p = window.setTimeout(() => {
|
|
56
|
+
S = !1, p = null;
|
|
44
57
|
}, i);
|
|
45
58
|
}
|
|
46
|
-
function N() {
|
|
47
|
-
if (!t || A) return;
|
|
48
|
-
const e = t.update.bind(t);
|
|
49
|
-
t.update = (n) => {
|
|
50
|
-
e(n), !(!m || !c || !s) && (C(), e(0));
|
|
51
|
-
}, A = !0;
|
|
52
|
-
}
|
|
53
|
-
const R = "shuidi_17";
|
|
54
59
|
function W() {
|
|
55
|
-
if (!
|
|
56
|
-
const
|
|
57
|
-
e
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
60
|
+
if (!e || w) return;
|
|
61
|
+
const t = e.update.bind(e);
|
|
62
|
+
e.update = (n) => {
|
|
63
|
+
t(n), f && (!r && (!c || !d) || (N(), t(0)));
|
|
64
|
+
}, w = !0;
|
|
65
|
+
}
|
|
66
|
+
const B = "shuidi_17";
|
|
67
|
+
function G() {
|
|
68
|
+
if (!e) return;
|
|
69
|
+
const t = e.skeleton.findSlot(B);
|
|
70
|
+
t && t.setAttachment(null);
|
|
71
|
+
}
|
|
72
|
+
function x() {
|
|
73
|
+
if (!e || !a) return;
|
|
74
|
+
const { clientWidth: t, clientHeight: n } = a;
|
|
75
|
+
if (t <= 0 || n <= 0) return;
|
|
76
|
+
e.scale.set(1), e.position.set(0, 0), e.update(0);
|
|
77
|
+
const i = e.getLocalBounds();
|
|
65
78
|
if (i.width <= 0 || i.height <= 0) return;
|
|
66
|
-
const
|
|
67
|
-
|
|
79
|
+
const l = 0.9, s = Math.min(t * l / i.width, n * l / i.height), y = i.x + i.width / 2, m = i.y + i.height / 2;
|
|
80
|
+
e.scale.set(s), e.position.set(t / 2 - y * s, n / 2 - m * s);
|
|
68
81
|
}
|
|
69
|
-
async function
|
|
70
|
-
if (
|
|
71
|
-
|
|
82
|
+
async function Y() {
|
|
83
|
+
if (a = document.getElementById("live2d-container"), !a || o) return;
|
|
84
|
+
o = new _({
|
|
72
85
|
backgroundAlpha: 0,
|
|
73
86
|
antialias: !0,
|
|
74
|
-
resizeTo:
|
|
75
|
-
}),
|
|
76
|
-
const
|
|
77
|
-
|
|
87
|
+
resizeTo: a
|
|
88
|
+
}), a.appendChild(o.view);
|
|
89
|
+
const t = await E.load(z(I));
|
|
90
|
+
e = new C(t.spineData), e.autoUpdate = !0, W(), o.stage.addChild(e), G(), R(), e.update(0), x(), A = new ResizeObserver(() => x()), A.observe(a);
|
|
78
91
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
92
|
+
function Z() {
|
|
93
|
+
P(), O(), S = !1, A?.disconnect(), A = null, w = !1, e && o && (o.stage.removeChild(e), e.destroy({ children: !0 }), e = null), o && (o.destroy(!0, { children: !0, texture: !0, baseTexture: !0 }), o = null), a = null, E.reset();
|
|
81
94
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
95
|
+
function q(t, n) {
|
|
96
|
+
e && (g(), d = t, c = n, L(), f = !0, e.update(0));
|
|
97
|
+
}
|
|
98
|
+
function F(t, n) {
|
|
99
|
+
q(() => t.currentTime * 1e3, n);
|
|
100
|
+
}
|
|
101
|
+
function $(t) {
|
|
102
|
+
if (!e) return;
|
|
103
|
+
g(), d = null, c = null;
|
|
104
|
+
const n = new AudioContext(), i = n.createMediaStreamSource(t), l = n.createAnalyser();
|
|
105
|
+
l.fftSize = 1024, i.connect(l), u = n, r = l, n.resume(), L(), f = !0, e.update(0);
|
|
106
|
+
}
|
|
107
|
+
async function ee() {
|
|
108
|
+
u?.state === "suspended" && await u.resume();
|
|
109
|
+
}
|
|
110
|
+
function g() {
|
|
111
|
+
r = null, u && (u.close(), u = null);
|
|
84
112
|
}
|
|
85
|
-
async function
|
|
86
|
-
const i = await
|
|
87
|
-
|
|
113
|
+
async function te(t, n) {
|
|
114
|
+
const i = await D(n);
|
|
115
|
+
F(t, i);
|
|
88
116
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
117
|
+
function P() {
|
|
118
|
+
f = !1, c = null, d = null, g(), T(), e?.update(0);
|
|
91
119
|
}
|
|
92
120
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
q as
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
F as bindSpineLipSyncToAudio,
|
|
122
|
+
te as bindSpineLipSyncToAudioUrl,
|
|
123
|
+
q as bindSpineLipSyncToClock,
|
|
124
|
+
$ as bindSpineLipSyncToMediaStream,
|
|
125
|
+
V as configureSpineAvatar,
|
|
126
|
+
X as playSpineHello,
|
|
127
|
+
ee as resumeSpineLipSyncAudio,
|
|
128
|
+
Y as startSpineAvatar,
|
|
129
|
+
Z as stopSpineAvatar,
|
|
130
|
+
P as stopSpineLipSync
|
|
100
131
|
};
|
|
@@ -7,6 +7,7 @@ export type WavEnvelope = {
|
|
|
7
7
|
levels: number[];
|
|
8
8
|
};
|
|
9
9
|
export declare function buildWavEnvelope(wavUrl: string): Promise<WavEnvelope>;
|
|
10
|
+
export declare function wavEnvelopeFromAudioBuffer(audioBuffer: AudioBuffer): WavEnvelope;
|
|
10
11
|
export declare function buildWavEnvelopeFromBlob(blob: Blob): Promise<WavEnvelope>;
|
|
11
12
|
export declare function envelopeLevelAt(envelope: WavEnvelope, elapsedMs: number): number;
|
|
12
13
|
export declare function mouthAttachmentForLevel(level: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spineLipSync.d.ts","sourceRoot":"","sources":["../../../src/avatar/spine/spineLipSync.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,iBAAiB,2DAA4D,CAAC;AAI3F,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3E;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"spineLipSync.d.ts","sourceRoot":"","sources":["../../../src/avatar/spine/spineLipSync.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,iBAAiB,2DAA4D,CAAC;AAI3F,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAG3E;AAED,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAqBhF;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAS/E;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAKR;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7D"}
|
|
@@ -1,47 +1,52 @@
|
|
|
1
|
-
const
|
|
2
|
-
async function
|
|
3
|
-
const
|
|
4
|
-
return
|
|
1
|
+
const m = "shuidi_0", l = ["shuidi_3", "shuidi_2", "shuidi_1", "shuidi_0"];
|
|
2
|
+
async function _(t) {
|
|
3
|
+
const n = await fetch(t);
|
|
4
|
+
return d(await n.blob());
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const f = s[l];
|
|
15
|
-
h += f * f;
|
|
16
|
-
}
|
|
17
|
-
i.push(Math.sqrt(h / (u - o)));
|
|
6
|
+
function f(t) {
|
|
7
|
+
const n = t.getChannelData(0), e = t.sampleRate, a = Math.max(1, Math.floor(e * 50 / 1e3)), s = [];
|
|
8
|
+
for (let o = 0; o < n.length; o += a) {
|
|
9
|
+
const c = Math.min(o + a, n.length);
|
|
10
|
+
let r = 0;
|
|
11
|
+
for (let i = o; i < c; i += 1) {
|
|
12
|
+
const u = n[i];
|
|
13
|
+
r += u * u;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
s.push(Math.sqrt(r / (c - o)));
|
|
16
|
+
}
|
|
17
|
+
const h = Math.max(...s, 1e-4);
|
|
18
|
+
return {
|
|
19
|
+
durationMs: t.duration * 1e3,
|
|
20
|
+
levels: s.map((o) => Math.min(1, o / h))
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async function d(t) {
|
|
24
|
+
const n = await t.arrayBuffer(), e = new AudioContext();
|
|
25
|
+
try {
|
|
26
|
+
const a = await e.decodeAudioData(n.slice(0));
|
|
27
|
+
return f(a);
|
|
24
28
|
} finally {
|
|
25
|
-
|
|
29
|
+
e.close();
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
|
-
function
|
|
29
|
-
if (
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
+
function M(t, n) {
|
|
33
|
+
if (n < 0) return 0;
|
|
34
|
+
const e = Math.floor(n / 50);
|
|
35
|
+
return e >= t.levels.length ? 0 : t.levels[e] ?? 0;
|
|
32
36
|
}
|
|
33
37
|
function v(t) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
Math.floor(
|
|
38
|
+
const n = Math.max(0, Math.min(1, t)), e = Math.min(
|
|
39
|
+
l.length - 1,
|
|
40
|
+
Math.floor(n * l.length)
|
|
37
41
|
);
|
|
38
|
-
return
|
|
42
|
+
return l[e];
|
|
39
43
|
}
|
|
40
44
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
v as mouthAttachmentForLevel
|
|
45
|
+
l as MOUTH_OPEN_LEVELS,
|
|
46
|
+
m as MOUTH_SLOT,
|
|
47
|
+
_ as buildWavEnvelope,
|
|
48
|
+
d as buildWavEnvelopeFromBlob,
|
|
49
|
+
M as envelopeLevelAt,
|
|
50
|
+
v as mouthAttachmentForLevel,
|
|
51
|
+
f as wavEnvelopeFromAudioBuffer
|
|
47
52
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpotlightVoicePhase } from "@inupedia/spotlight-protocol";
|
|
2
|
+
export declare function directorPhaseFromTurn(input: {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
speaking: boolean;
|
|
5
|
+
toolRunning: boolean;
|
|
6
|
+
interrupted?: boolean;
|
|
7
|
+
}): SpotlightVoicePhase;
|
|
8
|
+
//# sourceMappingURL=avatarDirector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatarDirector.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/avatarDirector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,mBAAmB,CAMtB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InjectionKey } from "vue";
|
|
2
|
+
import type { SpotlightVoiceConfig } from "@inupedia/spotlight-protocol";
|
|
3
|
+
export declare const SPOTLIGHT_VOICE_CONFIG_KEY: InjectionKey<SpotlightVoiceConfig>;
|
|
4
|
+
export declare function useSpotlightVoiceConfig(): SpotlightVoiceConfig;
|
|
5
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,eAAO,MAAM,0BAA0B,EAAE,YAAY,CAAC,oBAAoB,CACxC,CAAC;AAEnC,wBAAgB,uBAAuB,IAAI,oBAAoB,CAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panelHidePolicy.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/panelHidePolicy.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAEV"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SpotlightVoiceConfig } from "@inupedia/spotlight-protocol";
|
|
2
|
+
export declare function unlockVoicePlayback(): Promise<void>;
|
|
3
|
+
export declare function describeMicrophoneError(error: unknown): string;
|
|
4
|
+
export declare function voiceConfigEnabled(config?: SpotlightVoiceConfig): boolean;
|
|
5
|
+
//# sourceMappingURL=voiceSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voiceSession.d.ts","sourceRoot":"","sources":["../../../src/avatar/voice/voiceSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAWzD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgB9D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAEzE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
async function e() {
|
|
2
|
+
const o = globalThis.AudioContext ?? globalThis.webkitAudioContext;
|
|
3
|
+
if (!o) return;
|
|
4
|
+
const t = new o();
|
|
5
|
+
try {
|
|
6
|
+
t.state === "suspended" && await t.resume();
|
|
7
|
+
} finally {
|
|
8
|
+
await t.close().catch(() => {
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
e as unlockVoicePlayback
|
|
14
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Live2dPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Live2dPanel.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Live2dPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/Live2dPanel.vue"],"names":[],"mappings":"AA6bA,KAAK,WAAW,GAAG;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AA8PJ,QAAA,MAAM,YAAY;;;;;;;;;mBAhQE,OAAO;gBACV,MAAM;6EAmQrB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Live2dPanel2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ca5091e3"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as x, ref as V, computed as k, watch as E, onMounted as A, onUnmounted as B, openBlock as p, createElementBlock as m, createElementVNode as
|
|
1
|
+
import { defineComponent as x, ref as V, computed as k, watch as E, onMounted as A, onUnmounted as B, openBlock as p, createElementBlock as m, createElementVNode as e, unref as o, normalizeClass as y, toDisplayString as c, createCommentVNode as L, createVNode as I, Transition as N, withCtx as z } from "vue";
|
|
2
2
|
import { storeToRefs as M } from "pinia";
|
|
3
3
|
import { startLive2dApp as P, stopLive2dApp as R } from "../avatar/spine/live2dApp.js";
|
|
4
4
|
import { configureSpineAvatar as U } from "../avatar/spine/spineAvatar.js";
|
|
@@ -17,32 +17,32 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
|
|
|
17
17
|
},
|
|
18
18
|
emits: ["voiceStart", "voiceStop", "close"],
|
|
19
19
|
setup(r, { emit: w }) {
|
|
20
|
-
const b = r, d = w, f = j(),
|
|
20
|
+
const b = r, d = w, f = j(), t = q(), g = $(), { message: h, speaking: C, revealInstant: D } = M(f), n = V("");
|
|
21
21
|
let s = null;
|
|
22
|
-
const T = k(() => C.value || h.value.trim().length > 0), S = k(() =>
|
|
22
|
+
const T = k(() => C.value || h.value.trim().length > 0), S = k(() => t.recording ? "点击发送" : t.transcribing ? "正在识别…" : b.voiceDisabled ? "Spotlight 忙碌中" : "点击说话");
|
|
23
23
|
function _(a) {
|
|
24
|
-
b.voiceDisabled ||
|
|
24
|
+
b.voiceDisabled || t.transcribing || (a.preventDefault(), t.recording ? d("voiceStop") : d("voiceStart"));
|
|
25
25
|
}
|
|
26
26
|
function v() {
|
|
27
27
|
s != null && (window.clearInterval(s), s = null);
|
|
28
28
|
}
|
|
29
29
|
return E(
|
|
30
30
|
() => [h.value, D.value],
|
|
31
|
-
([a,
|
|
31
|
+
([a, i]) => {
|
|
32
32
|
v();
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
33
|
+
const l = a.trim();
|
|
34
|
+
if (!l) {
|
|
35
35
|
n.value = "";
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
39
|
-
n.value =
|
|
38
|
+
if (i) {
|
|
39
|
+
n.value = l;
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
n.value = "";
|
|
43
43
|
let u = 0;
|
|
44
44
|
s = window.setInterval(() => {
|
|
45
|
-
u += 1, n.value =
|
|
45
|
+
u += 1, n.value = l.slice(0, u), u >= l.length && v();
|
|
46
46
|
}, 24);
|
|
47
47
|
},
|
|
48
48
|
{ immediate: !0 }
|
|
@@ -50,49 +50,53 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
|
|
|
50
50
|
U(g), await P();
|
|
51
51
|
}), B(() => {
|
|
52
52
|
v(), f.reset(), R();
|
|
53
|
-
}), (a,
|
|
54
|
-
|
|
53
|
+
}), (a, i) => (p(), m("div", F, [
|
|
54
|
+
i[3] || (i[3] = e("div", {
|
|
55
55
|
id: "live2d-container",
|
|
56
56
|
class: "live2d-panel",
|
|
57
57
|
"aria-label": "Live2D"
|
|
58
58
|
}, null, -1)),
|
|
59
|
-
|
|
59
|
+
e("button", {
|
|
60
60
|
type: "button",
|
|
61
61
|
class: "live2d-close",
|
|
62
62
|
"aria-label": "关闭数字人",
|
|
63
63
|
title: "关闭数字人(Ctrl/Command + L 可再次打开)",
|
|
64
|
-
onClick:
|
|
64
|
+
onClick: i[0] || (i[0] = (l) => d("close"))
|
|
65
65
|
}, " × "),
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
e("div", G, [
|
|
67
|
+
e("button", {
|
|
68
68
|
type: "button",
|
|
69
69
|
class: y(["live2d-voice-button", {
|
|
70
|
-
"is-recording":
|
|
71
|
-
"is-transcribing":
|
|
70
|
+
"is-recording": o(t).recording,
|
|
71
|
+
"is-transcribing": o(t).transcribing
|
|
72
72
|
}]),
|
|
73
|
-
disabled: r.voiceDisabled ||
|
|
73
|
+
disabled: r.voiceDisabled || o(t).transcribing,
|
|
74
74
|
"aria-label": S.value,
|
|
75
75
|
onClick: _
|
|
76
|
-
}, [...
|
|
77
|
-
|
|
76
|
+
}, [...i[1] || (i[1] = [
|
|
77
|
+
e("span", {
|
|
78
|
+
class: "live2d-voice-ring",
|
|
79
|
+
"aria-hidden": "true"
|
|
80
|
+
}, null, -1),
|
|
81
|
+
e("span", {
|
|
78
82
|
class: "live2d-mic-icon",
|
|
79
83
|
"aria-hidden": "true"
|
|
80
84
|
}, null, -1)
|
|
81
85
|
])], 10, H),
|
|
82
|
-
|
|
86
|
+
e("span", J, c(S.value), 1),
|
|
83
87
|
r.voiceError ? (p(), m("span", K, c(r.voiceError), 1)) : L("", !0)
|
|
84
88
|
]),
|
|
85
89
|
I(N, { name: "speech-bubble" }, {
|
|
86
90
|
default: z(() => [
|
|
87
91
|
T.value ? (p(), m("div", {
|
|
88
92
|
key: 0,
|
|
89
|
-
class: y(["live2d-speech-bubble", { "is-speaking":
|
|
93
|
+
class: y(["live2d-speech-bubble", { "is-speaking": o(C) }])
|
|
90
94
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
e("div", O, [
|
|
96
|
+
i[2] || (i[2] = e("span", { class: "live2d-speech-dot" }, null, -1)),
|
|
97
|
+
e("span", null, c(o(g).bubbleTitle ?? "数字人"), 1)
|
|
94
98
|
]),
|
|
95
|
-
|
|
99
|
+
e("p", Q, c(n.value), 1)
|
|
96
100
|
], 2)) : L("", !0)
|
|
97
101
|
]),
|
|
98
102
|
_: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotlightShell.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightShell.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpotlightShell.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightShell.vue"],"names":[],"mappings":"AA00BA,KAAK,WAAW,GAAG;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAqyB/C,QAAA,MAAM,YAAY;mBAryBmB,OAAO;6EAwyB1C,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./SpotlightShell2.vue.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-826535e7"]]);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
m as default
|
|
4
7
|
};
|