Compare commits

...

3 Commits

7 changed files with 32 additions and 4 deletions

View File

@ -13,7 +13,7 @@
"Linux"
],
"license": "GPLv3",
"version": "0.5.4",
"version": "0.5.5",
"status": "draft",
"is_pack": false,
"released_at": null,
@ -35,8 +35,13 @@
},
{
"version": "0.5.4",
"is_latest": true,
"is_latest": false,
"released_at": "2025-03-17T03:00:00Z"
},
{
"version": "0.5.5",
"is_latest": true,
"released_at": "2025-03-20T19:00:00Z"
}
],
"icon": "https://github.com/user-attachments/assets/dc336712-83cb-440d-8761-8d0a31de898d",

View File

@ -1,7 +1,7 @@
{
"Id" : "qodeassist",
"Name" : "QodeAssist",
"Version" : "0.5.4",
"Version" : "0.5.5",
"Vendor" : "Petr Mironychev",
"VendorId" : "petrmironychev",
"Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} Petr Mironychev, (C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",

View File

@ -30,7 +30,6 @@
#include "logger/Logger.hpp"
#include "settings/ChatAssistantSettings.hpp"
#include "settings/CodeCompletionSettings.hpp"
#include "settings/GeneralSettings.hpp"
#include "settings/ProviderSettings.hpp"
namespace QodeAssist::Providers {

View File

@ -30,6 +30,7 @@
#include "logger/Logger.hpp"
#include "settings/ChatAssistantSettings.hpp"
#include "settings/CodeCompletionSettings.hpp"
#include "settings/ProviderSettings.hpp"
namespace QodeAssist::Providers {
@ -139,6 +140,7 @@ QList<QString> OllamaProvider::getInstalledModels(const QString &url)
QList<QString> models;
QNetworkAccessManager manager;
QNetworkRequest request(QString("%1%2").arg(url, "/api/tags"));
prepareNetworkRequest(request);
QNetworkReply *reply = manager.get(request);
QEventLoop loop;
@ -210,6 +212,10 @@ QString OllamaProvider::apiKey() const
void OllamaProvider::prepareNetworkRequest(QNetworkRequest &networkRequest) const
{
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

View File

@ -96,6 +96,15 @@ ProviderSettings::ProviderSettings()
googleAiApiKey.setDefaultValue("");
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");
readSettings();
@ -119,6 +128,8 @@ ProviderSettings::ProviderSettings()
Group{title(Tr::tr("Mistral AI Settings")), Column{mistralAiApiKey}},
Space{8},
Group{title(Tr::tr("Google AI Settings")), Column{googleAiApiKey}},
Space{8},
Group{title(Tr::tr("Ollama Settings")), Column{ollamaBasicAuthApiKey}},
Stretch{1}};
});
}
@ -141,6 +152,9 @@ void ProviderSettings::setupConnections()
connect(&googleAiApiKey, &ButtonAspect::changed, this, [this]() {
googleAiApiKey.writeSettings();
});
connect(&ollamaBasicAuthApiKey, &ButtonAspect::changed, this, [this]() {
ollamaBasicAuthApiKey.writeSettings();
});
}
void ProviderSettings::resetSettingsToDefaults()
@ -159,6 +173,7 @@ void ProviderSettings::resetSettingsToDefaults()
resetAspect(openAiApiKey);
resetAspect(mistralAiApiKey);
resetAspect(googleAiApiKey);
resetAspect(ollamaBasicAuthApiKey);
}
}

View File

@ -39,6 +39,7 @@ public:
Utils::StringAspect openAiApiKey{this};
Utils::StringAspect mistralAiApiKey{this};
Utils::StringAspect googleAiApiKey{this};
Utils::StringAspect ollamaBasicAuthApiKey{this};
private:
void setupConnections();

View File

@ -100,6 +100,8 @@ const char MISTRAL_AI_API_KEY[] = "QodeAssist.mistralAiApiKey";
const char MISTRAL_AI_API_KEY_HISTORY[] = "QodeAssist.mistralAiApiKeyHistory";
const char GOOGLE_AI_API_KEY[] = "QodeAssist.googleAiApiKey";
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
const char CC_READ_FULL_FILE[] = "QodeAssist.ccReadFullFile";