mirror of
https://github.com/coleam00/bolt.new-any-llm
synced 2024-12-28 06:42:56 +00:00
chore: Update environment variable names for OpenAI Like integration
This commit is contained in:
parent
30dfa4fda4
commit
9f2db7b683
10
.env.example
10
.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
|
||||
|
@ -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 "";
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ async function getOllamaModels(): Promise<ModelInfo[]> {
|
||||
async function getOpenAILikeModels(): Promise<ModelInfo[]> {
|
||||
|
||||
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}`,
|
||||
|
@ -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"],
|
||||
};
|
||||
});
|
||||
|
||||
|
4
worker-configuration.d.ts
vendored
4
worker-configuration.d.ts
vendored
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user