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 {
262262 console.debug('AllTalkTTS: Settings loaded');
263263 try {
264264 // Check if TTS provider is ready
265- this.setupEventListeners();
266- this.updateLanguageDropdown();
267265 await this.checkReady();
268266 await this.updateSettingsFromServer(); // Fetch dynamic settings from the TTS server
269267 await this.fetchTtsVoiceObjects(); // Fetch voices only if service is ready
270268 await this.fetchRvcVoiceObjects(); // Fetch RVC voices
271269 this.updateNarratorVoicesDropdown();
270+ this.updateLanguageDropdown();
271+ this.setupEventListeners();
272272 this.applySettingsToHTML();
273273 updateStatus('Ready');
274274 } catch (error) {
@@ -388,7 +388,7 @@ class AllTalkTtsProvider {
388388 }
389389
390390 async fetchRvcVoiceObjects() {
391391 if (this.settings.server_version !== 'v2v1') {
392392 console.log('Skipping RVC voices fetch for V1 server');
393393 return [];
394394 }
@@ -1031,14 +1031,18 @@ class AllTalkTtsProvider {
10311031 console.error('fetchTtsGeneration Error Response Text:', errorText);
10321032 throw new Error(`HTTP ${response.status}: ${errorText}`);
10331033 }
1034+
10341035 const data = await response.json();
10351036
1036- // Handle V1/V2 URL differences
1037+ // V1 returns a complete URL, V2 returns a relative path
10371038 const outputUrl =if (this.settings.server_version === 'v1') {
1038- ? data.output_file_url // V1 returns full URL
1039+ // V1: Use the complete URL directly from the response
1039- : `${this.settings.provider_endpoint}${data.output_file_url}`; // V2 returns relative path
1040+ 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;
10421046 } catch (error) {
10431047 console.error('[fetchTtsGeneration] Exception caught:', error);
10441048 throw error;