mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 10:55:34 +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
|
# EXAMPLE http://localhost:11434
|
||||||
OLLAMA_API_BASE_URL=
|
OLLAMA_API_BASE_URL=
|
||||||
|
|
||||||
# You only need this environment variable set if you want to use OpenAI API Like models
|
# You only need this environment variable set if you want to use OpenAI Like models
|
||||||
# EXAMPLE https://xxx.xxxx.com/v1
|
OPENAI_LIKE_API_BASE_URL=
|
||||||
OPENAI_API_LIKE_BASE_URL=
|
|
||||||
|
|
||||||
# Get your OpenAI API Like Key by following these instructions -
|
# Get your OpenAI Like API Key
|
||||||
# https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key
|
OPENAI_LIKE_API_KEY=
|
||||||
OPENAI_API_LIKE_KEY=
|
|
||||||
|
|
||||||
# Include this environment variable if you want more logging for debugging locally
|
# Include this environment variable if you want more logging for debugging locally
|
||||||
VITE_LOG_LEVEL=debug
|
VITE_LOG_LEVEL=debug
|
||||||
|
@ -20,7 +20,7 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) {
|
|||||||
case 'OpenRouter':
|
case 'OpenRouter':
|
||||||
return env.OPEN_ROUTER_API_KEY || cloudflareEnv.OPEN_ROUTER_API_KEY;
|
return env.OPEN_ROUTER_API_KEY || cloudflareEnv.OPEN_ROUTER_API_KEY;
|
||||||
case "OpenAILike":
|
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:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) {
|
|||||||
export function getBaseURL(cloudflareEnv: Env, provider: string) {
|
export function getBaseURL(cloudflareEnv: Env, provider: string) {
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
case 'OpenAILike':
|
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:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,12 @@ async function getOllamaModels(): Promise<ModelInfo[]> {
|
|||||||
async function getOpenAILikeModels(): Promise<ModelInfo[]> {
|
async function getOpenAILikeModels(): Promise<ModelInfo[]> {
|
||||||
|
|
||||||
try {
|
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) {
|
if (!base_url) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const url = new URL(base_url).toString();
|
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`, {
|
const response = await fetch(`${url}/models`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${api_key}`,
|
Authorization: `Bearer ${api_key}`,
|
||||||
|
@ -27,7 +27,7 @@ export default defineConfig((config) => {
|
|||||||
chrome129IssuePlugin(),
|
chrome129IssuePlugin(),
|
||||||
config.mode === 'production' && optimizeCssModules({ apply: 'build' }),
|
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;
|
GROQ_API_KEY: string;
|
||||||
OPEN_ROUTER_API_KEY: string;
|
OPEN_ROUTER_API_KEY: string;
|
||||||
OLLAMA_API_BASE_URL: string;
|
OLLAMA_API_BASE_URL: string;
|
||||||
OPENAI_API_LIKE_KEY: string;
|
OPENAI_LIKE_API_KEY: string;
|
||||||
OPENAI_API_LIKE_BASE_URL: string;
|
OPENAI_LIKE_API_BASE_URL: string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user