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
|
*.local
|
||||||
|
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/launch.json
|
.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
.idea
|
.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
@ -34,6 +34,8 @@ export function getBaseURL(cloudflareEnv: Env, provider: string) {
|
|||||||
switch (provider) {
|
switch (provider) {
|
||||||
case 'OpenAILike':
|
case 'OpenAILike':
|
||||||
return env.OPENAI_LIKE_API_BASE_URL || cloudflareEnv.OPENAI_LIKE_API_BASE_URL;
|
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:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,12 @@ export function getGroqModel(apiKey: string, model: string) {
|
|||||||
return openai(model);
|
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){
|
export function getDeepseekModel(apiKey: string, model: string){
|
||||||
const openai = createOpenAI({
|
const openai = createOpenAI({
|
||||||
baseURL: 'https://api.deepseek.com/beta',
|
baseURL: 'https://api.deepseek.com/beta',
|
||||||
@ -65,9 +71,6 @@ export function getDeepseekModel(apiKey: string, model: string){
|
|||||||
|
|
||||||
return openai(model);
|
return openai(model);
|
||||||
}
|
}
|
||||||
export function getOllamaModel(model: string) {
|
|
||||||
return ollama(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getOpenRouterModel(apiKey: string, model: string) {
|
export function getOpenRouterModel(apiKey: string, model: string) {
|
||||||
const openRouter = createOpenRouter({
|
const openRouter = createOpenRouter({
|
||||||
@ -99,6 +102,6 @@ export function getModel(provider: string, model: string, env: Env) {
|
|||||||
case 'Mistral':
|
case 'Mistral':
|
||||||
return getMistralModel(apiKey, model);
|
return getMistralModel(apiKey, model);
|
||||||
default:
|
default:
|
||||||
return getOllamaModel(model);
|
return getOllamaModel(baseURL, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user