Skip to content

Commit aaf2866

Browse files
author
liugaowei
committed
细节设置
1 parent 5b24ea5 commit aaf2866

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/components/configpage/ConfigPage.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<el-input
1919
type="number"
2020
v-model="config.retryCount"
21+
min="1"
2122
size="small"
2223
class="input-path"
2324
@change="setRetryCount"
@@ -27,6 +28,7 @@
2728
<el-input
2829
type="number"
2930
v-model="config.retryInterval"
31+
min="0"
3032
size="small"
3133
class="input-path"
3234
@change="setRetryInterval"
@@ -38,7 +40,6 @@
3840
size="small"
3941
class="input-path"
4042
@change="setSpeechKey"
41-
password
4243
/>
4344
</el-form-item>
4445
<el-form-item label="ServiceRegion">
@@ -47,6 +48,7 @@
4748
size="small"
4849
class="input-path"
4950
@change="setServiceRegion"
51+
placeholder="请填写ServiceRegion,如:westus"
5052
/>
5153
</el-form-item>
5254
<el-form-item label="自动播放">
@@ -262,6 +264,9 @@ const setServiceRegion = () => {
262264
};
263265
264266
const setRetryCount = () => {
267+
if (config.value.retryCount == '' || config.value.retryCount < 0) {
268+
config.value.retryCount = 1;
269+
}
265270
ttsStore.setRetryCount();
266271
ElMessage({
267272
message: "保存成功,请点击“刷新配置”立即应用。。",
@@ -271,6 +276,9 @@ const setRetryCount = () => {
271276
};
272277
273278
const setRetryInterval = () => {
279+
if (config.value.retryInterval== '' || config.value.retryInterval < 0) {
280+
config.value.retryInterval = 0;
281+
}
274282
ttsStore.setRetryInterval();
275283
ElMessage({
276284
message: "保存成功,请点击“刷新配置”立即应用。。",
@@ -300,7 +308,7 @@ const setRetryInterval = () => {
300308
border-right: 1px solid #dcdfe6;
301309
width: calc(100% - 395px);
302310
padding-left: 10px;
303-
overflow-x: scroll;
311+
overflow-x: hidden;
304312
}
305313
:deep(.input-path .el-input-group__append) {
306314
display: inline-flex;

src/store/play.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ async function getTTSData(
1515
retryCount: number,
1616
retryInterval = 1,
1717
) {
18+
// 判断retryCount是否为0或者null,如果是则不重试
19+
if (!retryCount) {
20+
retryCount = 1;
21+
}
22+
if (!retryInterval) {
23+
retryInterval = 1;
24+
}
1825
let SSML = "";
1926
if (inps.activeIndex == "1" && (api == 1 || api == 3)) {
2027
SSML = `
@@ -62,7 +69,7 @@ async function retrySpeechInvocation(SSML: string, retryCount: number, delay: nu
6269
let retry = 0;
6370
while (retry < retryCount) {
6471
try {
65-
console.log("Speech invocation attempt", retry + 1);
72+
console.log("语音调用尝试:", retry + 1);
6673
const result = await ipcRenderer.invoke("speech", SSML);
6774
return result; // 执行成功,返回结果
6875
} catch (error) {
@@ -71,7 +78,7 @@ async function retrySpeechInvocation(SSML: string, retryCount: number, delay: nu
7178
}
7279
retry++;
7380
}
74-
throw new Error(`Speech invocation failed after ${retryCount} retries`); // 重试次数用尽,抛出异常
81+
throw new Error(`${retryCount} 次重试后仍转换失败。`); // 重试次数用尽,抛出异常
7582
}
7683
function sleep(ms: number) {
7784
return new Promise(resolve => setTimeout(resolve, ms));

0 commit comments

Comments
 (0)