diff --git a/CMakeLists.txt b/CMakeLists.txt index ea2af50..4081f75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ add_subdirectory(llmcore) add_subdirectory(settings) add_subdirectory(logger) add_subdirectory(ChatView) +add_subdirectory(context) add_qtc_plugin(QodeAssist PLUGIN_DEPENDS @@ -63,9 +64,6 @@ add_qtc_plugin(QodeAssist LSPCompletion.hpp LLMSuggestion.hpp LLMSuggestion.cpp QodeAssistClient.hpp QodeAssistClient.cpp - DocumentContextReader.hpp DocumentContextReader.cpp - utils/CounterTooltip.hpp utils/CounterTooltip.cpp - core/ChangesManager.h core/ChangesManager.cpp chat/ChatOutputPane.h chat/ChatOutputPane.cpp chat/NavigationPanel.hpp chat/NavigationPanel.cpp ConfigurationManager.hpp ConfigurationManager.cpp diff --git a/ChatView/CMakeLists.txt b/ChatView/CMakeLists.txt index 14ed915..18e5ab9 100644 --- a/ChatView/CMakeLists.txt +++ b/ChatView/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(QodeAssistChatView QtCreator::Utils LLMCore QodeAssistSettings + Context ) target_include_directories(QodeAssistChatView diff --git a/LLMClientInterface.cpp b/LLMClientInterface.cpp index 1a796fe..2d419e4 100644 --- a/LLMClientInterface.cpp +++ b/LLMClientInterface.cpp @@ -27,7 +27,7 @@ #include #include "CodeHandler.hpp" -#include "DocumentContextReader.hpp" +#include "context/DocumentContextReader.hpp" #include "llmcore/MessageBuilder.hpp" #include "llmcore/PromptTemplateManager.hpp" #include "llmcore/ProvidersManager.hpp" diff --git a/QodeAssistClient.cpp b/QodeAssistClient.cpp index f83f8e1..3055161 100644 --- a/QodeAssistClient.cpp +++ b/QodeAssistClient.cpp @@ -31,10 +31,10 @@ #include "LLMClientInterface.hpp" #include "LLMSuggestion.hpp" -#include "core/ChangesManager.h" #include "settings/CodeCompletionSettings.hpp" #include "settings/GeneralSettings.hpp" #include "settings/ProjectSettings.hpp" +#include using namespace LanguageServerProtocol; using namespace TextEditor; diff --git a/context/CMakeLists.txt b/context/CMakeLists.txt new file mode 100644 index 0000000..2bc8709 --- /dev/null +++ b/context/CMakeLists.txt @@ -0,0 +1,18 @@ +add_library(Context STATIC + DocumentContextReader.hpp DocumentContextReader.cpp + ChangesManager.h ChangesManager.cpp +) + +target_link_libraries(Context + PUBLIC + Qt::Core + QtCreator::Core + QtCreator::TextEditor + QtCreator::Utils + QtCreator::ProjectExplorer + PRIVATE + LLMCore + QodeAssistSettings +) + +target_include_directories(Context PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/core/ChangesManager.cpp b/context/ChangesManager.cpp similarity index 98% rename from core/ChangesManager.cpp rename to context/ChangesManager.cpp index 40809f3..deabfc4 100644 --- a/core/ChangesManager.cpp +++ b/context/ChangesManager.cpp @@ -18,7 +18,7 @@ */ #include "ChangesManager.h" -#include "settings/CodeCompletionSettings.hpp" +#include "CodeCompletionSettings.hpp" namespace QodeAssist { diff --git a/core/ChangesManager.h b/context/ChangesManager.h similarity index 100% rename from core/ChangesManager.h rename to context/ChangesManager.h diff --git a/DocumentContextReader.cpp b/context/DocumentContextReader.cpp similarity index 99% rename from DocumentContextReader.cpp rename to context/DocumentContextReader.cpp index 1361034..7f94b44 100644 --- a/DocumentContextReader.cpp +++ b/context/DocumentContextReader.cpp @@ -23,8 +23,9 @@ #include #include -#include "core/ChangesManager.h" -#include "settings/CodeCompletionSettings.hpp" +#include "CodeCompletionSettings.hpp" + +#include "ChangesManager.h" const QRegularExpression &getYearRegex() { diff --git a/DocumentContextReader.hpp b/context/DocumentContextReader.hpp similarity index 100% rename from DocumentContextReader.hpp rename to context/DocumentContextReader.hpp index 3172336..e2e6268 100644 --- a/DocumentContextReader.hpp +++ b/context/DocumentContextReader.hpp @@ -19,8 +19,8 @@ #pragma once -#include #include +#include #include diff --git a/rawPromptExamples/OllamaStarCoder2FIM.json b/rawPromptExamples/OllamaStarCoder2FIM.json deleted file mode 100644 index 7ce65cc..0000000 --- a/rawPromptExamples/OllamaStarCoder2FIM.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "prompt": "{{QODE_INSTRUCTIONS}}{{QODE_PREFIX}}{{QODE_SUFFIX}}", - "options": { - "temperature": 0.7, - "top_p": 0.95, - "top_k": 40, - "num_predict": 175, - "stop": [ - "<|endoftext|>", - "", - "", - "", - "" - ], - "frequency_penalty": 0, - "presence_penalty": 0 - }, - "stream": true -} \ No newline at end of file diff --git a/rawPromptExamples/OpenAICodeqwenChat.json b/rawPromptExamples/OpenAICodeqwenChat.json deleted file mode 100644 index 6ff0546..0000000 --- a/rawPromptExamples/OpenAICodeqwenChat.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "max_tokens": 150, - "messages": [ - { - "content": "{{QODE_INSTRUCTIONS}}\n### Instruction:{{QODE_PREFIX}}{{QODE_SUFFIX}} ### Response:\n", - "role": "user" - } - ], - "stop": [ - "### Instruction:", - "### Response:", - "\n\n### " - ], - "stream": true, - "temperature": 0.2 -} \ No newline at end of file diff --git a/utils/CounterTooltip.cpp b/utils/CounterTooltip.cpp deleted file mode 100644 index ec5a699..0000000 --- a/utils/CounterTooltip.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2024 Petr Mironychev - * - * This file is part of QodeAssist. - * - * QodeAssist is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * QodeAssist is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with QodeAssist. If not, see . - */ - -#include "CounterTooltip.hpp" - -namespace QodeAssist { - -CounterTooltip::CounterTooltip(int count) - : m_count(count) -{ - m_label = new QLabel(this); - addWidget(m_label); - updateLabel(); - - m_timer = new QTimer(this); - m_timer->setSingleShot(true); - m_timer->setInterval(2000); - - connect(m_timer, &QTimer::timeout, this, [this] { emit finished(m_count); }); - - m_timer->start(); -} - -CounterTooltip::~CounterTooltip() {} - -void CounterTooltip::updateLabel() -{ - const auto hotkey = QKeySequence(QKeySequence::MoveToNextWord).toString(); - m_label->setText(QString("Insert Next %1 line(s) (%2)").arg(m_count).arg(hotkey)); -} - -} // namespace QodeAssist diff --git a/utils/CounterTooltip.hpp b/utils/CounterTooltip.hpp deleted file mode 100644 index 5e53e00..0000000 --- a/utils/CounterTooltip.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2024 Petr Mironychev - * - * This file is part of QodeAssist. - * - * QodeAssist is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * QodeAssist is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with QodeAssist. If not, see . - */ - -#pragma once - -#include -#include -#include -#include - -namespace QodeAssist { - -class CounterTooltip : public QToolBar -{ - Q_OBJECT - -public: - CounterTooltip(int count); - ~CounterTooltip(); - -signals: - void finished(int count); - -private: - void updateLabel(); - - QLabel *m_label; - QTimer *m_timer; - int m_count; -}; - -} // namespace QodeAssist