Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions apps/sim/app/api/proxy/tts/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NextResponse } from 'next/server'
import { createLogger } from '@/lib/logs/console-logger'
import { uploadFile } from '@/lib/uploads/storage-client'
import { getBaseUrl } from '@/lib/urls/utils'

const logger = createLogger('ProxyTTSAPI')

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

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

return NextResponse.json({
audioUrl,
Expand Down