| 1031 | 1031 | console.error('fetchTtsGeneration Error Response Text:', errorText); |
| 1032 | 1032 | throw new Error(`HTTP ${response.status}: ${errorText}`); |
| 1033 | 1033 | } |
| 1034 | + |
| 1034 | 1035 | const data = await response.json(); |
| 1035 | 1036 | |
| 1036 | | - // Handle V1/V2 URL differences |
| 1037 | + // V1 returns a complete URL, V2 returns a relative path |
| 1037 | 1038 | 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 | + } |
| 1040 | 1045 | |
| 1041 | | - return outputUrl; |
| 1042 | 1046 | } catch (error) { |
| 1043 | 1047 | console.error('[fetchTtsGeneration] Exception caught:', error); |
| 1044 | 1048 | throw error; |