Skip to content

Commit 216c2d2

Browse files
committed
add ollama keys
1 parent 7b0d34b commit 216c2d2

File tree

2 files changed

+98
-831
lines changed

2 files changed

+98
-831
lines changed

src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ export class OllamaProvider extends BaseLLMProvider {
3838
private ollama: Ollama
3939
constructor(provider: LLM_PROVIDER, configPresenter: ConfigPresenter) {
4040
super(provider, configPresenter)
41-
this.ollama = new Ollama({ host: this.provider.baseUrl })
41+
if (this.provider.apiKey) {
42+
this.ollama = new Ollama({
43+
host: this.provider.baseUrl,
44+
headers: { Authorization: `Bearer ${this.provider.apiKey}` }
45+
})
46+
} else {
47+
this.ollama = new Ollama({
48+
host: this.provider.baseUrl
49+
})
50+
}
4251
this.init()
4352
}
4453

0 commit comments

Comments
 (0)