Skip to content

Commit dd2ccdd

Browse files
committed
fix(eleven-labs): fixed URL path (#584)
* fix: eleven labs deployment returning uploaded blob * fix: added better URL pattern
1 parent 18c598a commit dd2ccdd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apps/sim/app/api/proxy/tts/route.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextResponse } from 'next/server'
22
import { createLogger } from '@/lib/logs/console-logger'
33
import { uploadFile } from '@/lib/uploads/storage-client'
4+
import { getBaseUrl } from '@/lib/urls/utils'
45

56
const logger = createLogger('ProxyTTSAPI')
67

@@ -51,10 +52,8 @@ export async function POST(request: Request) {
5152
const fileName = `elevenlabs-tts-${timestamp}.mp3`
5253
const fileInfo = await uploadFile(audioBuffer, fileName, 'audio/mpeg')
5354

54-
// Generate the full URL for external use
55-
const host = request.headers.get('host') || 'localhost:3000'
56-
const protocol = request.headers.get('x-forwarded-proto') || 'http'
57-
const audioUrl = `${protocol}://${host}${fileInfo.path}`
55+
// Generate the full URL for external use using the configured base URL
56+
const audioUrl = `${getBaseUrl()}${fileInfo.path}`
5857

5958
return NextResponse.json({
6059
audioUrl,

0 commit comments

Comments
 (0)