Skip to content

Commit a19415f

Browse files
committed
fix(llm): update router and llm_chat tool to call providers routes
1 parent bcf6dc8 commit a19415f

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

apps/sim/executor/handlers/evaluator/evaluator-handler.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { createLogger } from '@sim/logger'
44
import { eq } from 'drizzle-orm'
55
import { refreshTokenIfNeeded } from '@/app/api/auth/oauth/utils'
66
import type { BlockOutput } from '@/blocks/types'
7-
import { BlockType, DEFAULTS, EVALUATOR, HTTP } from '@/executor/constants'
7+
import { BlockType, DEFAULTS, EVALUATOR } from '@/executor/constants'
88
import type { BlockHandler, ExecutionContext } from '@/executor/types'
9-
import { buildAPIUrl, extractAPIErrorMessage } from '@/executor/utils/http'
9+
import { buildAPIUrl, buildAuthHeaders, extractAPIErrorMessage } from '@/executor/utils/http'
1010
import { isJSONString, parseJSON, stringifyJSON } from '@/executor/utils/json'
1111
import { validateModelProvider } from '@/executor/utils/permission-check'
1212
import { calculateCost, getProviderFromModel } from '@/providers/utils'
@@ -143,9 +143,7 @@ export class EvaluatorBlockHandler implements BlockHandler {
143143

144144
const response = await fetch(url.toString(), {
145145
method: 'POST',
146-
headers: {
147-
'Content-Type': HTTP.CONTENT_TYPE.JSON,
148-
},
146+
headers: await buildAuthHeaders(),
149147
body: stringifyJSON(providerRequest),
150148
})
151149

apps/sim/executor/handlers/router/router-handler.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import type { BlockOutput } from '@/blocks/types'
99
import {
1010
BlockType,
1111
DEFAULTS,
12-
HTTP,
1312
isAgentBlockType,
1413
isRouterV2BlockType,
1514
ROUTER,
1615
} from '@/executor/constants'
1716
import type { BlockHandler, ExecutionContext } from '@/executor/types'
17+
import { buildAuthHeaders } from '@/executor/utils/http'
1818
import { validateModelProvider } from '@/executor/utils/permission-check'
1919
import { calculateCost, getProviderFromModel } from '@/providers/utils'
2020
import type { SerializedBlock } from '@/serializer/types'
@@ -118,9 +118,7 @@ export class RouterBlockHandler implements BlockHandler {
118118

119119
const response = await fetch(url.toString(), {
120120
method: 'POST',
121-
headers: {
122-
'Content-Type': HTTP.CONTENT_TYPE.JSON,
123-
},
121+
headers: await buildAuthHeaders(),
124122
body: JSON.stringify(providerRequest),
125123
})
126124

@@ -277,9 +275,7 @@ export class RouterBlockHandler implements BlockHandler {
277275

278276
const response = await fetch(url.toString(), {
279277
method: 'POST',
280-
headers: {
281-
'Content-Type': HTTP.CONTENT_TYPE.JSON,
282-
},
278+
headers: await buildAuthHeaders(),
283279
body: JSON.stringify(providerRequest),
284280
})
285281

0 commit comments

Comments
 (0)