mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 02:49:12 -04:00
feat: Add llama.cpp modellisting and thinking support
This commit is contained in:
@@ -68,12 +68,26 @@ void LlamaCppProvider::prepareRequest(
|
|||||||
request["presence_penalty"] = settings.presencePenalty();
|
request["presence_penalty"] = settings.presencePenalty();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto applyThinkingMode = [&request]() {
|
||||||
|
QJsonObject chatTemplateKwargs = request["chat_template_kwargs"].toObject();
|
||||||
|
chatTemplateKwargs["enable_thinking"] = true;
|
||||||
|
request["chat_template_kwargs"] = chatTemplateKwargs;
|
||||||
|
};
|
||||||
|
|
||||||
if (type == PluginLLMCore::RequestType::CodeCompletion) {
|
if (type == PluginLLMCore::RequestType::CodeCompletion) {
|
||||||
applyModelParams(Settings::codeCompletionSettings());
|
applyModelParams(Settings::codeCompletionSettings());
|
||||||
} else if (type == PluginLLMCore::RequestType::QuickRefactoring) {
|
} else if (type == PluginLLMCore::RequestType::QuickRefactoring) {
|
||||||
applyModelParams(Settings::quickRefactorSettings());
|
applyModelParams(Settings::quickRefactorSettings());
|
||||||
|
if (isThinkingEnabled) {
|
||||||
|
applyThinkingMode();
|
||||||
|
LOG_MESSAGE(QString("LlamaCppProvider: Thinking mode enabled for QuickRefactoring"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
applyModelParams(Settings::chatAssistantSettings());
|
applyModelParams(Settings::chatAssistantSettings());
|
||||||
|
if (isThinkingEnabled) {
|
||||||
|
applyThinkingMode();
|
||||||
|
LOG_MESSAGE(QString("LlamaCppProvider: Thinking mode enabled for Chat"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isToolsEnabled) {
|
if (isToolsEnabled) {
|
||||||
@@ -85,9 +99,11 @@ void LlamaCppProvider::prepareRequest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFuture<QList<QString>> LlamaCppProvider::getInstalledModels(const QString &)
|
QFuture<QList<QString>> LlamaCppProvider::getInstalledModels(const QString &baseUrl)
|
||||||
{
|
{
|
||||||
return QtFuture::makeReadyFuture(QList<QString>{});
|
m_client->setUrl(baseUrl);
|
||||||
|
m_client->setApiKey(Settings::providerSettings().llamaCppApiKey());
|
||||||
|
return m_client->listModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginLLMCore::ProviderID LlamaCppProvider::providerID() const
|
PluginLLMCore::ProviderID LlamaCppProvider::providerID() const
|
||||||
@@ -97,7 +113,9 @@ PluginLLMCore::ProviderID LlamaCppProvider::providerID() const
|
|||||||
|
|
||||||
PluginLLMCore::ProviderCapabilities LlamaCppProvider::capabilities() const
|
PluginLLMCore::ProviderCapabilities LlamaCppProvider::capabilities() const
|
||||||
{
|
{
|
||||||
return PluginLLMCore::ProviderCapability::Tools | PluginLLMCore::ProviderCapability::Image;
|
return PluginLLMCore::ProviderCapability::Tools | PluginLLMCore::ProviderCapability::Thinking
|
||||||
|
| PluginLLMCore::ProviderCapability::Image
|
||||||
|
| PluginLLMCore::ProviderCapability::ModelListing;
|
||||||
}
|
}
|
||||||
|
|
||||||
::LLMQore::BaseClient *LlamaCppProvider::client() const
|
::LLMQore::BaseClient *LlamaCppProvider::client() const
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ ProviderSettings::ProviderSettings()
|
|||||||
|
|
||||||
// Ollama with BasicAuth Settings
|
// Ollama with BasicAuth Settings
|
||||||
ollamaBasicAuthApiKey.setSettingsKey(Constants::OLLAMA_BASIC_AUTH_API_KEY);
|
ollamaBasicAuthApiKey.setSettingsKey(Constants::OLLAMA_BASIC_AUTH_API_KEY);
|
||||||
ollamaBasicAuthApiKey.setLabelText(Tr::tr("Ollama BasicAuth API Key:"));
|
ollamaBasicAuthApiKey.setLabelText(Tr::tr("Ollama(Bearer) API Key:"));
|
||||||
ollamaBasicAuthApiKey.setDisplayStyle(Utils::StringAspect::LineEditDisplay);
|
ollamaBasicAuthApiKey.setDisplayStyle(Utils::StringAspect::LineEditDisplay);
|
||||||
ollamaBasicAuthApiKey.setPlaceHolderText(Tr::tr("Enter your API key here"));
|
ollamaBasicAuthApiKey.setPlaceHolderText(Tr::tr("Enter your API key here"));
|
||||||
ollamaBasicAuthApiKey.setHistoryCompleter(Constants::OLLAMA_BASIC_AUTH_API_KEY_HISTORY);
|
ollamaBasicAuthApiKey.setHistoryCompleter(Constants::OLLAMA_BASIC_AUTH_API_KEY_HISTORY);
|
||||||
|
|||||||
Reference in New Issue
Block a user