Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main]
branches: [main, staging]
pull_request:
branches: [main]
branches: [main, staging]

jobs:
test:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
migrations:
name: Apply Database Migrations
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
needs: test
steps:
- name: Checkout code
Expand All @@ -73,5 +73,5 @@ jobs:
- name: Apply migrations
working-directory: ./apps/sim
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }}
run: bunx drizzle-kit push
20 changes: 14 additions & 6 deletions apps/sim/app/api/proxy/tts/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +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 @@ -44,12 +46,18 @@ export async function POST(request: Request) {
return new NextResponse('Empty audio received', { status: 422 })
}

return new NextResponse(audioBlob, {
headers: {
'Content-Type': 'audio/mpeg',
'Cache-Control': 'public, max-age=86400', // Cache for a day
'Access-Control-Allow-Origin': '*', // CORS support
},
// Upload the audio file to storage and return multiple URL options
const audioBuffer = Buffer.from(await audioBlob.arrayBuffer())
const timestamp = Date.now()
const fileName = `elevenlabs-tts-${timestamp}.mp3`
const fileInfo = await uploadFile(audioBuffer, fileName, 'audio/mpeg')

// Generate the full URL for external use using the configured base URL
const audioUrl = `${getBaseUrl()}${fileInfo.path}`

return NextResponse.json({
audioUrl,
size: fileInfo.size,
})
} catch (error) {
logger.error('Error proxying TTS:', error)
Expand Down
10 changes: 5 additions & 5 deletions apps/sim/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3014,11 +3014,11 @@ export const AzureIcon = (props: SVGProps<SVGSVGElement>) => (
y2='11.8734'
gradientUnits='userSpaceOnUse'
>
<stop stop-opacity='0.3' />
<stop offset='0.0711768' stop-opacity='0.2' />
<stop offset='0.321031' stop-opacity='0.1' />
<stop offset='0.623053' stop-opacity='0.05' />
<stop offset='1' stop-opacity='0' />
<stop stopOpacity='0.3' />
<stop offset='0.0711768' stopOpacity='0.2' />
<stop offset='0.321031' stopOpacity='0.1' />
<stop offset='0.623053' stopOpacity='0.05' />
<stop offset='1' stopOpacity='0' />
</linearGradient>
<linearGradient
id='paint2_linear_6102_134469'
Expand Down
6 changes: 2 additions & 4 deletions apps/sim/tools/elevenlabs/tts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ export const elevenLabsTtsTool: ToolConfig<ElevenLabsTtsParams, ElevenLabsTtsRes
throw new Error(`ElevenLabs API error: ${response.status} ${response.statusText}`)
}

// Create a blob URL that can be used in an audio player
const audioBlob = await response.blob()
const audioUrl = URL.createObjectURL(audioBlob)
const data = await response.json()

return {
success: true,
output: {
audioUrl,
audioUrl: data.audioUrl,
},
}
},
Expand Down