mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
fix: add optional chaining for safe access to voice_text_str in ASR response
This commit is contained in:
1 parent
3f0a1bd433
commit
62835bb042
1 file changed
+1
-1
@@ -39,7 +39,7 @@ async function startAsr(buffer) {
|
|||||||
ws.onmessage = (event) => {
|
ws.onmessage = (event) => {
|
||||||
const { code, result } = JSON.parse(event.data);
|
const { code, result } = JSON.parse(event.data);
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
art.plugins.artplayerPluginAsr.append(result.voice_text_str);
|
art.plugins.artplayerPluginAsr.append(result?.voice_text_str);
|
||||||
} else {
|
} else {
|
||||||
stopAsr();
|
stopAsr();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user