mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Add more clear error messages to TTS
This commit is contained in:
		| @@ -127,14 +127,14 @@ class EdgeTtsProvider { | |||||||
|             } |             } | ||||||
|         ) |         ) | ||||||
|         if (!response.ok) { |         if (!response.ok) { | ||||||
|             throw new Error(`HTTP ${response.status}: ${await response.json()}`) |             toastr.error(response.statusText); | ||||||
|  |             throw new Error(`HTTP ${response.status}`) | ||||||
|         } |         } | ||||||
|         return response |         return response | ||||||
|     } |     } | ||||||
| } | } | ||||||
| function throwIfModuleMissing() { | function throwIfModuleMissing() { | ||||||
|     if (!modules.includes('edge-tts')) { |     if (!modules.includes('edge-tts')) { | ||||||
|  |  | ||||||
|         toastr.error(`Edge TTS module not loaded. Add edge-tts to enable-modules and restart the Extras API.`) |         toastr.error(`Edge TTS module not loaded. Add edge-tts to enable-modules and restart the Extras API.`) | ||||||
|         throw new Error(`Edge TTS module not loaded.`) |         throw new Error(`Edge TTS module not loaded.`) | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -414,6 +414,7 @@ async function processTtsQueue() { | |||||||
|         const voice = await ttsProvider.getVoice((voiceMap[char])) |         const voice = await ttsProvider.getVoice((voiceMap[char])) | ||||||
|         const voiceId = voice.voice_id |         const voiceId = voice.voice_id | ||||||
|         if (voiceId == null) { |         if (voiceId == null) { | ||||||
|  |             toastr.error(`Specified voice for ${char} was not found. Check the TTS extension settings.`) | ||||||
|             throw `Unable to attain voiceId for ${char}` |             throw `Unable to attain voiceId for ${char}` | ||||||
|         } |         } | ||||||
|         tts(text, voiceId) |         tts(text, voiceId) | ||||||
| @@ -494,7 +495,6 @@ async function voicemapIsValid(parsedVoiceMap) { | |||||||
|  |  | ||||||
| async function updateVoiceMap() { | async function updateVoiceMap() { | ||||||
|     let isValidResult = false |     let isValidResult = false | ||||||
|     const context = getContext() |  | ||||||
|  |  | ||||||
|     const value = $('#tts_voice_map').val() |     const value = $('#tts_voice_map').val() | ||||||
|     const parsedVoiceMap = parseVoiceMap(value) |     const parsedVoiceMap = parseVoiceMap(value) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user