feat: optional apiKey field for Ollama service

This commit is contained in:
PhilKes 2024-05-25 13:51:16 +02:00 committed by Carl-Robert Linnupuu
parent 98c3d5073c
commit 4586838610
5 changed files with 36 additions and 6 deletions

View file

@ -104,9 +104,14 @@ public class CompletionClientProvider {
.getService(OllamaSettings.class)
.getState()
.getHost();
return new OllamaClient.Builder()
.setHost(host)
.build(getDefaultClientBuilder());
var builder = new OllamaClient.Builder()
.setHost(host);
String apiKey = getCredential(CredentialKey.OLLAMA_API_KEY);
if (apiKey != null && !apiKey.isBlank()) {
builder.setApiKey(apiKey);
}
return builder.build(getDefaultClientBuilder());
}

View file

@ -148,7 +148,7 @@ public class LlamaServerPreferencesForm {
.withLabel(CodeGPTBundle.get("settingsConfigurable.shared.apiKey.label"))
.resizeX(false)
.withComment(
CodeGPTBundle.get("settingsConfigurable.service.llama.apiKey.comment"))
CodeGPTBundle.get("settingsConfigurable.shared.apiKey.comment"))
.withCommentHyperlinkListener(UIUtil::handleHyperlinkClicked)
.createPanel();
return withEmptyLeftBorder(FormBuilder.createFormBuilder()