Skip to content

Commit 805b245

Browse files
v0.2.1: fix + chore (#585)
* fix: icon properties error * chore(ci): run ci on staging + migrations (#575) * fix: eleven labs deployment returning uploaded blob (#583) * fix(eleven-labs): fixed URL path (#584) * fix: eleven labs deployment returning uploaded blob * fix: added better URL pattern --------- Co-authored-by: Aditya Tripathi <[email protected]>
1 parent bf0ea10 commit 805b245

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, staging]
66
pull_request:
7-
branches: [main]
7+
branches: [main, staging]
88

99
jobs:
1010
test:
@@ -56,7 +56,7 @@ jobs:
5656
migrations:
5757
name: Apply Database Migrations
5858
runs-on: ubuntu-latest
59-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
59+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
6060
needs: test
6161
steps:
6262
- name: Checkout code
@@ -73,5 +73,5 @@ jobs:
7373
- name: Apply migrations
7474
working-directory: ./apps/sim
7575
env:
76-
DATABASE_URL: ${{ secrets.DATABASE_URL }}
76+
DATABASE_URL: ${{ github.ref == 'refs/heads/main' && secrets.DATABASE_URL || secrets.STAGING_DATABASE_URL }}
7777
run: bunx drizzle-kit push

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

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

46
const logger = createLogger('ProxyTTSAPI')
57

@@ -44,12 +46,18 @@ export async function POST(request: Request) {
4446
return new NextResponse('Empty audio received', { status: 422 })
4547
}
4648

47-
return new NextResponse(audioBlob, {
48-
headers: {
49-
'Content-Type': 'audio/mpeg',
50-
'Cache-Control': 'public, max-age=86400', // Cache for a day
51-
'Access-Control-Allow-Origin': '*', // CORS support
52-
},
49+
// Upload the audio file to storage and return multiple URL options
50+
const audioBuffer = Buffer.from(await audioBlob.arrayBuffer())
51+
const timestamp = Date.now()
52+
const fileName = `elevenlabs-tts-${timestamp}.mp3`
53+
const fileInfo = await uploadFile(audioBuffer, fileName, 'audio/mpeg')
54+
55+
// Generate the full URL for external use using the configured base URL
56+
const audioUrl = `${getBaseUrl()}${fileInfo.path}`
57+
58+
return NextResponse.json({
59+
audioUrl,
60+
size: fileInfo.size,
5361
})
5462
} catch (error) {
5563
logger.error('Error proxying TTS:', error)

apps/sim/components/icons.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,11 +3014,11 @@ export const AzureIcon = (props: SVGProps<SVGSVGElement>) => (
30143014
y2='11.8734'
30153015
gradientUnits='userSpaceOnUse'
30163016
>
3017-
<stop stop-opacity='0.3' />
3018-
<stop offset='0.0711768' stop-opacity='0.2' />
3019-
<stop offset='0.321031' stop-opacity='0.1' />
3020-
<stop offset='0.623053' stop-opacity='0.05' />
3021-
<stop offset='1' stop-opacity='0' />
3017+
<stop stopOpacity='0.3' />
3018+
<stop offset='0.0711768' stopOpacity='0.2' />
3019+
<stop offset='0.321031' stopOpacity='0.1' />
3020+
<stop offset='0.623053' stopOpacity='0.05' />
3021+
<stop offset='1' stopOpacity='0' />
30223022
</linearGradient>
30233023
<linearGradient
30243024
id='paint2_linear_6102_134469'

apps/sim/tools/elevenlabs/tts.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ export const elevenLabsTtsTool: ToolConfig<ElevenLabsTtsParams, ElevenLabsTtsRes
5555
throw new Error(`ElevenLabs API error: ${response.status} ${response.statusText}`)
5656
}
5757

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

6260
return {
6361
success: true,
6462
output: {
65-
audioUrl,
63+
audioUrl: data.audioUrl,
6664
},
6765
}
6866
},

0 commit comments

Comments
 (0)