mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 10:55:34 +00:00
fix: ollama provider module base url hotfix for docker (#863)
* fix: ollama base url hotfix * cleanup logic
This commit is contained in:
parent
d8943f9474
commit
8b58c7a0fb
@ -81,13 +81,20 @@ export default class OllamaProvider extends BaseProvider {
|
|||||||
providerSettings?: Record<string, IProviderSetting>;
|
providerSettings?: Record<string, IProviderSetting>;
|
||||||
}) => LanguageModelV1 = (options) => {
|
}) => LanguageModelV1 = (options) => {
|
||||||
const { apiKeys, providerSettings, serverEnv, model } = options;
|
const { apiKeys, providerSettings, serverEnv, model } = options;
|
||||||
const { baseUrl } = this.getProviderBaseUrlAndKey({
|
let { baseUrl } = this.getProviderBaseUrlAndKey({
|
||||||
apiKeys,
|
apiKeys,
|
||||||
providerSettings,
|
providerSettings,
|
||||||
serverEnv: serverEnv as any,
|
serverEnv: serverEnv as any,
|
||||||
defaultBaseUrlKey: 'OLLAMA_API_BASE_URL',
|
defaultBaseUrlKey: 'OLLAMA_API_BASE_URL',
|
||||||
defaultApiTokenKey: '',
|
defaultApiTokenKey: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Backend: Check if we're running in Docker
|
||||||
|
const isDocker = process.env.RUNNING_IN_DOCKER === 'true';
|
||||||
|
|
||||||
|
baseUrl = isDocker ? baseUrl.replace('localhost', 'host.docker.internal') : baseUrl;
|
||||||
|
baseUrl = isDocker ? baseUrl.replace('127.0.0.1', 'host.docker.internal') : baseUrl;
|
||||||
|
|
||||||
const ollamaInstance = ollama(model, {
|
const ollamaInstance = ollama(model, {
|
||||||
numCtx: DEFAULT_NUM_CTX,
|
numCtx: DEFAULT_NUM_CTX,
|
||||||
}) as LanguageModelV1 & { config: any };
|
}) as LanguageModelV1 & { config: any };
|
||||||
|
Loading…
Reference in New Issue
Block a user