add alert

This commit is contained in:
2023-12-29 22:47:06 +08:00
parent 1eabe1d300
commit 5c52ae5ab2
2 changed files with 8 additions and 1 deletions

View File

@@ -276,6 +276,9 @@ function speakFromAPI(text: string) {
.replace(/^(?:https?:\/\/)/, '')
.replace(/\{\{\s*text\s*\}\}/, encodeURIComponent(text))}`
const tempURL = new URL(url)
if (isVtsuruVoiceAPI.value) {
tempURL.searchParams.set('vtsuruId', accountInfo.value?.id.toString() ?? '-1')
}
if (isVtsuruVoiceAPI.value && splitter.countGraphemes(tempURL.searchParams.get('text') ?? '') > 50) {
message.error('本站提供的测试接口字数不允许超过 100 字. 内容: [' + tempURL.searchParams.get('text') + ']')
cancelSpeech()