mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-05-28 03:10:28 -04:00
parent
f41e063c02
commit
4ddbe0b8b9
@ -30,7 +30,6 @@
|
|||||||
#include "logger/Logger.hpp"
|
#include "logger/Logger.hpp"
|
||||||
#include "settings/ChatAssistantSettings.hpp"
|
#include "settings/ChatAssistantSettings.hpp"
|
||||||
#include "settings/CodeCompletionSettings.hpp"
|
#include "settings/CodeCompletionSettings.hpp"
|
||||||
#include "settings/GeneralSettings.hpp"
|
|
||||||
#include "settings/ProviderSettings.hpp"
|
#include "settings/ProviderSettings.hpp"
|
||||||
|
|
||||||
namespace QodeAssist::Providers {
|
namespace QodeAssist::Providers {
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "logger/Logger.hpp"
|
#include "logger/Logger.hpp"
|
||||||
#include "settings/ChatAssistantSettings.hpp"
|
#include "settings/ChatAssistantSettings.hpp"
|
||||||
#include "settings/CodeCompletionSettings.hpp"
|
#include "settings/CodeCompletionSettings.hpp"
|
||||||
|
#include "settings/ProviderSettings.hpp"
|
||||||
|
|
||||||
namespace QodeAssist::Providers {
|
namespace QodeAssist::Providers {
|
||||||
|
|
||||||
@ -210,6 +211,10 @@ QString OllamaProvider::apiKey() const
|
|||||||
void OllamaProvider::prepareNetworkRequest(QNetworkRequest &networkRequest) const
|
void OllamaProvider::prepareNetworkRequest(QNetworkRequest &networkRequest) const
|
||||||
{
|
{
|
||||||
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
const auto key = Settings::providerSettings().ollamaBasicAuthApiKey();
|
||||||
|
if (!key.isEmpty()) {
|
||||||
|
networkRequest.setRawHeader("Authorization", "Basic " + key.toLatin1());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMCore::ProviderID OllamaProvider::providerID() const
|
LLMCore::ProviderID OllamaProvider::providerID() const
|
||||||
|
@ -96,6 +96,15 @@ ProviderSettings::ProviderSettings()
|
|||||||
googleAiApiKey.setDefaultValue("");
|
googleAiApiKey.setDefaultValue("");
|
||||||
googleAiApiKey.setAutoApply(true);
|
googleAiApiKey.setAutoApply(true);
|
||||||
|
|
||||||
|
// Ollama with BasicAuth Settings
|
||||||
|
ollamaBasicAuthApiKey.setSettingsKey(Constants::OLLAMA_BASIC_AUTH_API_KEY);
|
||||||
|
ollamaBasicAuthApiKey.setLabelText(Tr::tr("Ollama BasicAuth API Key:"));
|
||||||
|
ollamaBasicAuthApiKey.setDisplayStyle(Utils::StringAspect::LineEditDisplay);
|
||||||
|
ollamaBasicAuthApiKey.setPlaceHolderText(Tr::tr("Enter your API key here"));
|
||||||
|
ollamaBasicAuthApiKey.setHistoryCompleter(Constants::OLLAMA_BASIC_AUTH_API_KEY_HISTORY);
|
||||||
|
ollamaBasicAuthApiKey.setDefaultValue("");
|
||||||
|
ollamaBasicAuthApiKey.setAutoApply(true);
|
||||||
|
|
||||||
resetToDefaults.m_buttonText = Tr::tr("Reset Page to Defaults");
|
resetToDefaults.m_buttonText = Tr::tr("Reset Page to Defaults");
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
@ -119,6 +128,8 @@ ProviderSettings::ProviderSettings()
|
|||||||
Group{title(Tr::tr("Mistral AI Settings")), Column{mistralAiApiKey}},
|
Group{title(Tr::tr("Mistral AI Settings")), Column{mistralAiApiKey}},
|
||||||
Space{8},
|
Space{8},
|
||||||
Group{title(Tr::tr("Google AI Settings")), Column{googleAiApiKey}},
|
Group{title(Tr::tr("Google AI Settings")), Column{googleAiApiKey}},
|
||||||
|
Space{8},
|
||||||
|
Group{title(Tr::tr("Ollama Settings")), Column{ollamaBasicAuthApiKey}},
|
||||||
Stretch{1}};
|
Stretch{1}};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -141,6 +152,9 @@ void ProviderSettings::setupConnections()
|
|||||||
connect(&googleAiApiKey, &ButtonAspect::changed, this, [this]() {
|
connect(&googleAiApiKey, &ButtonAspect::changed, this, [this]() {
|
||||||
googleAiApiKey.writeSettings();
|
googleAiApiKey.writeSettings();
|
||||||
});
|
});
|
||||||
|
connect(&ollamaBasicAuthApiKey, &ButtonAspect::changed, this, [this]() {
|
||||||
|
ollamaBasicAuthApiKey.writeSettings();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProviderSettings::resetSettingsToDefaults()
|
void ProviderSettings::resetSettingsToDefaults()
|
||||||
@ -159,6 +173,7 @@ void ProviderSettings::resetSettingsToDefaults()
|
|||||||
resetAspect(openAiApiKey);
|
resetAspect(openAiApiKey);
|
||||||
resetAspect(mistralAiApiKey);
|
resetAspect(mistralAiApiKey);
|
||||||
resetAspect(googleAiApiKey);
|
resetAspect(googleAiApiKey);
|
||||||
|
resetAspect(ollamaBasicAuthApiKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
Utils::StringAspect openAiApiKey{this};
|
Utils::StringAspect openAiApiKey{this};
|
||||||
Utils::StringAspect mistralAiApiKey{this};
|
Utils::StringAspect mistralAiApiKey{this};
|
||||||
Utils::StringAspect googleAiApiKey{this};
|
Utils::StringAspect googleAiApiKey{this};
|
||||||
|
Utils::StringAspect ollamaBasicAuthApiKey{this};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
@ -100,6 +100,8 @@ const char MISTRAL_AI_API_KEY[] = "QodeAssist.mistralAiApiKey";
|
|||||||
const char MISTRAL_AI_API_KEY_HISTORY[] = "QodeAssist.mistralAiApiKeyHistory";
|
const char MISTRAL_AI_API_KEY_HISTORY[] = "QodeAssist.mistralAiApiKeyHistory";
|
||||||
const char GOOGLE_AI_API_KEY[] = "QodeAssist.googleAiApiKey";
|
const char GOOGLE_AI_API_KEY[] = "QodeAssist.googleAiApiKey";
|
||||||
const char GOOGLE_AI_API_KEY_HISTORY[] = "QodeAssist.googleAiApiKeyHistory";
|
const char GOOGLE_AI_API_KEY_HISTORY[] = "QodeAssist.googleAiApiKeyHistory";
|
||||||
|
const char OLLAMA_BASIC_AUTH_API_KEY[] = "QodeAssist.ollamaBasicAuthApiKey";
|
||||||
|
const char OLLAMA_BASIC_AUTH_API_KEY_HISTORY[] = "QodeAssist.ollamaBasicAuthApiKeyHistory";
|
||||||
|
|
||||||
// context settings
|
// context settings
|
||||||
const char CC_READ_FULL_FILE[] = "QodeAssist.ccReadFullFile";
|
const char CC_READ_FULL_FILE[] = "QodeAssist.ccReadFullFile";
|
||||||
|
Loading…
Reference in New Issue
Block a user