Skip to content

Commit

Permalink
🐛 fix: fix ollama host issue (lobehub#2210)
Browse files Browse the repository at this point in the history
Co-authored-by: eyebrowkang <[email protected]>
  • Loading branch information
eyebrow and eyebrowkang authored Apr 26, 2024
1 parent 1ca7cad commit c49d4c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libs/agent-runtime/ollama/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class LobeOllamaAI implements LobeRuntimeAI {
throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidOllamaArgs);
}

this.client = new Ollama(!baseURL ? undefined : { host: new URL(baseURL).host });
this.client = new Ollama(!baseURL ? undefined : { host: baseURL });

if (baseURL) this.baseURL = baseURL;
}
Expand Down
3 changes: 1 addition & 2 deletions src/services/ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export class OllamaService {
getHost = (): string => {
const config = modelConfigSelectors.ollamaConfig(useGlobalStore.getState());

const url = new URL(config.endpoint || DEFAULT_BASE_URL);
return url.host;
return config.endpoint || DEFAULT_BASE_URL;
};

getOllamaClient = () => {
Expand Down

0 comments on commit c49d4c7

Please sign in to comment.