Fix voice clone: use absolute API URL for audio (not relative) so requests hit Render backend instead of Vercel SPA

This commit is contained in:
ajaysi
2026-04-22 15:00:54 +05:30
parent d7319c981e
commit fbbfe81ed7
3 changed files with 13 additions and 7 deletions

View File

@@ -43,7 +43,7 @@ import {
Category,
} from "@mui/icons-material";
import { getLatestVoiceClone, VoiceCloneResponse } from "../../api/brandAssets";
import { getAuthTokenGetter } from "../../api/client";
import { getAuthTokenGetter, getApiUrl } from "../../api/client";
import { VoiceAvatarPlaceholder } from "../OnboardingWizard/PersonalizationStep/components/VoiceAvatarPlaceholder";
export type VoiceOption = {
@@ -250,6 +250,10 @@ export const VoiceSelector: React.FC<VoiceSelectorProps> = ({
// Append auth token for endpoints that require it (e.g. /api/assets/)
let previewUrl = voice.previewUrl;
// Convert relative URLs to absolute (pointing to backend, not Vercel)
if (previewUrl.startsWith('/')) {
previewUrl = `${getApiUrl()}${previewUrl}`;
}
try {
const tokenGetter = getAuthTokenGetter();
if (tokenGetter) {