alltalk.js resolve V1 URL duplication in AllTalk TTS audio output Fix URL concatenation issue where base URL was being duplicated in audio file paths. Updated handling of V1 (full URL) and V2 (relative path) API response formats to prevent `http://localhost:7851http://127.0.0.1:7851` type errors.

2318df8b748f450644ddb45a059c5806fd27fb92

erew123 <35898566+erew123@users.noreply.github.com>

Signed
1 files changed, +12 -8Ignore whitespace
public/scripts/extensions/tts/alltalk.js+12 -8
@@ -262,13 +262,13 @@ class AllTalkTtsProvider {
262 console.debug('AllTalkTTS: Settings loaded');262 console.debug('AllTalkTTS: Settings loaded');
263 try {263 try {
264 // Check if TTS provider is ready264 // Check if TTS provider is ready
265 this.setupEventListeners();
266 this.updateLanguageDropdown();
267 await this.checkReady();265 await this.checkReady();
268 await this.updateSettingsFromServer(); // Fetch dynamic settings from the TTS server266 await this.updateSettingsFromServer(); // Fetch dynamic settings from the TTS server
269 await this.fetchTtsVoiceObjects(); // Fetch voices only if service is ready267 await this.fetchTtsVoiceObjects(); // Fetch voices only if service is ready
270 await this.fetchRvcVoiceObjects(); // Fetch RVC voices268 await this.fetchRvcVoiceObjects(); // Fetch RVC voices
271 this.updateNarratorVoicesDropdown();269 this.updateNarratorVoicesDropdown();
270 this.updateLanguageDropdown();
271 this.setupEventListeners();
272 this.applySettingsToHTML();272 this.applySettingsToHTML();
273 updateStatus('Ready');273 updateStatus('Ready');
274 } catch (error) {274 } catch (error) {
@@ -388,7 +388,7 @@ class AllTalkTtsProvider {
388 }388 }
389389
390 async fetchRvcVoiceObjects() {390 async fetchRvcVoiceObjects() {
391 if (this.settings.server_version == 'v2') {391 if (this.settings.server_version !== 'v1') {
392 console.log('Skipping RVC voices fetch for V1 server');392 console.log('Skipping RVC voices fetch for V1 server');
393 return [];393 return [];
394 }394 }
@@ -1031,14 +1031,18 @@ class AllTalkTtsProvider {
1031 console.error('fetchTtsGeneration Error Response Text:', errorText);1031 console.error('fetchTtsGeneration Error Response Text:', errorText);
1032 throw new Error(`HTTP ${response.status}: ${errorText}`);1032 throw new Error(`HTTP ${response.status}: ${errorText}`);
1033 }1033 }
1034
1034 const data = await response.json();1035 const data = await response.json();
10351036
1036 // Handle V1/V2 URL differences1037 // V1 returns a complete URL, V2 returns a relative path
1037 const outputUrl = this.settings.server_version === 'v1'1038 if (this.settings.server_version === 'v1') {
1038 ? data.output_file_url // V1 returns full URL1039 // V1: Use the complete URL directly from the response
1039 : `${this.settings.provider_endpoint}${data.output_file_url}`; // V2 returns relative path1040 return data.output_file_url;
1041 } else {
1042 // V2: Combine the endpoint with the relative path
1043 return `${this.settings.provider_endpoint}${data.output_file_url}`;
1044 }
10401045
1041 return outputUrl;
1042 } catch (error) {1046 } catch (error) {
1043 console.error('[fetchTtsGeneration] Exception caught:', error);1047 console.error('[fetchTtsGeneration] Exception caught:', error);
1044 throw error;1048 throw error;