From c57a14d6c77d4e6edf48037e6126635fe0c794d1 Mon Sep 17 00:00:00 2001 From: Pylogmon Date: Mon, 24 Jun 2024 00:18:40 +0800 Subject: [PATCH] fix: tts error --- src/window/Config/pages/History/index.jsx | 6 +++--- src/window/Translate/components/SourceArea/index.jsx | 4 ++-- src/window/Translate/components/TargetArea/index.jsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/window/Config/pages/History/index.jsx b/src/window/Config/pages/History/index.jsx index b1ff10f915..ca79b8f907 100644 --- a/src/window/Config/pages/History/index.jsx +++ b/src/window/Config/pages/History/index.jsx @@ -159,15 +159,15 @@ export default function History() { }) && ( - {item.service.startsWith('plugin') ? ( + {getServiceSouceType(item.service) === ServiceSourceType.PLUGIN ? ( ) : ( diff --git a/src/window/Translate/components/SourceArea/index.jsx b/src/window/Translate/components/SourceArea/index.jsx index ffd8807f87..4c4f1c7d26 100644 --- a/src/window/Translate/components/SourceArea/index.jsx +++ b/src/window/Translate/components/SourceArea/index.jsx @@ -224,8 +224,8 @@ export default function SourceArea(props) { }, [hideWindow]); useEffect(() => { - if (ttsServiceList && ttsServiceList[0].startsWith('plugin')) { - readTextFile(`plugins/tts/${ttsServiceList[0]}/info.json`, { + if (ttsServiceList && getServiceSouceType(ttsServiceList[0]) === ServiceSourceType.PLUGIN) { + readTextFile(`plugins/tts/${getServiceName(ttsServiceList[0])}/info.json`, { dir: BaseDirectory.AppConfig, }).then((infoStr) => { setTtsPluginInfo(JSON.parse(infoStr)); diff --git a/src/window/Translate/components/TargetArea/index.jsx b/src/window/Translate/components/TargetArea/index.jsx index 014bb915ff..68e54017f1 100644 --- a/src/window/Translate/components/TargetArea/index.jsx +++ b/src/window/Translate/components/TargetArea/index.jsx @@ -318,8 +318,8 @@ export default function TargetArea(props) { // refresh tts config useEffect(() => { - if (ttsServiceList && ttsServiceList[0].startsWith('plugin')) { - readTextFile(`plugins/tts/${ttsServiceList[0]}/info.json`, { + if (ttsServiceList && getServiceSouceType(ttsServiceList[0]) === ServiceSourceType.PLUGIN) { + readTextFile(`plugins/tts/${getServiceName(ttsServiceList[0])}/info.json`, { dir: BaseDirectory.AppConfig, }).then((infoStr) => { setTtsPluginInfo(JSON.parse(infoStr));