mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 10:55:34 +00:00
fad41973e2
* fix: api-key manager cleanup and log error on llm call * log improved
17 lines
619 B
TypeScript
17 lines
619 B
TypeScript
import type { LoaderFunction } from '@remix-run/cloudflare';
|
|
import { providerBaseUrlEnvKeys } from '~/utils/constants';
|
|
|
|
export const loader: LoaderFunction = async ({ context, request }) => {
|
|
const url = new URL(request.url);
|
|
const provider = url.searchParams.get('provider');
|
|
|
|
if (!provider || !providerBaseUrlEnvKeys[provider].apiTokenKey) {
|
|
return Response.json({ isSet: false });
|
|
}
|
|
|
|
const envVarName = providerBaseUrlEnvKeys[provider].apiTokenKey;
|
|
const isSet = !!(process.env[envVarName] || (context?.cloudflare?.env as Record<string, any>)?.[envVarName]);
|
|
|
|
return Response.json({ isSet });
|
|
};
|