mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 19:06:12 +00:00
Merge pull request #64 from noobydp/main
Further changes to support OLLAMA_API_BASE_URL with ollama models
This commit is contained in:
commit
b21b1457f2
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,7 +12,7 @@ dist-ssr
|
||||
*.local
|
||||
|
||||
.vscode/*
|
||||
!.vscode/launch.json
|
||||
.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
|
@ -34,6 +34,8 @@ export function getBaseURL(cloudflareEnv: Env, provider: string) {
|
||||
switch (provider) {
|
||||
case 'OpenAILike':
|
||||
return env.OPENAI_LIKE_API_BASE_URL || cloudflareEnv.OPENAI_LIKE_API_BASE_URL;
|
||||
case 'Ollama':
|
||||
return env.OLLAMA_API_BASE_URL || cloudflareEnv.OLLAMA_API_BASE_URL;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
@ -57,6 +57,12 @@ export function getGroqModel(apiKey: string, model: string) {
|
||||
return openai(model);
|
||||
}
|
||||
|
||||
export function getOllamaModel(baseURL: string, model: string) {
|
||||
let Ollama = ollama(model);
|
||||
Ollama.config.baseURL = `${baseURL}/api`;
|
||||
return Ollama;
|
||||
}
|
||||
|
||||
export function getDeepseekModel(apiKey: string, model: string){
|
||||
const openai = createOpenAI({
|
||||
baseURL: 'https://api.deepseek.com/beta',
|
||||
@ -65,9 +71,6 @@ export function getDeepseekModel(apiKey: string, model: string){
|
||||
|
||||
return openai(model);
|
||||
}
|
||||
export function getOllamaModel(model: string) {
|
||||
return ollama(model);
|
||||
}
|
||||
|
||||
export function getOpenRouterModel(apiKey: string, model: string) {
|
||||
const openRouter = createOpenRouter({
|
||||
@ -99,6 +102,6 @@ export function getModel(provider: string, model: string, env: Env) {
|
||||
case 'Mistral':
|
||||
return getMistralModel(apiKey, model);
|
||||
default:
|
||||
return getOllamaModel(model);
|
||||
return getOllamaModel(baseURL, model);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user