diff --git a/electron/utils/azure-api.ts b/electron/utils/azure-api.ts index b0890e6..53d68b7 100644 --- a/electron/utils/azure-api.ts +++ b/electron/utils/azure-api.ts @@ -1,7 +1,7 @@ import logger from "../utils/log"; +var sdk = require("microsoft-cognitiveservices-speech-sdk"); const azureApi = (ssml: string, key: string, region: string) => { - var sdk = require("microsoft-cognitiveservices-speech-sdk"); const speechConfig = sdk.SpeechConfig.fromSubscription(key, region); speechConfig.setProperty(sdk.PropertyId.SpeechServiceResponse_RequestSentenceBoundary, "true"); var audio_config = sdk.AudioConfig.fromDefaultSpeakerOutput(); diff --git a/src/components/configpage/ConfigPage.vue b/src/components/configpage/ConfigPage.vue index 5564606..578fd53 100644 --- a/src/components/configpage/ConfigPage.vue +++ b/src/components/configpage/ConfigPage.vue @@ -171,6 +171,14 @@ const openFolderSelector = async () => { } }; +const successMessage = () => { + ElMessage({ + message: "保存成功,请点击“刷新配置”立即应用。", + type: "success", + duration: 2000, + }); +}; + const handleDelete = (index: any, row: any) => { delete config.value.formConfigJson[row.tagName]; store.set("FormConfig", config.value.formConfigJson); @@ -202,65 +210,37 @@ const openLogFolder = () => { const savePathConfig = () => { ttsStore.setSavePath(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。", - type: "success", - duration: 2000, - }); + successMessage(); }; const auditionConfig = () => { ttsStore.setAuditionConfig(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。", - type: "success", - duration: 2000, - }); + successMessage(); }; const switchChange = () => { ttsStore.setAutoPlay(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const updateNotificationChange = () => { ttsStore.updateNotificationChange(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const updateTitleStyle = () => { ttsStore.updateTitleStyle(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const setSpeechKey = () => { ttsStore.setSpeechKey(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const setServiceRegion = () => { ttsStore.setServiceRegion(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const setRetryCount = () => { @@ -268,11 +248,7 @@ const setRetryCount = () => { config.value.retryCount = 1; } ttsStore.setRetryCount(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; const setRetryInterval = () => { @@ -280,11 +256,7 @@ const setRetryInterval = () => { config.value.retryInterval = 0; } ttsStore.setRetryInterval(); - ElMessage({ - message: "保存成功,请点击“刷新配置”立即应用。。", - type: "success", - duration: 2000, - }); + successMessage(); }; diff --git a/src/store/play.ts b/src/store/play.ts index 7b316c6..4a80a01 100644 --- a/src/store/play.ts +++ b/src/store/play.ts @@ -1,5 +1,3 @@ -const axios = require("axios"); - const { ipcRenderer } = require("electron"); async function getTTSData(