Skip to content

Commit a96437b

Browse files
committed
remove exa from byok
1 parent 47a259b commit a96437b

File tree

8 files changed

+28
-45
lines changed

8 files changed

+28
-45
lines changed

apps/sim/app/api/tools/search/route.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { type NextRequest, NextResponse } from 'next/server'
22
import { z } from 'zod'
3-
import { getBYOKKey } from '@/lib/api-key/byok'
43
import { checkHybridAuth } from '@/lib/auth/hybrid'
54
import { SEARCH_TOOL_COST } from '@/lib/billing/constants'
65
import { env } from '@/lib/core/config/env'
@@ -11,7 +10,6 @@ const logger = createLogger('search')
1110

1211
const SearchRequestSchema = z.object({
1312
query: z.string().min(1),
14-
workspaceId: z.string().optional(),
1513
})
1614

1715
export const maxDuration = 60
@@ -41,17 +39,7 @@ export async function POST(request: NextRequest) {
4139
const body = await request.json()
4240
const validated = SearchRequestSchema.parse(body)
4341

44-
let exaApiKey = env.EXA_API_KEY
45-
let isBYOK = false
46-
47-
if (validated.workspaceId) {
48-
const byokResult = await getBYOKKey(validated.workspaceId, 'exa')
49-
if (byokResult) {
50-
exaApiKey = byokResult.apiKey
51-
isBYOK = true
52-
logger.info(`[${requestId}] Using workspace BYOK key for Exa search`)
53-
}
54-
}
42+
const exaApiKey = env.EXA_API_KEY
5543

5644
if (!exaApiKey) {
5745
logger.error(`[${requestId}] No Exa API key available`)
@@ -64,7 +52,6 @@ export async function POST(request: NextRequest) {
6452
logger.info(`[${requestId}] Executing search`, {
6553
userId,
6654
query: validated.query,
67-
isBYOK,
6855
})
6956

7057
const result = await executeTool('exa_search', {
@@ -100,7 +87,7 @@ export async function POST(request: NextRequest) {
10087
const cost = {
10188
input: 0,
10289
output: 0,
103-
total: isBYOK ? 0 : SEARCH_TOOL_COST,
90+
total: SEARCH_TOOL_COST,
10491
tokens: {
10592
input: 0,
10693
output: 0,
@@ -119,7 +106,6 @@ export async function POST(request: NextRequest) {
119106
userId,
120107
resultCount: results.length,
121108
cost: cost.total,
122-
isBYOK,
123109
})
124110

125111
return NextResponse.json({

apps/sim/app/api/workspaces/[id]/byok-keys/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils'
1212

1313
const logger = createLogger('WorkspaceBYOKKeysAPI')
1414

15-
const VALID_PROVIDERS = ['openai', 'anthropic', 'google', 'mistral', 'exa'] as const
15+
const VALID_PROVIDERS = ['openai', 'anthropic', 'google', 'mistral'] as const
1616

1717
const UpsertKeySchema = z.object({
1818
providerId: z.enum(VALID_PROVIDERS),

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-auto-layout.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useCallback } from 'react'
2-
import { useReactFlow } from 'reactflow'
32
import { createLogger } from '@/lib/logs/console/logger'
43
import type { AutoLayoutOptions } from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/auto-layout-utils'
54
import { applyAutoLayoutAndUpdateStore as applyAutoLayoutStandalone } from '@/app/workspace/[workspaceId]/w/[workflowId]/utils/auto-layout-utils'
@@ -8,36 +7,45 @@ export type { AutoLayoutOptions }
87

98
const logger = createLogger('useAutoLayout')
109

10+
interface UseAutoLayoutOptions {
11+
fitView?: (options?: { padding?: number; duration?: number }) => void
12+
}
13+
1114
/**
12-
* Hook providing auto-layout functionality for workflows
13-
* Binds workflowId context and provides memoized callback for React components
14-
* Includes automatic fitView animation after successful layout
15+
* Hook providing auto-layout functionality for workflows.
16+
* Binds workflowId context and provides memoized callback for React components.
17+
* Optionally accepts a fitView function to animate after successful layout.
18+
*
19+
* @param workflowId - The workflow ID to apply layout to
20+
* @param options - Optional configuration including fitView function from useReactFlow
1521
*/
16-
export function useAutoLayout(workflowId: string | null) {
17-
const { fitView } = useReactFlow()
22+
export function useAutoLayout(workflowId: string | null, options: UseAutoLayoutOptions = {}) {
23+
const { fitView } = options
1824

1925
const applyAutoLayoutAndUpdateStore = useCallback(
20-
async (options: AutoLayoutOptions = {}) => {
26+
async (layoutOptions: AutoLayoutOptions = {}) => {
2127
if (!workflowId) {
2228
return { success: false, error: 'No workflow ID provided' }
2329
}
24-
return applyAutoLayoutStandalone(workflowId, options)
30+
return applyAutoLayoutStandalone(workflowId, layoutOptions)
2531
},
2632
[workflowId]
2733
)
2834

2935
/**
30-
* Applies auto-layout and animates to fit all blocks in view
36+
* Applies auto-layout and optionally animates to fit all blocks in view
3137
*/
3238
const handleAutoLayout = useCallback(async () => {
3339
try {
3440
const result = await applyAutoLayoutAndUpdateStore()
3541

3642
if (result.success) {
3743
logger.info('Auto layout completed successfully')
38-
requestAnimationFrame(() => {
39-
fitView({ padding: 0.8, duration: 600 })
40-
})
44+
if (fitView) {
45+
requestAnimationFrame(() => {
46+
fitView({ padding: 0.8, duration: 600 })
47+
})
48+
}
4149
} else {
4250
logger.error('Auto layout failed:', result.error)
4351
}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ const WorkflowContent = React.memo(() => {
198198
return resizeLoopNodes(updateNodeDimensions)
199199
}, [resizeLoopNodes, updateNodeDimensions])
200200

201-
const { handleAutoLayout: autoLayoutWithFitView } = useAutoLayout(activeWorkflowId || null)
201+
const { handleAutoLayout: autoLayoutWithFitView } = useAutoLayout(activeWorkflowId || null, {
202+
fitView,
203+
})
202204

203205
const isWorkflowEmpty = useMemo(() => Object.keys(blocks).length === 0, [blocks])
204206

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/byok/byok.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ModalHeader,
1414
Trash,
1515
} from '@/components/emcn'
16-
import { AnthropicIcon, ExaAIIcon, GeminiIcon, MistralIcon, OpenAIIcon } from '@/components/icons'
16+
import { AnthropicIcon, GeminiIcon, MistralIcon, OpenAIIcon } from '@/components/icons'
1717
import { Skeleton } from '@/components/ui'
1818
import { createLogger } from '@/lib/logs/console/logger'
1919
import {
@@ -61,13 +61,6 @@ const PROVIDERS: {
6161
description: 'LLM calls and Knowledge Base OCR',
6262
placeholder: 'Enter your API key',
6363
},
64-
{
65-
id: 'exa',
66-
name: 'Exa',
67-
icon: ExaAIIcon,
68-
description: 'Web Search block',
69-
placeholder: 'Enter your API key',
70-
},
7164
]
7265

7366
function BYOKKeySkeleton() {

apps/sim/hooks/queries/byok-keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { API_ENDPOINTS } from '@/stores/constants'
44

55
const logger = createLogger('BYOKKeysQueries')
66

7-
export type BYOKProviderId = 'openai' | 'anthropic' | 'google' | 'mistral' | 'exa'
7+
export type BYOKProviderId = 'openai' | 'anthropic' | 'google' | 'mistral'
88

99
export interface BYOKKey {
1010
id: string

apps/sim/tools/search/tool.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
2525
}),
2626
body: (params) => ({
2727
query: params.query,
28-
workspaceId: params._context?.workspaceId,
2928
}),
3029
},
3130

apps/sim/tools/search/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import type { ToolResponse } from '@/tools/types'
22

33
export interface SearchParams {
44
query: string
5-
_context?: {
6-
workflowId?: string
7-
workspaceId?: string
8-
executionId?: string
9-
}
105
}
116

127
export interface SearchResponse extends ToolResponse {

0 commit comments

Comments
 (0)