diff --git a/.env.example b/.env.example index 2fa90e44..126bd5f2 100644 --- a/.env.example +++ b/.env.example @@ -29,13 +29,11 @@ GOOGLE_GENERATIVE_AI_API_KEY= # EXAMPLE http://localhost:11434 OLLAMA_API_BASE_URL= -# You only need this environment variable set if you want to use OpenAI API Like models -# EXAMPLE https://xxx.xxxx.com/v1 -OPENAI_API_LIKE_BASE_URL= +# You only need this environment variable set if you want to use OpenAI Like models +OPENAI_LIKE_API_BASE_URL= -# Get your OpenAI API Like Key by following these instructions - -# https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key -OPENAI_API_LIKE_KEY= +# Get your OpenAI Like API Key +OPENAI_LIKE_API_KEY= # Include this environment variable if you want more logging for debugging locally VITE_LOG_LEVEL=debug diff --git a/app/lib/.server/llm/api-key.ts b/app/lib/.server/llm/api-key.ts index 32e3f7a4..fedb0bc5 100644 --- a/app/lib/.server/llm/api-key.ts +++ b/app/lib/.server/llm/api-key.ts @@ -20,7 +20,7 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) { case 'OpenRouter': return env.OPEN_ROUTER_API_KEY || cloudflareEnv.OPEN_ROUTER_API_KEY; case "OpenAILike": - return env.OPENAI_API_LIKE_KEY || cloudflareEnv.OPENAI_API_LIKE_KEY; + return env.OPENAI_LIKE_API_KEY || cloudflareEnv.OPENAI_LIKE_API_KEY; default: return ""; } @@ -29,7 +29,7 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) { export function getBaseURL(cloudflareEnv: Env, provider: string) { switch (provider) { case 'OpenAILike': - return env.OPENAI_API_LIKE_BASE_URL || cloudflareEnv.OPENAI_API_LIKE_BASE_URL; + return env.OPENAI_LIKE_API_BASE_URL || cloudflareEnv.OPENAI_LIKE_API_BASE_URL; default: return ""; } diff --git a/app/utils/constants.ts b/app/utils/constants.ts index 782bbfb1..0a806741 100644 --- a/app/utils/constants.ts +++ b/app/utils/constants.ts @@ -54,12 +54,12 @@ async function getOllamaModels(): Promise { async function getOpenAILikeModels(): Promise { try { - const base_url =import.meta.env.OPENAI_API_LIKE_BASE_URL || ""; + const base_url =import.meta.env.OPENAI_LIKE_API_BASE_URL || ""; if (!base_url) { return []; } const url = new URL(base_url).toString(); - const api_key = import.meta.env.OPENAI_API_LIKE_KEY ?? ""; + const api_key = import.meta.env.OPENAI_LIKE_API_KEY ?? ""; const response = await fetch(`${url}/models`, { headers: { Authorization: `Bearer ${api_key}`, diff --git a/vite.config.ts b/vite.config.ts index c3f27bfd..1afe2b11 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,7 +27,7 @@ export default defineConfig((config) => { chrome129IssuePlugin(), config.mode === 'production' && optimizeCssModules({ apply: 'build' }), ], - envPrefix:["VITE_","OPENAI_API_LIKE_","OLLAMA_API_BASE_URL"], + envPrefix:["VITE_","OPENAI_LIKE_API_","OLLAMA_API_BASE_URL"], }; }); diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 6452ef52..dcca1190 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -4,6 +4,6 @@ interface Env { GROQ_API_KEY: string; OPEN_ROUTER_API_KEY: string; OLLAMA_API_BASE_URL: string; - OPENAI_API_LIKE_KEY: string; - OPENAI_API_LIKE_BASE_URL: string; + OPENAI_LIKE_API_KEY: string; + OPENAI_LIKE_API_BASE_URL: string; }