This commit is contained in:
Petr Mironychev 2024-08-29 22:46:03 +02:00
parent 9beb48ee97
commit b4f969908f
2 changed files with 8 additions and 8 deletions

View File

@ -177,7 +177,7 @@ void LLMClientInterface::handleInitialize(const QJsonObject &request)
result["capabilities"] = capabilities; result["capabilities"] = capabilities;
QJsonObject serverInfo; QJsonObject serverInfo;
serverInfo["name"] = "Ollama LSP Server"; serverInfo["name"] = "QodeAssist LSP Server";
serverInfo["version"] = "0.1"; serverInfo["version"] = "0.1";
result["serverInfo"] = serverInfo; result["serverInfo"] = serverInfo;
@ -324,22 +324,22 @@ void LLMClientInterface::sendCompletionToClient(const QString &completion,
void LLMClientInterface::sendLLMRequest(const QJsonObject &request, const ContextPair &prompt) void LLMClientInterface::sendLLMRequest(const QJsonObject &request, const ContextPair &prompt)
{ {
QJsonObject ollamaRequest = {{"model", settings().modelName.value()}, {"stream", true}}; QJsonObject qodeRequest = {{"model", settings().modelName.value()}, {"stream", true}};
auto currentTemplate = PromptTemplateManager::instance().getCurrentTemplate(); auto currentTemplate = PromptTemplateManager::instance().getCurrentTemplate();
currentTemplate->prepareRequest(ollamaRequest, prompt.prefix, prompt.suffix); currentTemplate->prepareRequest(qodeRequest, prompt.prefix, prompt.suffix);
auto &providerManager = LLMProvidersManager::instance(); auto &providerManager = LLMProvidersManager::instance();
providerManager.getCurrentProvider()->prepareRequest(ollamaRequest); providerManager.getCurrentProvider()->prepareRequest(qodeRequest);
logMessage( logMessage(
QString("Sending request to llm: \nurl: %1\nRequest body:\n%2") QString("Sending request to llm: \nurl: %1\nRequest body:\n%2")
.arg(m_serverUrl.toString()) .arg(m_serverUrl.toString())
.arg(QString::fromUtf8(QJsonDocument(ollamaRequest).toJson(QJsonDocument::Indented)))); .arg(QString::fromUtf8(QJsonDocument(qodeRequest).toJson(QJsonDocument::Indented))));
QNetworkRequest networkRequest(m_serverUrl); QNetworkRequest networkRequest(m_serverUrl);
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QNetworkReply *reply = m_manager->post(networkRequest, QJsonDocument(ollamaRequest).toJson()); QNetworkReply *reply = m_manager->post(networkRequest, QJsonDocument(qodeRequest).toJson());
if (!reply) { if (!reply) {
logMessage("Error: Failed to create network reply"); logMessage("Error: Failed to create network reply");
return; return;
@ -356,7 +356,7 @@ void LLMClientInterface::sendLLMRequest(const QJsonObject &request, const Contex
reply->deleteLater(); reply->deleteLater();
m_activeRequests.remove(requestId); m_activeRequests.remove(requestId);
if (reply->error() != QNetworkReply::NoError) { if (reply->error() != QNetworkReply::NoError) {
logMessage(QString("Error in Ollama request: %1").arg(reply->errorString())); logMessage(QString("Error in QodeAssist request: %1").arg(reply->errorString()));
} else { } else {
logMessage("Request finished successfully"); logMessage("Request finished successfully");
} }

View File

@ -85,7 +85,7 @@ public:
ActionBuilder requestAction(this, Constants::QODE_ASSIST_REQUEST_SUGGESTION); ActionBuilder requestAction(this, Constants::QODE_ASSIST_REQUEST_SUGGESTION);
requestAction.setToolTip( requestAction.setToolTip(
Tr::tr("Generate Qode Assist suggestion at the current cursor position.")); Tr::tr("Generate Qode Assist suggestion at the current cursor position."));
requestAction.setText(Tr::tr("Request Ollama Suggestion")); requestAction.setText(Tr::tr("Request QodeAssist Suggestion"));
requestAction.setIcon(QCODEASSIST_ICON.icon()); requestAction.setIcon(QCODEASSIST_ICON.icon());
const QKeySequence defaultShortcut = QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Q); const QKeySequence defaultShortcut = QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Q);
requestAction.setDefaultKeySequence(defaultShortcut); requestAction.setDefaultKeySequence(defaultShortcut);