Skip to content

Commit abae75f

Browse files
committed
fix(providers): add workspace membership check and remove shared fetch cache for fireworks models
1 parent 4affc19 commit abae75f

File tree

1 file changed

+8
-4
lines changed
  • apps/sim/app/api/providers/fireworks/models

1 file changed

+8
-4
lines changed

apps/sim/app/api/providers/fireworks/models/route.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type NextRequest, NextResponse } from 'next/server'
33
import { getBYOKKey } from '@/lib/api-key/byok'
44
import { getSession } from '@/lib/auth'
55
import { env } from '@/lib/core/config/env'
6+
import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils'
67
import { filterBlacklistedModels, isProviderBlacklisted } from '@/providers/utils'
78

89
const logger = createLogger('FireworksModelsAPI')
@@ -31,9 +32,12 @@ export async function GET(request: NextRequest) {
3132
if (workspaceId) {
3233
const session = await getSession()
3334
if (session?.user?.id) {
34-
const byokResult = await getBYOKKey(workspaceId, 'fireworks')
35-
if (byokResult) {
36-
apiKey = byokResult.apiKey
35+
const permission = await getUserEntityPermissions(session.user.id, 'workspace', workspaceId)
36+
if (permission) {
37+
const byokResult = await getBYOKKey(workspaceId, 'fireworks')
38+
if (byokResult) {
39+
apiKey = byokResult.apiKey
40+
}
3741
}
3842
}
3943
}
@@ -53,7 +57,7 @@ export async function GET(request: NextRequest) {
5357
Authorization: `Bearer ${apiKey}`,
5458
'Content-Type': 'application/json',
5559
},
56-
next: { revalidate: 300 },
60+
cache: 'no-store',
5761
})
5862

5963
if (!response.ok) {

0 commit comments

Comments
 (0)