@@ -39,6 +39,8 @@ export const useTtsStore = defineStore("ttsStore", {
39
39
speechKey : store . get ( "speechKey" ) ,
40
40
serviceRegion : store . get ( "serviceRegion" ) ,
41
41
disclaimers : store . get ( "disclaimers" ) ,
42
+ retryCount : store . get ( "retryCount" ) ,
43
+ retryInterval : store . get ( "retryInterval" ) ,
42
44
} ,
43
45
isLoading : false ,
44
46
currMp3Buffer : Buffer . alloc ( 0 ) ,
@@ -95,10 +97,16 @@ export const useTtsStore = defineStore("ttsStore", {
95
97
store . set ( "autoplay" , this . config . autoplay ) ;
96
98
} ,
97
99
setSpeechKey ( ) {
98
- store . set ( "speechKey" , this . config . speechKey ) ;
100
+ store . set ( "speechKey" , this . config . speechKey ) ;
99
101
} ,
100
102
setServiceRegion ( ) {
101
- store . set ( "serviceRegion" , this . config . serviceRegion ) ;
103
+ store . set ( "serviceRegion" , this . config . serviceRegion ) ;
104
+ } ,
105
+ setRetryCount ( ) {
106
+ store . set ( "retryCount" , parseInt ( this . config . retryCount ) ) ;
107
+ } ,
108
+ setRetryInterval ( ) {
109
+ store . set ( "retryInterval" , parseInt ( this . config . retryInterval ) ) ;
102
110
} ,
103
111
addFormConfig ( ) {
104
112
this . config . formConfigJson [ this . currConfigName ] = this . formConfig ;
@@ -134,8 +142,12 @@ export const useTtsStore = defineStore("ttsStore", {
134
142
? this . inputs . inputValue
135
143
: this . inputs . ssmlValue ,
136
144
} ;
137
- if ( this . page . tabIndex == "1" && this . formConfig . api == 1 && this . inputs . inputValue . length > 400 ) {
138
- const delimiters = ",。?,.?" . split ( "" ) ;
145
+ if (
146
+ this . page . tabIndex == "1" &&
147
+ this . formConfig . api == 1 &&
148
+ this . inputs . inputValue . length > 400
149
+ ) {
150
+ const delimiters = [ "," , "。" , "?" , "," , "." , "?" , "\n" ] ;
139
151
const maxSize = 300 ;
140
152
ipcRenderer . send ( "log.info" , "字数过多,正在对文本切片。。。" ) ;
141
153
@@ -177,7 +189,8 @@ export const useTtsStore = defineStore("ttsStore", {
177
189
( this . formConfig . pitch - 1 ) * 50 ,
178
190
this . formConfig . api ,
179
191
this . config . speechKey ,
180
- this . config . serviceRegion
192
+ this . config . serviceRegion ,
193
+ this . config . retryCount ,
181
194
) ;
182
195
this . currMp3Buffer = Buffer . concat ( [ this . currMp3Buffer , buffers ] ) ;
183
196
ipcRenderer . send (
@@ -220,7 +233,8 @@ export const useTtsStore = defineStore("ttsStore", {
220
233
( this . formConfig . pitch - 1 ) * 50 ,
221
234
this . formConfig . api ,
222
235
this . config . speechKey ,
223
- this . config . serviceRegion
236
+ this . config . serviceRegion ,
237
+ this . config . retryCount ,
224
238
)
225
239
. then ( ( mp3buffer : any ) => {
226
240
this . currMp3Buffer = mp3buffer ;
@@ -318,7 +332,8 @@ export const useTtsStore = defineStore("ttsStore", {
318
332
( this . formConfig . pitch - 1 ) * 50 ,
319
333
this . formConfig . api ,
320
334
this . config . speechKey ,
321
- this . config . serviceRegion
335
+ this . config . serviceRegion ,
336
+ this . config . retryCount ,
322
337
) ;
323
338
buffer = Buffer . concat ( [ buffer , buffers ] ) ;
324
339
ipcRenderer . send (
@@ -365,7 +380,8 @@ export const useTtsStore = defineStore("ttsStore", {
365
380
( this . formConfig . pitch - 1 ) * 50 ,
366
381
this . formConfig . api ,
367
382
this . config . speechKey ,
368
- this . config . serviceRegion
383
+ this . config . serviceRegion ,
384
+ this . config . retryCount ,
369
385
)
370
386
. then ( ( mp3buffer : any ) => {
371
387
fs . writeFileSync ( filePath , mp3buffer ) ;
@@ -430,7 +446,8 @@ export const useTtsStore = defineStore("ttsStore", {
430
446
( this . formConfig . pitch - 1 ) * 50 ,
431
447
this . formConfig . api ,
432
448
this . config . speechKey ,
433
- this . config . serviceRegion
449
+ this . config . serviceRegion ,
450
+ this . config . retryCount ,
434
451
)
435
452
. then ( ( mp3buffer : any ) => {
436
453
this . currMp3Buffer = mp3buffer ;
@@ -448,16 +465,16 @@ export const useTtsStore = defineStore("ttsStore", {
448
465
showDisclaimers ( ) {
449
466
if ( ! this . config . disclaimers ) {
450
467
ElMessageBox . confirm (
451
- ' 该软件以及代码仅为个人学习测试使用,请在下载后24小时内删除,不得用于商业用途,否则后果自负。任何违规使用造成的法律后果与本人无关。该软件也永远不会收费,如果您使用该软件前支付了额外费用,或付费获得源码以及成品软件,那么你一定被骗了!' ,
452
- ' 注意!' ,
468
+ " 该软件以及代码仅为个人学习测试使用,请在下载后24小时内删除,不得用于商业用途,否则后果自负。任何违规使用造成的法律后果与本人无关。该软件也永远不会收费,如果您使用该软件前支付了额外费用,或付费获得源码以及成品软件,那么你一定被骗了!" ,
469
+ " 注意!" ,
453
470
{
454
- confirmButtonText : ' 我已确认,不再弹出' ,
455
- cancelButtonText : '取消' ,
456
- type : ' warning' ,
471
+ confirmButtonText : " 我已确认,不再弹出" ,
472
+ cancelButtonText : "取消" ,
473
+ type : " warning"
457
474
}
458
475
) . then ( ( ) => {
459
- store . set ( ' disclaimers' , true )
460
- } )
476
+ store . set ( " disclaimers" , true ) ;
477
+ } ) ;
461
478
}
462
479
}
463
480
} ,
0 commit comments