Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Pass LLMClientInterface to QodeAssistClient #122

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions QodeAssistClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ using namespace Core;

namespace QodeAssist {

QodeAssistClient::QodeAssistClient(
LLMCore::IProviderRegistry &providerRegistry, LLMCore::IPromptProvider *promptProvider)
: LanguageClient::Client(new LLMClientInterface(
Settings::generalSettings(),
Settings::codeCompletionSettings(),
providerRegistry,
promptProvider))
QodeAssistClient::QodeAssistClient(LLMClientInterface *clientInterface)
: LanguageClient::Client(clientInterface)
, m_recentCharCount(0)
{
setName("Qode Assist");
Expand Down
4 changes: 2 additions & 2 deletions QodeAssistClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#pragma once

#include "LLMClientInterface.hpp"
#include "LSPCompletion.hpp"
#include <languageclient/client.h>
#include <llmcore/IPromptProvider.hpp>
Expand All @@ -34,8 +35,7 @@ namespace QodeAssist {
class QodeAssistClient : public LanguageClient::Client
{
public:
explicit QodeAssistClient(
LLMCore::IProviderRegistry &providerRegistry, LLMCore::IPromptProvider *promptProvider);
explicit QodeAssistClient(LLMClientInterface *clientInterface);
~QodeAssistClient() override;

void openDocument(TextEditor::TextDocument *document) override;
Expand Down
7 changes: 5 additions & 2 deletions qodeassist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ class QodeAssistPlugin final : public ExtensionSystem::IPlugin
void restartClient()
{
LanguageClient::LanguageClientManager::shutdownClient(m_qodeAssistClient);
m_qodeAssistClient
= new QodeAssistClient(LLMCore::ProvidersManager::instance(), &m_promptProvider);
m_qodeAssistClient = new QodeAssistClient(new LLMClientInterface(
Settings::generalSettings(),
Settings::codeCompletionSettings(),
LLMCore::ProvidersManager::instance(),
&m_promptProvider));
}

bool delayedInitialize() final
Expand Down