@@ -39,6 +39,8 @@ export const useTtsStore = defineStore("ttsStore", {
3939 speechKey : store . get ( "speechKey" ) ,
4040 serviceRegion : store . get ( "serviceRegion" ) ,
4141 disclaimers : store . get ( "disclaimers" ) ,
42+ retryCount : store . get ( "retryCount" ) ,
43+ retryInterval : store . get ( "retryInterval" ) ,
4244 } ,
4345 isLoading : false ,
4446 currMp3Buffer : Buffer . alloc ( 0 ) ,
@@ -95,10 +97,16 @@ export const useTtsStore = defineStore("ttsStore", {
9597 store . set ( "autoplay" , this . config . autoplay ) ;
9698 } ,
9799 setSpeechKey ( ) {
98- store . set ( "speechKey" , this . config . speechKey ) ;
100+ store . set ( "speechKey" , this . config . speechKey ) ;
99101 } ,
100102 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 ) ) ;
102110 } ,
103111 addFormConfig ( ) {
104112 this . config . formConfigJson [ this . currConfigName ] = this . formConfig ;
@@ -134,8 +142,12 @@ export const useTtsStore = defineStore("ttsStore", {
134142 ? this . inputs . inputValue
135143 : this . inputs . ssmlValue ,
136144 } ;
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" ] ;
139151 const maxSize = 300 ;
140152 ipcRenderer . send ( "log.info" , "字数过多,正在对文本切片。。。" ) ;
141153
@@ -177,7 +189,8 @@ export const useTtsStore = defineStore("ttsStore", {
177189 ( this . formConfig . pitch - 1 ) * 50 ,
178190 this . formConfig . api ,
179191 this . config . speechKey ,
180- this . config . serviceRegion
192+ this . config . serviceRegion ,
193+ this . config . retryCount ,
181194 ) ;
182195 this . currMp3Buffer = Buffer . concat ( [ this . currMp3Buffer , buffers ] ) ;
183196 ipcRenderer . send (
@@ -220,7 +233,8 @@ export const useTtsStore = defineStore("ttsStore", {
220233 ( this . formConfig . pitch - 1 ) * 50 ,
221234 this . formConfig . api ,
222235 this . config . speechKey ,
223- this . config . serviceRegion
236+ this . config . serviceRegion ,
237+ this . config . retryCount ,
224238 )
225239 . then ( ( mp3buffer : any ) => {
226240 this . currMp3Buffer = mp3buffer ;
@@ -318,7 +332,8 @@ export const useTtsStore = defineStore("ttsStore", {
318332 ( this . formConfig . pitch - 1 ) * 50 ,
319333 this . formConfig . api ,
320334 this . config . speechKey ,
321- this . config . serviceRegion
335+ this . config . serviceRegion ,
336+ this . config . retryCount ,
322337 ) ;
323338 buffer = Buffer . concat ( [ buffer , buffers ] ) ;
324339 ipcRenderer . send (
@@ -365,7 +380,8 @@ export const useTtsStore = defineStore("ttsStore", {
365380 ( this . formConfig . pitch - 1 ) * 50 ,
366381 this . formConfig . api ,
367382 this . config . speechKey ,
368- this . config . serviceRegion
383+ this . config . serviceRegion ,
384+ this . config . retryCount ,
369385 )
370386 . then ( ( mp3buffer : any ) => {
371387 fs . writeFileSync ( filePath , mp3buffer ) ;
@@ -430,7 +446,8 @@ export const useTtsStore = defineStore("ttsStore", {
430446 ( this . formConfig . pitch - 1 ) * 50 ,
431447 this . formConfig . api ,
432448 this . config . speechKey ,
433- this . config . serviceRegion
449+ this . config . serviceRegion ,
450+ this . config . retryCount ,
434451 )
435452 . then ( ( mp3buffer : any ) => {
436453 this . currMp3Buffer = mp3buffer ;
@@ -448,16 +465,16 @@ export const useTtsStore = defineStore("ttsStore", {
448465 showDisclaimers ( ) {
449466 if ( ! this . config . disclaimers ) {
450467 ElMessageBox . confirm (
451- ' 该软件以及代码仅为个人学习测试使用,请在下载后24小时内删除,不得用于商业用途,否则后果自负。任何违规使用造成的法律后果与本人无关。该软件也永远不会收费,如果您使用该软件前支付了额外费用,或付费获得源码以及成品软件,那么你一定被骗了!' ,
452- ' 注意!' ,
468+ " 该软件以及代码仅为个人学习测试使用,请在下载后24小时内删除,不得用于商业用途,否则后果自负。任何违规使用造成的法律后果与本人无关。该软件也永远不会收费,如果您使用该软件前支付了额外费用,或付费获得源码以及成品软件,那么你一定被骗了!" ,
469+ " 注意!" ,
453470 {
454- confirmButtonText : ' 我已确认,不再弹出' ,
455- cancelButtonText : '取消' ,
456- type : ' warning' ,
471+ confirmButtonText : " 我已确认,不再弹出" ,
472+ cancelButtonText : "取消" ,
473+ type : " warning"
457474 }
458475 ) . then ( ( ) => {
459- store . set ( ' disclaimers' , true )
460- } )
476+ store . set ( " disclaimers" , true ) ;
477+ } ) ;
461478 }
462479 }
463480 } ,
0 commit comments