Skip to content

Commit ba672c2

Browse files
committed
fix(site): use cloudflare:workers env directly in hybrid-fallback API
1 parent fbf8fbf commit ba672c2

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎apps/site/src/pages/api/ai/hybrid-fallback.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function sanitizeEmDashes(input: string): string {
2929
return input.replace(/[\u2014\u2013]/g, ", ");
3030
}
3131

32-
export const POST: APIRoute = async ({ request, locals }) => {
32+
export const POST: APIRoute = async ({ request }) => {
3333
const t0 = performance.now();
3434
try {
3535
const body = (await request
@@ -64,10 +64,7 @@ export const POST: APIRoute = async ({ request, locals }) => {
6464
: DEFAULT_SYSTEM_BY_TASK[task];
6565

6666
const cfEnv =
67-
(locals as { runtime?: { env?: Record<string, unknown> } })?.runtime
68-
?.env ||
69-
(env as unknown as Record<string, unknown>) ||
70-
{};
67+
(env as unknown as Record<string, unknown> | undefined) || {};
7168

7269
const openRouterApiKey =
7370
(cfEnv.OPENROUTER_API_KEY as string | undefined) ||

0 commit comments

Comments
 (0)