├── .gitmodules
├── .qmlformat.ini
├── TaskFlow
├── Editor
│ ├── qml
│ │ ├── TaskParameter.qml
│ │ └── TaskPort.qml
│ ├── TaskPortItem.cpp
│ ├── TaskModel.hpp
│ ├── TaskPortItem.hpp
│ ├── TaskConnectionsModel.hpp
│ ├── TaskPortModel.hpp
│ ├── FlowsModel.hpp
│ ├── TaskConnectionsModel.cpp
│ ├── CMakeLists.txt
│ ├── TaskModel.cpp
│ ├── TaskPortModel.cpp
│ ├── TaskItem.hpp
│ ├── TaskItem.cpp
│ ├── FlowsModel.cpp
│ ├── TaskConnectionItem.hpp
│ ├── GridBackground.hpp
│ └── FlowItem.hpp
├── CMakeLists.txt
└── core
│ ├── CMakeLists.txt
│ ├── FlowRegistry.hpp
│ ├── FlowRegistry.cpp
│ ├── TaskRegistry.hpp
│ ├── TaskConnection.hpp
│ ├── FlowManager.hpp
│ ├── TaskRegistry.cpp
│ └── BaseTask.hpp
├── resources
└── images
│ ├── qoderassist-icon.png
│ ├── suggest-new-icon.png
│ ├── qoderassist-icon@2x.png
│ ├── suggest-new-icon@2x.png
│ ├── qode-assist-chat-icon.png
│ ├── qode-assist-chat-icon@2x.png
│ ├── improve-current-code-icon.png
│ ├── repeat-last-instruct-icon.png
│ ├── improve-current-code-icon@2x.png
│ └── repeat-last-instruct-icon@2x.png
├── UIControls
├── icons
│ ├── dropdown-arrow-dark.svg
│ └── dropdown-arrow-light.svg
├── qml
│ ├── FadeListItemAnimation.qml
│ ├── QoASeparator.qml
│ ├── Badge.qml
│ └── QoAButton.qml
└── CMakeLists.txt
├── ChatView
├── icons
│ ├── context-icon.svg
│ ├── image-dark.svg
│ ├── load-chat-dark.svg
│ ├── save-chat-dark.svg
│ ├── close-dark.svg
│ ├── close-light.svg
│ ├── compress-icon.svg
│ ├── chat-icon.svg
│ ├── link-file-light.svg
│ ├── window-lock.svg
│ ├── link-file-dark.svg
│ ├── window-unlock.svg
│ ├── chat-pause-icon.svg
│ ├── apply-changes-button.svg
│ ├── file-in-system.svg
│ ├── reject-changes-button.svg
│ ├── undo-changes-button.svg
│ ├── clean-icon-dark.svg
│ ├── attach-file-dark.svg
│ ├── attach-file-light.svg
│ ├── settings-icon.svg
│ ├── open-in-editor.svg
│ ├── rules-icon.svg
│ ├── thinking-icon-on.svg
│ └── thinking-icon-off.svg
├── ChatData.hpp
├── ChatWidget.hpp
├── ChatUtils.h
├── ChatWidget.cpp
├── FileItem.hpp
├── ChatView.hpp
├── MessagePart.hpp
├── qml
│ └── chatparts
│ │ └── TextBlock.qml
└── ChatFileManager.hpp
├── logger
├── CMakeLists.txt
├── Logger.hpp
├── EmptyRequestPerformanceLogger.hpp
├── IRequestPerformanceLogger.hpp
├── Logger.cpp
└── RequestPerformanceLogger.hpp
├── test
├── CMakeLists.txt
├── unittest_main.cpp
├── MockDocumentReader.hpp
└── MockRequestHandler.hpp
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── FUNDING.yml
└── workflows
│ └── README.md
├── docs
├── llamacpp-configuration.md
├── google-ai-configuration.md
├── claude-configuration.md
├── mistral-configuration.md
├── project-rules.md
├── ignoring-files.md
├── file-context.md
└── openai-configuration.md
├── QodeAssist.qrc
├── context
├── CMakeLists.txt
├── ContentFile.hpp
├── Utils.hpp
├── TokenUtils.hpp
├── IDocumentReader.hpp
├── ProgrammingLanguage.hpp
├── DocumentReaderQtCreator.hpp
├── TokenUtils.cpp
└── IContextManager.hpp
├── QodeAssist.json.in
├── settings
├── ProjectSettingsPanel.hpp
├── Assisttr.h
├── CMakeLists.txt
├── ProjectSettings.hpp
├── AgentRolesWidget.hpp
├── CustomPromptSettings.hpp
├── ProviderSettings.hpp
├── SettingsDialog.hpp
├── AgentRoleDialog.hpp
├── PluginUpdater.hpp
├── UpdateDialog.hpp
└── ToolsSettings.hpp
├── llmcore
├── Provider.cpp
├── CMakeLists.txt
├── RequestType.hpp
├── ProviderID.hpp
├── RequestHandlerBase.cpp
├── DataBuffers.hpp
├── IProviderRegistry.hpp
├── SSEBuffer.hpp
├── RequestConfig.hpp
├── IPromptProvider.hpp
├── ValidationUtils.hpp
├── SSEBuffer.cpp
├── ProvidersManager.cpp
├── PromptTemplate.hpp
├── RequestHandlerBase.hpp
├── IToolsManager.hpp
├── PromptProviderFim.hpp
├── PromptProviderChat.hpp
└── ProvidersManager.hpp
├── QodeAssisttr.h
├── Version.hpp
├── QodeAssistConstants.hpp
├── .gitignore
├── providers
├── CodestralProvider.hpp
├── OpenRouterAIProvider.hpp
├── CodestralProvider.cpp
├── OpenRouterAIProvider.cpp
└── OpenAIResponses
│ └── CancelResponseRequest.hpp
├── chat
├── NavigationPanel.hpp
├── NavigationPanel.cpp
└── ChatOutputPane.h
├── RefactorSuggestion.hpp
├── widgets
├── CompletionHintWidget.hpp
├── CompletionHintHandler.hpp
├── EditorChatButton.hpp
├── AddCustomInstructionDialog.hpp
├── CompletionErrorHandler.hpp
├── CompletionProgressHandler.hpp
├── ProgressWidget.hpp
├── EditorChatButtonHandler.hpp
├── ErrorWidget.hpp
└── CustomInstructionsManager.hpp
├── tools
├── EditFileTool.hpp
├── CreateNewFileTool.hpp
├── ReadVisibleFilesTool.hpp
├── ToolsFactory.hpp
├── ListProjectFilesTool.hpp
└── FindAndReadFileTool.hpp
├── UpdateStatusWidget.hpp
├── templates
└── DeepSeekCoderFim.hpp
├── LLMSuggestion.hpp
└── CodeHandler.hpp
/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.qmlformat.ini:
--------------------------------------------------------------------------------
1 | [General]
2 | IndentWidth=4
3 | NewlineType=native
--------------------------------------------------------------------------------
/TaskFlow/Editor/qml/TaskParameter.qml:
--------------------------------------------------------------------------------
1 | import QtQuick
2 | import TaskFlow.Editor
3 |
4 | Item {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/resources/images/qoderassist-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/qoderassist-icon.png
--------------------------------------------------------------------------------
/resources/images/suggest-new-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/suggest-new-icon.png
--------------------------------------------------------------------------------
/resources/images/qoderassist-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/qoderassist-icon@2x.png
--------------------------------------------------------------------------------
/resources/images/suggest-new-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/suggest-new-icon@2x.png
--------------------------------------------------------------------------------
/resources/images/qode-assist-chat-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/qode-assist-chat-icon.png
--------------------------------------------------------------------------------
/resources/images/qode-assist-chat-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/qode-assist-chat-icon@2x.png
--------------------------------------------------------------------------------
/resources/images/improve-current-code-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/improve-current-code-icon.png
--------------------------------------------------------------------------------
/resources/images/repeat-last-instruct-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/repeat-last-instruct-icon.png
--------------------------------------------------------------------------------
/resources/images/improve-current-code-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/improve-current-code-icon@2x.png
--------------------------------------------------------------------------------
/resources/images/repeat-last-instruct-icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Palm1r/QodeAssist/HEAD/resources/images/repeat-last-instruct-icon@2x.png
--------------------------------------------------------------------------------
/UIControls/icons/dropdown-arrow-dark.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/UIControls/icons/dropdown-arrow-light.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/ChatView/icons/context-icon.svg:
--------------------------------------------------------------------------------
1 |
5 |
6 |
--------------------------------------------------------------------------------
/ChatView/icons/image-dark.svg:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/TaskFlow/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(core)
2 | add_subdirectory(Editor)
3 | # add_subdirectory(serialization)
4 | # add_subdirectory(tasks)
5 |
6 | qt_add_library(TaskFlow STATIC)
7 |
8 | target_link_libraries(TaskFlow
9 | PUBLIC
10 | TaskFlowCore
11 | TaskFlowEditorplugin
12 | # TaskFlowSerialization
13 | # TaskFlowTasks
14 | )
15 |
--------------------------------------------------------------------------------
/ChatView/icons/load-chat-dark.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/ChatView/icons/save-chat-dark.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/ChatView/icons/close-dark.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/ChatView/icons/close-light.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/logger/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(QodeAssistLogger STATIC
2 | EmptyRequestPerformanceLogger.hpp
3 | IRequestPerformanceLogger.hpp
4 | Logger.cpp
5 | Logger.hpp
6 | RequestPerformanceLogger.hpp RequestPerformanceLogger.cpp
7 | )
8 |
9 | target_link_libraries(QodeAssistLogger
10 | PUBLIC
11 | Qt::Core
12 | QtCreator::Core
13 | )
14 |
15 | target_include_directories(QodeAssistLogger
16 | PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
17 | )
18 |
--------------------------------------------------------------------------------
/UIControls/qml/FadeListItemAnimation.qml:
--------------------------------------------------------------------------------
1 | import QtQuick
2 |
3 | ParallelAnimation {
4 | id: root
5 |
6 | property Item targetObject: parent
7 |
8 | NumberAnimation {
9 | target: root.targetObject
10 | property: "opacity"
11 | to: 0
12 | duration: 200
13 | easing.type: Easing.InQuad
14 | }
15 | NumberAnimation {
16 | target: root.targetObject
17 | property: "height"
18 | to: 0
19 | duration: 250
20 | easing.type: Easing.InQuad
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ChatView/icons/compress-icon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/ChatView/icons/chat-icon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/ChatView/icons/link-file-light.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/ChatView/icons/window-lock.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/ChatView/icons/link-file-dark.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/ChatView/icons/window-unlock.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/TaskFlow/core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | qt_add_library(TaskFlowCore STATIC
2 | BaseTask.hpp BaseTask.cpp
3 | TaskConnection.hpp TaskConnection.cpp
4 | Flow.hpp Flow.cpp
5 | TaskPort.hpp TaskPort.cpp
6 | TaskRegistry.hpp TaskRegistry.cpp
7 | FlowManager.hpp FlowManager.cpp
8 | FlowRegistry.hpp FlowRegistry.cpp
9 | )
10 |
11 | target_link_libraries(TaskFlowCore
12 | PUBLIC
13 | Qt::Core
14 | Qt::Concurrent
15 | PRIVATE
16 | QodeAssistLogger
17 | )
18 |
19 | target_include_directories(TaskFlowCore
20 | PUBLIC
21 | ${CMAKE_CURRENT_SOURCE_DIR}
22 | )
23 |
--------------------------------------------------------------------------------
/ChatView/icons/chat-pause-icon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskPortItem.cpp:
--------------------------------------------------------------------------------
1 | #include "TaskPortItem.hpp"
2 |
3 | namespace QodeAssist::TaskFlow {
4 |
5 | TaskPortItem::TaskPortItem(QQuickItem *parent)
6 | : QQuickItem(parent)
7 | {
8 | setObjectName("TaskPortItem");
9 | }
10 |
11 | TaskPort *TaskPortItem::port() const
12 | {
13 | return m_port;
14 | }
15 |
16 | void TaskPortItem::setPort(TaskPort *newPort)
17 | {
18 | if (m_port == newPort)
19 | return;
20 | m_port = newPort;
21 | emit portChanged();
22 | }
23 |
24 | QString TaskPortItem::name() const
25 | {
26 | return m_port->name();
27 | }
28 |
29 | } // namespace QodeAssist::TaskFlow
30 |
--------------------------------------------------------------------------------
/ChatView/icons/apply-changes-button.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/ChatView/icons/file-in-system.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(QodeAssistTest
2 | ../CodeHandler.cpp
3 | ../LLMClientInterface.cpp
4 | ../LLMSuggestion.cpp
5 | CodeHandlerTest.cpp
6 | DocumentContextReaderTest.cpp
7 | LLMSuggestionTest.cpp
8 | # LLMClientInterfaceTests.cpp
9 | unittest_main.cpp
10 | )
11 |
12 | target_link_libraries(QodeAssistTest PRIVATE
13 | Qt::Core
14 | Qt::Test
15 | GTest::GTest
16 | GTest::gmock
17 | GTest::Main
18 | QtCreator::LanguageClient
19 | Context
20 | )
21 |
22 | target_compile_definitions(QodeAssistTest PRIVATE CMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
23 |
24 | add_test(NAME QodeAssistTest COMMAND QodeAssistTest)
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Log**
27 | **Additional context**
28 | Add any other context about the problem here.
29 |
--------------------------------------------------------------------------------
/ChatView/icons/reject-changes-button.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskModel.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace QodeAssist::TaskFlow {
8 |
9 | class TaskModel : public QAbstractListModel
10 | {
11 | Q_OBJECT
12 | public:
13 | enum TaskRoles { TaskIdRole = Qt::UserRole, TaskDataRole };
14 |
15 | TaskModel(Flow *flow, QObject *parent);
16 |
17 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
18 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
19 | QHash roleNames() const override;
20 |
21 | private:
22 | Flow *m_flow;
23 | };
24 |
25 | } // namespace QodeAssist::TaskFlow
26 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskPortItem.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace QodeAssist::TaskFlow {
7 |
8 | class TaskPortItem : public QQuickItem
9 | {
10 | Q_OBJECT
11 | QML_ELEMENT
12 |
13 | Q_PROPERTY(TaskPort *port READ port WRITE setPort NOTIFY portChanged)
14 | Q_PROPERTY(QString name READ name CONSTANT)
15 |
16 | public:
17 | TaskPortItem(QQuickItem *parent = nullptr);
18 |
19 | TaskPort *port() const;
20 | void setPort(TaskPort *newPort);
21 |
22 | QString name() const;
23 |
24 | signals:
25 | void portChanged();
26 |
27 | private:
28 | TaskPort *m_port = nullptr;
29 | };
30 |
31 | } // namespace QodeAssist::TaskFlow
32 |
--------------------------------------------------------------------------------
/docs/llamacpp-configuration.md:
--------------------------------------------------------------------------------
1 | # Configure for llama.cpp
2 |
3 | 1. Open Qt Creator settings and navigate to the QodeAssist section
4 | 2. Go to General tab and configure:
5 | - Set "llama.cpp" as the provider for code completion or/and chat assistant
6 | - Set the llama.cpp URL (e.g. http://localhost:8080)
7 | - Fill in model name
8 | - Choose template for model(e.g. llama.cpp FIM for any model with FIM support)
9 | - Disable using tools if your model doesn't support tooling
10 |
11 |
12 | Example of llama.cpp settings: (click to expand)
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/ChatView/icons/undo-changes-button.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskConnectionsModel.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | namespace QodeAssist::TaskFlow {
9 |
10 | class TaskConnectionsModel : public QAbstractListModel
11 | {
12 | public:
13 | enum TaskConnectionsRoles { TaskConnectionsRole = Qt::UserRole };
14 |
15 | explicit TaskConnectionsModel(Flow *flow, QObject *parent = nullptr);
16 |
17 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
18 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
19 | QHash roleNames() const override;
20 |
21 | private:
22 | Flow *m_flow;
23 | };
24 |
25 | } // namespace QodeAssist::TaskFlow
26 |
--------------------------------------------------------------------------------
/docs/google-ai-configuration.md:
--------------------------------------------------------------------------------
1 | # Configure for Google AI
2 |
3 | 1. Open Qt Creator settings and navigate to the QodeAssist section
4 | 2. Go to Provider Settings tab and configure Google AI api key
5 | 3. Return to General tab and configure:
6 | - Set "Google AI" as the provider for code completion or/and chat assistant
7 | - Set the OpenAI URL (https://generativelanguage.googleapis.com/v1beta)
8 | - Select your preferred model (e.g., gemini-2.0-flash)
9 | - Choose the Google AI template
10 |
11 |
12 | Example of Google AI settings: (click to expand)
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/QodeAssist.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | resources/images/qoderassist-icon@2x.png
4 | resources/images/qoderassist-icon.png
5 | resources/images/repeat-last-instruct-icon@2x.png
6 | resources/images/repeat-last-instruct-icon.png
7 | resources/images/improve-current-code-icon@2x.png
8 | resources/images/improve-current-code-icon.png
9 | resources/images/suggest-new-icon.png
10 | resources/images/suggest-new-icon@2x.png
11 | resources/images/qode-assist-chat-icon.png
12 | resources/images/qode-assist-chat-icon@2x.png
13 |
14 |
15 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskPortModel.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace QodeAssist::TaskFlow {
8 |
9 | class TaskPortModel : public QAbstractListModel
10 | {
11 | Q_OBJECT
12 | public:
13 | enum TaskPortRoles { TaskPortNameRole = Qt::UserRole, TaskPortDataRole };
14 |
15 | TaskPortModel(const QList &ports, QObject *parent = nullptr);
16 |
17 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
18 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
19 | QHash roleNames() const override;
20 |
21 | private:
22 | QList m_ports;
23 | };
24 |
25 | } // namespace QodeAssist::TaskFlow
26 |
--------------------------------------------------------------------------------
/docs/claude-configuration.md:
--------------------------------------------------------------------------------
1 | # Configure for Anthropic Claude
2 |
3 | 1. Open Qt Creator settings and navigate to the QodeAssist section
4 | 2. Go to Provider Settings tab and configure Claude api key
5 | 3. Return to General tab and configure:
6 | - Set "Claude" as the provider for code completion or/and chat assistant
7 | - Set the Claude URL (https://api.anthropic.com)
8 | - Select your preferred model (e.g., claude-3-5-sonnet-20241022)
9 | - Choose the Claude template for code completion or/and chat
10 |
11 |
12 | Example of Claude settings: (click to expand)
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/docs/mistral-configuration.md:
--------------------------------------------------------------------------------
1 | # Configure for Mistral AI
2 |
3 | 1. Open Qt Creator settings and navigate to the QodeAssist section
4 | 2. Go to Provider Settings tab and configure Mistral AI api key
5 | 3. Return to General tab and configure:
6 | - Set "Mistral AI" as the provider for code completion or/and chat assistant
7 | - Set the OpenAI URL (https://api.mistral.ai)
8 | - Select your preferred model (e.g., mistral-large-latest)
9 | - Choose the Mistral AI template for code completion or/and chat
10 |
11 |
12 | Example of Mistral AI settings: (click to expand)
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TaskFlow/core/FlowRegistry.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | namespace QodeAssist::TaskFlow {
9 |
10 | class Flow;
11 | class FlowManager;
12 |
13 | class FlowRegistry : public QObject
14 | {
15 | Q_OBJECT
16 | public:
17 | using FlowCreator = std::function;
18 |
19 | explicit FlowRegistry(QObject *parent = nullptr);
20 |
21 | void registerFlow(const QString &flowType, FlowCreator creator);
22 | Flow *createFlow(const QString &flowType, FlowManager *flowManager = nullptr) const;
23 | QStringList getAvailableTypes() const;
24 |
25 | private:
26 | QHash m_flowCreators;
27 | };
28 |
29 | } // namespace QodeAssist::TaskFlow
30 |
--------------------------------------------------------------------------------
/UIControls/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | qt_add_library(QodeAssistUIControls STATIC)
2 |
3 | qt_policy(SET QTP0001 NEW)
4 | qt_policy(SET QTP0004 NEW)
5 |
6 | qt_add_qml_module(QodeAssistUIControls
7 | URI UIControls
8 | VERSION 1.0
9 | DEPENDENCIES QtQuick
10 | QML_FILES
11 | qml/Badge.qml
12 | qml/QoAButton.qml
13 | qml/QoATextSlider.qml
14 | qml/QoAComboBox.qml
15 | qml/FadeListItemAnimation.qml
16 |
17 | RESOURCES
18 | icons/dropdown-arrow-light.svg
19 | icons/dropdown-arrow-dark.svg
20 | QML_FILES qml/QoASeparator.qml
21 | )
22 |
23 | target_link_libraries(QodeAssistUIControls
24 | PRIVATE
25 | Qt6::Core
26 | Qt6::Quick
27 | )
28 |
29 | target_include_directories(QodeAssistUIControls
30 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
31 | )
32 |
--------------------------------------------------------------------------------
/context/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(Context STATIC
2 | DocumentContextReader.hpp DocumentContextReader.cpp
3 | ChangesManager.h ChangesManager.cpp
4 | ContextManager.hpp ContextManager.cpp
5 | ContentFile.hpp
6 | DocumentReaderQtCreator.hpp
7 | IDocumentReader.hpp
8 | TokenUtils.hpp TokenUtils.cpp
9 | ProgrammingLanguage.hpp ProgrammingLanguage.cpp
10 | IContextManager.hpp
11 | IgnoreManager.hpp IgnoreManager.cpp
12 | ProjectUtils.hpp ProjectUtils.cpp
13 | )
14 |
15 | target_link_libraries(Context
16 | PUBLIC
17 | Qt::Core
18 | QtCreator::Core
19 | QtCreator::TextEditor
20 | QtCreator::Utils
21 | QtCreator::ProjectExplorer
22 | PRIVATE
23 | LLMCore
24 | QodeAssistSettings
25 | )
26 |
27 | target_include_directories(Context PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
28 |
--------------------------------------------------------------------------------
/ChatView/icons/clean-icon-dark.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/logger/Logger.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace QodeAssist {
7 |
8 | class Logger : public QObject
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | static Logger &instance();
14 |
15 | void setLoggingEnabled(bool enable);
16 | bool isLoggingEnabled() const;
17 |
18 | void log(const QString &message, bool silent = true);
19 | void logMessages(const QStringList &messages, bool silent = true);
20 |
21 | private:
22 | Logger();
23 | ~Logger() = default;
24 | Logger(const Logger &) = delete;
25 | Logger &operator=(const Logger &) = delete;
26 |
27 | bool m_loggingEnabled;
28 | };
29 |
30 | #define LOG_MESSAGE(msg) QodeAssist::Logger::instance().log(msg)
31 | #define LOG_MESSAGES(msgs) QodeAssist::Logger::instance().logMessages(msgs)
32 |
33 | } // namespace QodeAssist
34 |
--------------------------------------------------------------------------------
/QodeAssist.json.in:
--------------------------------------------------------------------------------
1 | {
2 | "Id" : "qodeassist",
3 | "Name" : "QodeAssist",
4 | "Version" : "0.9.7",
5 | "CompatVersion" : "${IDE_VERSION}",
6 | "Vendor" : "Petr Mironychev",
7 | "VendorId" : "petrmironychev",
8 | "Copyright" : "(C) ${IDE_COPYRIGHT_YEAR} Petr Mironychev, (C) ${IDE_COPYRIGHT_YEAR} The Qt Company Ltd",
9 | "License" : "GPLv3",
10 | "Description": "QodeAssist is an AI-powered coding assistant for Qt Creator. It provides intelligent code completion and suggestions for your code. Prerequisites: Requires one of the supported LLM providers installed (e.g., Ollama or LM Studio) and a compatible large language model downloaded for your chosen provider (e.g., CodeLlama, StarCoder2).",
11 | "Url" : "https://github.com/Palm1r/QodeAssist",
12 | "DocumentationUrl" : "https://github.com/Palm1r/QodeAssist",
13 | ${IDE_PLUGIN_DEPENDENCIES}
14 | }
15 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/FlowsModel.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | // #include "tasks/Flow.hpp"
7 | #include
8 |
9 | namespace QodeAssist::TaskFlow {
10 |
11 | class FlowsModel : public QAbstractListModel
12 | {
13 | Q_OBJECT
14 | public:
15 | enum FlowRoles { FlowIdRole = Qt::UserRole, FlowDataRole };
16 |
17 | FlowsModel(FlowManager *flowManager, QObject *parent = nullptr);
18 |
19 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
20 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
21 | QHash roleNames() const override;
22 |
23 | public slots:
24 | void onFlowAdded(const QString &flowId);
25 | void onFlowRemoved(const QString &flowId);
26 |
27 | private:
28 | FlowManager *m_flowManager;
29 | };
30 |
31 | } // namespace QodeAssist::TaskFlow
32 |
--------------------------------------------------------------------------------
/ChatView/icons/attach-file-dark.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/ChatView/icons/attach-file-light.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskConnectionsModel.cpp:
--------------------------------------------------------------------------------
1 | #include "TaskConnectionsModel.hpp"
2 |
3 | namespace QodeAssist::TaskFlow {
4 |
5 | TaskConnectionsModel::TaskConnectionsModel(Flow *flow, QObject *parent)
6 | : QAbstractListModel(parent)
7 | , m_flow(flow)
8 | {}
9 |
10 | int TaskConnectionsModel::rowCount(const QModelIndex &parent) const
11 | {
12 | return m_flow->connections().size();
13 | }
14 |
15 | QVariant TaskConnectionsModel::data(const QModelIndex &index, int role) const
16 | {
17 | if (role == TaskConnectionsRoles::TaskConnectionsRole)
18 | return QVariant::fromValue(m_flow->connections().at(index.row()));
19 | return QVariant();
20 | }
21 |
22 | QHash TaskConnectionsModel::roleNames() const
23 | {
24 | QHash roles;
25 | roles[TaskConnectionsRoles::TaskConnectionsRole] = "connectionData";
26 | return roles;
27 | }
28 |
29 | } // namespace QodeAssist::TaskFlow
30 |
--------------------------------------------------------------------------------
/UIControls/qml/QoASeparator.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | import QtQuick
21 |
22 | Rectangle {
23 | id: root
24 |
25 | height: 15
26 | width: 1
27 | color: palette.mid
28 | }
29 |
--------------------------------------------------------------------------------
/settings/ProjectSettingsPanel.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace QodeAssist::Settings {
23 |
24 | void setupProjectPanel();
25 |
26 | } // namespace QodeAssist::Settings
27 |
--------------------------------------------------------------------------------
/ChatView/icons/settings-icon.svg:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: qodeassist
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12 | polar: # Replace with a single Polar username
13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14 | thanks_dev: # Replace with a single thanks.dev username
15 | custom: ['https://www.paypal.com/paypalme/palm1r', 'https://github.com/Palm1r/QodeAssist#support-the-development-of-qodeassist']
16 |
--------------------------------------------------------------------------------
/docs/project-rules.md:
--------------------------------------------------------------------------------
1 | # Project Rules Configuration
2 |
3 | QodeAssist supports project-specific rules to customize AI behavior for your codebase. Create a `.qodeassist/rules/` directory in your project root.
4 |
5 | ## Quick Start
6 |
7 | ```bash
8 | mkdir -p .qodeassist/rules/{common,completion,chat,quickrefactor}
9 | ```
10 |
11 | ## Directory Structure
12 |
13 | ```
14 | .qodeassist/
15 | └── rules/
16 | ├── common/ # Applied to all contexts
17 | ├── completion/ # Code completion only
18 | ├── chat/ # Chat assistant only
19 | └── quickrefactor/ # Quick refactor only
20 | ```
21 |
22 | All `.md` files in each directory are automatically loaded and added to the system prompt.
23 |
24 | ## Example
25 |
26 | Create `.qodeassist/rules/common/general.md`:
27 |
28 | ```markdown
29 | # Project Guidelines
30 | - Use snake_case for private members
31 | - Prefix interfaces with 'I'
32 | - Always document public APIs
33 | - Prefer Qt containers over STL
34 | ```
35 |
36 |
--------------------------------------------------------------------------------
/llmcore/Provider.cpp:
--------------------------------------------------------------------------------
1 | #include "Provider.hpp"
2 |
3 | #include
4 |
5 | namespace QodeAssist::LLMCore {
6 |
7 | Provider::Provider(QObject *parent)
8 | : QObject(parent)
9 | , m_httpClient(new HttpClient(this))
10 | {
11 | connect(m_httpClient, &HttpClient::dataReceived, this, &Provider::onDataReceived);
12 | connect(m_httpClient, &HttpClient::requestFinished, this, &Provider::onRequestFinished);
13 | }
14 |
15 | void Provider::cancelRequest(const RequestID &requestId)
16 | {
17 | m_httpClient->cancelRequest(requestId);
18 | }
19 |
20 | HttpClient *Provider::httpClient() const
21 | {
22 | return m_httpClient;
23 | }
24 |
25 | QJsonObject Provider::parseEventLine(const QString &line)
26 | {
27 | if (!line.startsWith("data: "))
28 | return QJsonObject();
29 |
30 | QString jsonStr = line.mid(6);
31 |
32 | QJsonDocument doc = QJsonDocument::fromJson(jsonStr.toUtf8());
33 | return doc.object();
34 | }
35 |
36 | } // namespace QodeAssist::LLMCore
37 |
--------------------------------------------------------------------------------
/QodeAssisttr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist {
25 |
26 | struct Tr
27 | {
28 | Q_DECLARE_TR_FUNCTIONS(QtC::QodeAssist)
29 | };
30 |
31 | } // namespace QodeAssist
32 |
--------------------------------------------------------------------------------
/llmcore/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(LLMCore STATIC
2 | RequestType.hpp
3 | Provider.hpp Provider.cpp
4 | ProvidersManager.hpp ProvidersManager.cpp
5 | ContextData.hpp
6 | IPromptProvider.hpp
7 | IProviderRegistry.hpp
8 | PromptProviderChat.hpp
9 | PromptProviderFim.hpp
10 | PromptTemplate.hpp
11 | PromptTemplateManager.hpp PromptTemplateManager.cpp
12 | RequestConfig.hpp
13 | ValidationUtils.hpp ValidationUtils.cpp
14 | ProviderID.hpp
15 | HttpClient.hpp HttpClient.cpp
16 | DataBuffers.hpp
17 | SSEBuffer.hpp SSEBuffer.cpp
18 | BaseTool.hpp BaseTool.cpp
19 | ContentBlocks.hpp
20 | RulesLoader.hpp RulesLoader.cpp
21 | ResponseCleaner.hpp
22 | )
23 |
24 | target_link_libraries(LLMCore
25 | PUBLIC
26 | Qt::Core
27 | Qt::Network
28 | QtCreator::Core
29 | QtCreator::Utils
30 | QtCreator::ExtensionSystem
31 | PRIVATE
32 | QodeAssistLogger
33 | )
34 |
35 | target_include_directories(LLMCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
36 |
--------------------------------------------------------------------------------
/settings/Assisttr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist {
25 |
26 | struct Tr
27 | {
28 | Q_DECLARE_TR_FUNCTIONS(QtC::QodeAssist)
29 | };
30 |
31 | } // namespace QodeAssist
32 |
--------------------------------------------------------------------------------
/ChatView/icons/open-in-editor.svg:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/llmcore/RequestType.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #pragma once
23 |
24 | namespace QodeAssist::LLMCore {
25 |
26 | enum RequestType { CodeCompletion, Chat, Embedding, QuickRefactoring };
27 |
28 | using RequestID = QString;
29 | }
30 |
--------------------------------------------------------------------------------
/context/ContentFile.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Context {
25 |
26 | struct ContentFile
27 | {
28 | QString filename;
29 | QString content;
30 | };
31 |
32 | } // namespace QodeAssist::Context
33 |
--------------------------------------------------------------------------------
/Version.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #define QODEASSIST_QT_CREATOR_VERSION \
25 | QT_VERSION_CHECK( \
26 | QODEASSIST_QT_CREATOR_VERSION_MAJOR, \
27 | QODEASSIST_QT_CREATOR_VERSION_MINOR, \
28 | QODEASSIST_QT_CREATOR_VERSION_PATCH)
29 |
--------------------------------------------------------------------------------
/llmcore/ProviderID.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | namespace QodeAssist::LLMCore {
21 |
22 | enum class ProviderID {
23 | Any,
24 | Ollama,
25 | LMStudio,
26 | Claude,
27 | OpenAI,
28 | OpenAICompatible,
29 | OpenAIResponses,
30 | MistralAI,
31 | OpenRouter,
32 | GoogleAI,
33 | LlamaCpp
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/llmcore/RequestHandlerBase.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "RequestHandlerBase.hpp"
21 |
22 | namespace QodeAssist::LLMCore {
23 |
24 | RequestHandlerBase::RequestHandlerBase(QObject *parent)
25 | : QObject(parent)
26 | {}
27 |
28 | RequestHandlerBase::~RequestHandlerBase() = default;
29 |
30 | } // namespace QodeAssist::LLMCore
31 |
--------------------------------------------------------------------------------
/ChatView/ChatData.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 | Q_NAMESPACE
27 | QML_NAMED_ELEMENT(MessagePartType)
28 |
29 | enum class MessagePartType { Code, Text, Image };
30 | Q_ENUM_NS(MessagePartType)
31 |
32 | } // namespace QodeAssist::Chat
33 |
--------------------------------------------------------------------------------
/QodeAssistConstants.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace QodeAssist::Constants {
23 |
24 | const char ACTION_ID[] = "QodeAssist.Action";
25 | const char MENU_ID[] = "QodeAssist.Menu";
26 |
27 | const char QODE_ASSIST_REQUEST_SUGGESTION[] = "QodeAssist.RequestSuggestion";
28 |
29 | } // namespace QodeAssist::Constants
30 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | qt_add_library(TaskFlowEditor STATIC)
2 |
3 | qt_policy(SET QTP0001 NEW)
4 | qt_policy(SET QTP0004 NEW)
5 |
6 | qt_add_qml_module(TaskFlowEditor
7 | URI TaskFlow.Editor
8 | VERSION 1.0
9 | DEPENDENCIES QtQuick
10 | RESOURCES
11 | QML_FILES
12 | qml/FlowEditorView.qml
13 | qml/Flow.qml
14 | qml/Task.qml
15 | qml/TaskPort.qml
16 | qml/TaskParameter.qml
17 | qml/TaskConnection.qml
18 | SOURCES
19 | FlowEditor.hpp FlowEditor.cpp
20 | FlowsModel.hpp FlowsModel.cpp
21 | TaskItem.hpp TaskItem.cpp
22 | FlowItem.hpp FlowItem.cpp
23 | TaskModel.hpp TaskModel.cpp
24 | TaskPortItem.hpp TaskPortItem.cpp
25 | TaskPortModel.hpp TaskPortModel.cpp
26 | TaskConnectionsModel.hpp TaskConnectionsModel.cpp
27 | TaskConnectionItem.hpp TaskConnectionItem.cpp
28 | GridBackground.hpp GridBackground.cpp
29 | )
30 |
31 | target_link_libraries(TaskFlowEditor
32 | PUBLIC
33 | Qt::Quick
34 | PRIVATE
35 | TaskFlowCore
36 | )
37 |
38 | target_include_directories(TaskFlowEditor
39 | PUBLIC
40 | ${CMAKE_CURRENT_LIST_DIR}
41 | )
42 |
--------------------------------------------------------------------------------
/docs/ignoring-files.md:
--------------------------------------------------------------------------------
1 | # Ignoring Files
2 |
3 | QodeAssist supports the ability to ignore files in context using a `.qodeassistignore` file. This allows you to exclude specific files from the context during code completion and in the chat assistant, which is especially useful for large projects.
4 |
5 | ## How to Use .qodeassistignore
6 |
7 | - Create a `.qodeassistignore` file in the root directory of your project near CMakeLists.txt or pro.
8 | - Add patterns for files and directories that should be excluded from the context.
9 | - QodeAssist will automatically detect this file and apply the exclusion rules.
10 |
11 | ## .qodeassistignore File Format
12 |
13 | The file format is similar to `.gitignore`:
14 | - Each pattern is written on a separate line
15 | - Empty lines are ignored
16 | - Lines starting with `#` are considered comments
17 | - Standard wildcards work the same as in .gitignore
18 | - To negate a pattern, use `!` at the beginning of the line
19 |
20 | ## Example
21 |
22 | ```
23 | # Ignore all files in the build directory
24 | /build
25 | *.tmp
26 | # Ignore a specific file
27 | src/generated/autogen.cpp
28 | ```
29 |
30 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskModel.cpp:
--------------------------------------------------------------------------------
1 | #include "TaskModel.hpp"
2 |
3 | namespace QodeAssist::TaskFlow {
4 |
5 | TaskModel::TaskModel(Flow *flow, QObject *parent)
6 | : QAbstractListModel(parent)
7 | , m_flow(flow)
8 | {}
9 |
10 | int TaskModel::rowCount(const QModelIndex &parent) const
11 | {
12 | return m_flow->tasks().size();
13 | }
14 |
15 | QVariant TaskModel::data(const QModelIndex &index, int role) const
16 | {
17 | if (!index.isValid() || !m_flow || index.row() >= m_flow->tasks().size())
18 | return QVariant();
19 |
20 | const auto &task = m_flow->tasks().values();
21 |
22 | switch (role) {
23 | case TaskRoles::TaskIdRole:
24 | return task.at(index.row())->taskId();
25 | case TaskRoles::TaskDataRole:
26 | return QVariant::fromValue(task.at(index.row()));
27 | default:
28 | return QVariant();
29 | }
30 | }
31 |
32 | QHash TaskModel::roleNames() const
33 | {
34 | QHash roles;
35 | roles[TaskRoles::TaskIdRole] = "taskId";
36 | roles[TaskRoles::TaskDataRole] = "taskData";
37 | return roles;
38 | }
39 |
40 | } // namespace QodeAssist::TaskFlow
41 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskPortModel.cpp:
--------------------------------------------------------------------------------
1 | #include "TaskPortModel.hpp"
2 | #include "TaskPort.hpp"
3 |
4 | namespace QodeAssist::TaskFlow {
5 |
6 | TaskPortModel::TaskPortModel(const QList &ports, QObject *parent)
7 | : QAbstractListModel(parent)
8 | , m_ports(ports)
9 | {}
10 |
11 | int TaskPortModel::rowCount(const QModelIndex &parent) const
12 | {
13 | return m_ports.size();
14 | }
15 |
16 | QVariant TaskPortModel::data(const QModelIndex &index, int role) const
17 | {
18 | if (!index.isValid() || index.row() >= m_ports.size())
19 | return QVariant();
20 |
21 | switch (role) {
22 | case TaskPortRoles::TaskPortNameRole:
23 | return m_ports.at(index.row())->name();
24 | case TaskPortRoles::TaskPortDataRole:
25 | return QVariant::fromValue(m_ports.at(index.row()));
26 | default:
27 | return QVariant();
28 | }
29 | }
30 |
31 | QHash TaskPortModel::roleNames() const
32 | {
33 | QHash roles;
34 | roles[TaskPortRoles::TaskPortNameRole] = "taskPortName";
35 | roles[TaskPortRoles::TaskPortDataRole] = "taskPortData";
36 | return roles;
37 | }
38 |
39 | } // namespace QodeAssist::TaskFlow
40 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 | .qmlls.ini
38 |
39 | # qtcreator generated files
40 | *.pro.user*
41 | CMakeLists.txt.user*
42 |
43 | # xemacs temporary files
44 | *.flc
45 |
46 | # Vim temporary files
47 | .*.swp
48 |
49 | # Visual Studio generated files
50 | *.ib_pdb_index
51 | *.idb
52 | *.ilk
53 | *.pdb
54 | *.sln
55 | *.suo
56 | *.vcproj
57 | *vcproj.*.*.user
58 | *.ncb
59 | *.sdf
60 | *.opensdf
61 | *.vcxproj
62 | *vcxproj.*
63 |
64 | # MinGW generated files
65 | *.Debug
66 | *.Release
67 |
68 | # Python byte code
69 | *.pyc
70 |
71 | # Binaries
72 | # --------
73 | *.dll
74 | *.exe
75 |
76 | /build
77 | /.qodeassist
78 | /.cursor
79 | /.vscode
80 | .qtc_clangd/compile_commands.json
81 |
--------------------------------------------------------------------------------
/llmcore/DataBuffers.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "SSEBuffer.hpp"
23 | #include
24 |
25 | namespace QodeAssist::LLMCore {
26 |
27 | struct DataBuffers
28 | {
29 | SSEBuffer rawStreamBuffer;
30 | QString responseContent;
31 |
32 | void clear()
33 | {
34 | rawStreamBuffer.clear();
35 | responseContent.clear();
36 | }
37 | };
38 |
39 | } // namespace QodeAssist::LLMCore
40 |
--------------------------------------------------------------------------------
/llmcore/IProviderRegistry.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "Provider.hpp"
23 |
24 | namespace QodeAssist::LLMCore {
25 |
26 | class IProviderRegistry
27 | {
28 | public:
29 | virtual ~IProviderRegistry() = default;
30 |
31 | virtual Provider *getProviderByName(const QString &providerName) = 0;
32 |
33 | virtual QStringList providersNames() const = 0;
34 | };
35 |
36 | } // namespace QodeAssist::LLMCore
37 |
--------------------------------------------------------------------------------
/providers/CodestralProvider.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "MistralAIProvider.hpp"
23 |
24 | namespace QodeAssist::Providers {
25 |
26 | class CodestralProvider : public MistralAIProvider
27 | {
28 | public:
29 | QString name() const override;
30 | QString url() const override;
31 | bool supportsModelListing() const override;
32 | QString apiKey() const override;
33 | };
34 |
35 | } // namespace QodeAssist::Providers
36 |
--------------------------------------------------------------------------------
/chat/NavigationPanel.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 |
27 | class NavigationPanel : public Core::INavigationWidgetFactory
28 | {
29 | Q_OBJECT
30 | public:
31 | explicit NavigationPanel();
32 | ~NavigationPanel();
33 |
34 | Core::NavigationView createWidget() override;
35 | };
36 |
37 | } // namespace QodeAssist::Chat
38 |
--------------------------------------------------------------------------------
/context/Utils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Context {
25 |
26 | inline QString extractFilePathFromRequest(const QJsonObject &request)
27 | {
28 | QJsonObject params = request["params"].toObject();
29 | QJsonObject doc = params["doc"].toObject();
30 | QString uri = doc["uri"].toString();
31 | return QUrl(uri).toLocalFile();
32 | }
33 |
34 | } // namespace QodeAssist::Context
35 |
--------------------------------------------------------------------------------
/providers/OpenRouterAIProvider.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "providers/OpenAICompatProvider.hpp"
23 |
24 | namespace QodeAssist::Providers {
25 |
26 | class OpenRouterProvider : public OpenAICompatProvider
27 | {
28 | public:
29 | QString name() const override;
30 | QString url() const override;
31 | QString apiKey() const override;
32 | LLMCore::ProviderID providerID() const override;
33 | };
34 |
35 | } // namespace QodeAssist::Providers
36 |
--------------------------------------------------------------------------------
/context/TokenUtils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ContentFile.hpp"
23 | #include
24 | #include
25 |
26 | namespace QodeAssist::Context {
27 |
28 | class TokenUtils
29 | {
30 | public:
31 | static int estimateTokens(const QString &text);
32 | static int estimateFileTokens(const Context::ContentFile &file);
33 | static int estimateFilesTokens(const QList &files);
34 | };
35 |
36 | } // namespace QodeAssist::Context
37 |
--------------------------------------------------------------------------------
/settings/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(QodeAssistSettings STATIC
2 | GeneralSettings.hpp GeneralSettings.cpp
3 | CustomPromptSettings.hpp CustomPromptSettings.cpp
4 | ConfigurationManager.hpp ConfigurationManager.cpp
5 | SettingsUtils.hpp
6 | SettingsConstants.hpp
7 | ButtonAspect.hpp
8 | SettingsTr.hpp
9 | CodeCompletionSettings.hpp CodeCompletionSettings.cpp
10 | ChatAssistantSettings.hpp ChatAssistantSettings.cpp
11 | QuickRefactorSettings.hpp QuickRefactorSettings.cpp
12 | ToolsSettings.hpp ToolsSettings.cpp
13 | SettingsDialog.hpp SettingsDialog.cpp
14 | ProjectSettings.hpp ProjectSettings.cpp
15 | ProjectSettingsPanel.hpp ProjectSettingsPanel.cpp
16 | ProviderSettings.hpp ProviderSettings.cpp
17 | PluginUpdater.hpp PluginUpdater.cpp
18 | UpdateDialog.hpp UpdateDialog.cpp
19 | AgentRole.hpp AgentRole.cpp
20 | AgentRoleDialog.hpp AgentRoleDialog.cpp
21 | AgentRolesWidget.hpp AgentRolesWidget.cpp
22 | )
23 |
24 | target_link_libraries(QodeAssistSettings
25 | PUBLIC
26 | Qt::Core
27 | Qt::Widgets
28 | Qt::Network
29 | QtCreator::Core
30 | QtCreator::Utils
31 | QodeAssistLogger
32 | )
33 | target_include_directories(QodeAssistSettings PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
34 |
--------------------------------------------------------------------------------
/llmcore/SSEBuffer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::LLMCore {
26 |
27 | class SSEBuffer
28 | {
29 | public:
30 | SSEBuffer() = default;
31 |
32 | QStringList processData(const QByteArray &data);
33 |
34 | void clear();
35 | QString currentBuffer() const;
36 | bool hasIncompleteData() const;
37 |
38 | private:
39 | QString m_buffer;
40 | };
41 |
42 | } // namespace QodeAssist::LLMCore
43 |
--------------------------------------------------------------------------------
/ChatView/icons/rules-icon.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/ChatView/ChatWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Chat {
25 |
26 | class ChatWidget : public QQuickWidget
27 | {
28 | Q_OBJECT
29 |
30 | public:
31 | explicit ChatWidget(QWidget *parent = nullptr);
32 | ~ChatWidget() = default;
33 |
34 | Q_INVOKABLE void clear();
35 | Q_INVOKABLE void scrollToBottom();
36 |
37 | signals:
38 | void clearPressed();
39 | };
40 |
41 | } // namespace QodeAssist::Chat
42 |
--------------------------------------------------------------------------------
/context/IDocumentReader.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Context {
25 |
26 | struct DocumentInfo
27 | {
28 | QTextDocument *document = nullptr; // not owned
29 | QString mimeType;
30 | QString filePath;
31 | };
32 |
33 | class IDocumentReader
34 | {
35 | public:
36 | virtual ~IDocumentReader() = default;
37 |
38 | virtual DocumentInfo readDocument(const QString &path) const = 0;
39 | };
40 |
41 | } // namespace QodeAssist::Context
42 |
--------------------------------------------------------------------------------
/logger/EmptyRequestPerformanceLogger.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "IRequestPerformanceLogger.hpp"
21 |
22 | namespace QodeAssist {
23 |
24 | class EmptyRequestPerformanceLogger : public IRequestPerformanceLogger
25 | {
26 | public:
27 | void startTimeMeasurement(const QString &requestId) override {}
28 | void endTimeMeasurement(const QString &requestId) override {}
29 | void logPerformance(const QString &requestId, qint64 elapsedMs) override {}
30 | };
31 |
32 | } // namespace QodeAssist
33 |
--------------------------------------------------------------------------------
/logger/IRequestPerformanceLogger.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist {
25 |
26 | class IRequestPerformanceLogger
27 | {
28 | public:
29 | virtual ~IRequestPerformanceLogger() = default;
30 |
31 | virtual void startTimeMeasurement(const QString &requestId) = 0;
32 | virtual void endTimeMeasurement(const QString &requestId) = 0;
33 | virtual void logPerformance(const QString &requestId, qint64 elapsedMs) = 0;
34 | };
35 |
36 | } // namespace QodeAssist
37 |
--------------------------------------------------------------------------------
/llmcore/RequestConfig.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "PromptTemplate.hpp"
23 | #include "Provider.hpp"
24 | #include "RequestType.hpp"
25 | #include
26 | #include
27 |
28 | namespace QodeAssist::LLMCore {
29 |
30 | struct LLMConfig
31 | {
32 | QUrl url;
33 | Provider *provider;
34 | PromptTemplate *promptTemplate;
35 | QJsonObject providerRequest;
36 | RequestType requestType;
37 | bool multiLineCompletion;
38 | QString apiKey;
39 | };
40 |
41 | } // namespace QodeAssist::LLMCore
42 |
--------------------------------------------------------------------------------
/ChatView/ChatUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 |
27 | class ChatUtils : public QObject
28 | {
29 | Q_OBJECT
30 | QML_NAMED_ELEMENT(ChatUtils)
31 |
32 | public:
33 | explicit ChatUtils(QObject *parent = nullptr)
34 | : QObject(parent) {};
35 |
36 | Q_INVOKABLE void copyToClipboard(const QString &text);
37 | Q_INVOKABLE QString getSafeMarkdownText(const QString &text) const;
38 | };
39 |
40 | } // namespace QodeAssist::Chat
41 |
--------------------------------------------------------------------------------
/llmcore/IPromptProvider.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "PromptTemplate.hpp"
23 | #include
24 |
25 | namespace QodeAssist::LLMCore {
26 |
27 | class IPromptProvider
28 | {
29 | public:
30 | virtual ~IPromptProvider() = default;
31 |
32 | virtual PromptTemplate *getTemplateByName(const QString &templateName) const = 0;
33 |
34 | virtual QStringList templatesNames() const = 0;
35 |
36 | virtual QStringList getTemplatesForProvider(ProviderID id) const = 0;
37 | };
38 |
39 | } // namespace QodeAssist::LLMCore
40 |
--------------------------------------------------------------------------------
/context/ProgrammingLanguage.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Context {
25 |
26 | enum class ProgrammingLanguage {
27 | QML, // QML/JavaScript
28 | Cpp, // C/C++
29 | Python,
30 | Unknown,
31 | };
32 |
33 | namespace ProgrammingLanguageUtils {
34 |
35 | ProgrammingLanguage fromMimeType(const QString &mimeType);
36 |
37 | QString toString(ProgrammingLanguage language);
38 |
39 | ProgrammingLanguage fromString(const QString &str);
40 |
41 | } // namespace ProgrammingLanguageUtils
42 |
43 | } // namespace QodeAssist::Context
44 |
--------------------------------------------------------------------------------
/RefactorSuggestion.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist {
26 |
27 | class RefactorSuggestion : public TextEditor::TextSuggestion
28 | {
29 | public:
30 | RefactorSuggestion(const Data &suggestion, QTextDocument *sourceDocument);
31 |
32 | bool apply() override;
33 |
34 | bool applyWord(TextEditor::TextEditorWidget *widget) override;
35 |
36 | bool applyLine(TextEditor::TextEditorWidget *widget) override;
37 |
38 | private:
39 | Data m_suggestionData;
40 | };
41 |
42 | } // namespace QodeAssist
43 |
44 |
--------------------------------------------------------------------------------
/logger/Logger.cpp:
--------------------------------------------------------------------------------
1 | #include "Logger.hpp"
2 | #include
3 |
4 | namespace QodeAssist {
5 |
6 | Logger &Logger::instance()
7 | {
8 | static Logger instance;
9 | return instance;
10 | }
11 |
12 | Logger::Logger()
13 | : m_loggingEnabled(false)
14 | {}
15 |
16 | void Logger::setLoggingEnabled(bool enable)
17 | {
18 | m_loggingEnabled = enable;
19 | }
20 |
21 | bool Logger::isLoggingEnabled() const
22 | {
23 | return m_loggingEnabled;
24 | }
25 |
26 | void Logger::log(const QString &message, bool silent)
27 | {
28 | if (!m_loggingEnabled)
29 | return;
30 |
31 | const QString prefixedMessage = QLatin1String("[QodeAssist] ") + message;
32 | if (silent) {
33 | Core::MessageManager::writeSilently(prefixedMessage);
34 | } else {
35 | Core::MessageManager::writeFlashing(prefixedMessage);
36 | }
37 | }
38 |
39 | void Logger::logMessages(const QStringList &messages, bool silent)
40 | {
41 | if (!m_loggingEnabled)
42 | return;
43 |
44 | QStringList prefixedMessages;
45 | for (const QString &message : messages) {
46 | prefixedMessages << (QLatin1String("[QodeAssist] ") + message);
47 | }
48 |
49 | if (silent) {
50 | Core::MessageManager::writeSilently(prefixedMessages);
51 | } else {
52 | Core::MessageManager::writeFlashing(prefixedMessages);
53 | }
54 | }
55 | } // namespace QodeAssist
56 |
--------------------------------------------------------------------------------
/test/unittest_main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 |
24 | void silenceQtWarningNoise(QtMsgType type, const QMessageLogContext &context, const QString &msg)
25 | {
26 | if (msg.startsWith("SOFT ASSERT") || msg.startsWith("Accessing MimeDatabase")) {
27 | return;
28 | }
29 | qt_message_output(type, context, msg);
30 | }
31 |
32 | int main(int argc, char *argv[])
33 | {
34 | qInstallMessageHandler(silenceQtWarningNoise);
35 | QGuiApplication application(argc, argv);
36 | testing::InitGoogleTest(&argc, argv);
37 | return RUN_ALL_TESTS();
38 | }
39 |
--------------------------------------------------------------------------------
/providers/CodestralProvider.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "CodestralProvider.hpp"
21 |
22 | #include "settings/ProviderSettings.hpp"
23 |
24 | namespace QodeAssist::Providers {
25 |
26 | QString CodestralProvider::name() const
27 | {
28 | return "Codestral";
29 | }
30 |
31 | QString CodestralProvider::url() const
32 | {
33 | return "https://codestral.mistral.ai";
34 | }
35 |
36 | bool CodestralProvider::supportsModelListing() const
37 | {
38 | return false;
39 | }
40 |
41 | QString CodestralProvider::apiKey() const
42 | {
43 | return Settings::providerSettings().codestralApiKey();
44 | }
45 |
46 | } // namespace QodeAssist::Providers
47 |
--------------------------------------------------------------------------------
/widgets/CompletionHintWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist {
25 |
26 | class CompletionHintWidget : public QWidget
27 | {
28 | Q_OBJECT
29 | public:
30 | explicit CompletionHintWidget(QWidget *parent = nullptr, int fontSize = 12);
31 | ~CompletionHintWidget() override = default;
32 |
33 | protected:
34 | void paintEvent(QPaintEvent *event) override;
35 | void enterEvent(QEnterEvent *event) override;
36 | void leaveEvent(QEvent *event) override;
37 |
38 | private:
39 | QColor m_accentColor;
40 | bool m_isHovered;
41 | };
42 |
43 | } // namespace QodeAssist
44 |
45 |
--------------------------------------------------------------------------------
/ChatView/ChatWidget.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "ChatWidget.hpp"
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 |
27 | ChatWidget::ChatWidget(QWidget *parent)
28 | : QQuickWidget(parent)
29 | {
30 | setSource(QUrl("qrc:/qt/qml/ChatView/qml/RootItem.qml"));
31 | setResizeMode(QQuickWidget::SizeRootObjectToView);
32 | }
33 |
34 | void ChatWidget::clear()
35 | {
36 | QMetaObject::invokeMethod(rootObject(), "clearChat");
37 | }
38 |
39 | void ChatWidget::scrollToBottom()
40 | {
41 | QMetaObject::invokeMethod(rootObject(), "scrollToBottom");
42 | }
43 | } // namespace QodeAssist::Chat
44 |
--------------------------------------------------------------------------------
/chat/NavigationPanel.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "NavigationPanel.hpp"
21 |
22 | #include "ChatView/ChatWidget.hpp"
23 |
24 | namespace QodeAssist::Chat {
25 |
26 | NavigationPanel::NavigationPanel()
27 | {
28 | setDisplayName(tr("QodeAssist Chat"));
29 | setPriority(500);
30 | setId("QodeAssistChat");
31 | setActivationSequence(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_C));
32 | }
33 |
34 | NavigationPanel::~NavigationPanel() {}
35 |
36 | Core::NavigationView NavigationPanel::createWidget()
37 | {
38 | Core::NavigationView view;
39 | view.widget = new ChatWidget;
40 |
41 | return view;
42 | }
43 |
44 | } // namespace QodeAssist::Chat
45 |
--------------------------------------------------------------------------------
/TaskFlow/core/FlowRegistry.cpp:
--------------------------------------------------------------------------------
1 | #include "FlowRegistry.hpp"
2 | #include "Logger.hpp"
3 |
4 | namespace QodeAssist::TaskFlow {
5 |
6 | FlowRegistry::FlowRegistry(QObject *parent)
7 | : QObject(parent)
8 | {}
9 |
10 | void FlowRegistry::registerFlow(const QString &flowType, FlowCreator creator)
11 | {
12 | m_flowCreators[flowType] = creator;
13 | LOG_MESSAGE(QString("FlowRegistry: Registered flow type '%1'").arg(flowType));
14 | }
15 |
16 | Flow *FlowRegistry::createFlow(const QString &flowType, FlowManager *flowManager) const
17 | {
18 | LOG_MESSAGE(QString("Trying to create flow: %1").arg(flowType));
19 |
20 | if (m_flowCreators.contains(flowType)) {
21 | LOG_MESSAGE(QString("Found creator for flow type: %1").arg(flowType));
22 | try {
23 | Flow *flow = m_flowCreators[flowType](flowManager);
24 | if (flow) {
25 | LOG_MESSAGE(QString("Successfully created flow: %1").arg(flowType));
26 | return flow;
27 | }
28 | } catch (...) {
29 | LOG_MESSAGE(QString("Exception while creating flow of type: %1").arg(flowType));
30 | }
31 | } else {
32 | LOG_MESSAGE(QString("No creator found for flow type: %1").arg(flowType));
33 | }
34 |
35 | return nullptr;
36 | }
37 |
38 | QStringList FlowRegistry::getAvailableTypes() const
39 | {
40 | return m_flowCreators.keys();
41 | }
42 |
43 | } // namespace QodeAssist::TaskFlow
44 |
--------------------------------------------------------------------------------
/llmcore/ValidationUtils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::LLMCore {
26 |
27 | class ValidationUtils
28 | {
29 | public:
30 | static QStringList validateRequestFields(
31 | const QJsonObject &request, const QJsonObject &templateObj);
32 |
33 | private:
34 | static void validateFields(
35 | const QJsonObject &request, const QJsonObject &templateObj, QStringList &errors);
36 |
37 | static void validateNestedObjects(
38 | const QJsonObject &request, const QJsonObject &templateObj, QStringList &errors);
39 | };
40 |
41 | } // namespace QodeAssist::LLMCore
42 |
--------------------------------------------------------------------------------
/ChatView/FileItem.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Chat {
25 |
26 | class FileItem: public QQuickItem
27 | {
28 | Q_OBJECT
29 | QML_NAMED_ELEMENT(FileItem)
30 |
31 | Q_PROPERTY(QString filePath READ filePath WRITE setFilePath NOTIFY filePathChanged)
32 |
33 | public:
34 | FileItem(QQuickItem *parent = nullptr);
35 |
36 | Q_INVOKABLE void openFileInEditor();
37 | Q_INVOKABLE void openFileInExternalEditor();
38 |
39 | QString filePath() const;
40 | void setFilePath(const QString &newFilePath);
41 |
42 | signals:
43 | void filePathChanged();
44 |
45 | private:
46 | QString m_filePath;
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskItem.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "TaskPortModel.hpp"
6 | #include
7 | #include
8 |
9 | namespace QodeAssist::TaskFlow {
10 |
11 | class TaskItem : public QQuickItem
12 | {
13 | Q_OBJECT
14 | QML_ELEMENT
15 |
16 | Q_PROPERTY(QString taskId READ taskId WRITE setTaskId NOTIFY taskIdChanged)
17 | Q_PROPERTY(QString taskType READ taskType NOTIFY taskTypeChanged)
18 | Q_PROPERTY(BaseTask *task READ task WRITE setTask NOTIFY taskChanged)
19 | Q_PROPERTY(TaskPortModel *inputPorts READ inputPorts NOTIFY inputPortsChanged)
20 | Q_PROPERTY(TaskPortModel *outputPorts READ outputPorts NOTIFY outputPortsChanged)
21 |
22 | public:
23 | TaskItem(QQuickItem *parent = nullptr);
24 |
25 | QString taskId() const;
26 | void setTaskId(const QString &newTaskId);
27 | QString taskType() const;
28 |
29 | BaseTask *task() const;
30 | void setTask(BaseTask *newTask);
31 |
32 | TaskPortModel *inputPorts() const;
33 | TaskPortModel *outputPorts() const;
34 |
35 | signals:
36 | void taskIdChanged();
37 | void taskTypeChanged();
38 | void taskChanged();
39 | void inputPortsChanged();
40 | void outputPortsChanged();
41 |
42 | private:
43 | QString m_taskId;
44 | BaseTask *m_task = nullptr;
45 | TaskPortModel *m_inputPorts = nullptr;
46 | TaskPortModel *m_outputPorts = nullptr;
47 | };
48 |
49 | } // namespace QodeAssist::TaskFlow
50 |
--------------------------------------------------------------------------------
/llmcore/SSEBuffer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "SSEBuffer.hpp"
21 |
22 | namespace QodeAssist::LLMCore {
23 |
24 | QStringList SSEBuffer::processData(const QByteArray &data)
25 | {
26 | m_buffer += QString::fromUtf8(data);
27 |
28 | QStringList lines = m_buffer.split('\n');
29 | m_buffer = lines.takeLast();
30 |
31 | lines.removeAll(QString());
32 |
33 | return lines;
34 | }
35 |
36 | void SSEBuffer::clear()
37 | {
38 | m_buffer.clear();
39 | }
40 |
41 | QString SSEBuffer::currentBuffer() const
42 | {
43 | return m_buffer;
44 | }
45 |
46 | bool SSEBuffer::hasIncompleteData() const
47 | {
48 | return !m_buffer.isEmpty();
49 | }
50 |
51 | } // namespace QodeAssist::LLMCore
52 |
--------------------------------------------------------------------------------
/docs/file-context.md:
--------------------------------------------------------------------------------
1 | # File Context Feature
2 |
3 | QodeAssist provides two powerful ways to include source code files in your chat conversations: Attachments and Linked Files. Each serves a distinct purpose and helps provide better context for the AI assistant.
4 |
5 | ## Attached Files
6 |
7 | Attachments are designed for one-time code analysis and specific queries:
8 | - Files are included only in the current message
9 | - Content is discarded after the message is processed
10 | - Ideal for:
11 | - Getting specific feedback on code changes
12 | - Code review requests
13 | - Analyzing isolated code segments
14 | - Quick implementation questions
15 | - Files can be attached using the paperclip icon in the chat interface
16 | - Multiple files can be attached to a single message
17 |
18 | ## Linked Files
19 |
20 | Linked files provide persistent context throughout the conversation:
21 |
22 | - Files remain accessible for the entire chat session
23 | - Content is included in every message exchange
24 | - Files are automatically refreshed - always using latest content from disk
25 | - Perfect for:
26 | - Long-term refactoring discussions
27 | - Complex architectural changes
28 | - Multi-file implementations
29 | - Maintaining context across related questions
30 | - Can be managed using the link icon in the chat interface
31 | - Supports automatic syncing with open editor files (can be enabled in settings)
32 | - Files can be added/removed at any time during the conversation
33 |
34 |
--------------------------------------------------------------------------------
/UIControls/qml/Badge.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | import QtQuick
21 |
22 | Rectangle {
23 | id: root
24 |
25 | property alias text: badgeText.text
26 | property alias hovered: mouse.hovered
27 |
28 | implicitWidth: badgeText.implicitWidth + root.radius
29 | implicitHeight: badgeText.implicitHeight + 6
30 | color: palette.button
31 | radius: root.height / 2
32 | border.color: palette.mid
33 | border.width: 1
34 |
35 | Text {
36 | id: badgeText
37 |
38 | anchors.centerIn: parent
39 | color: palette.buttonText
40 | }
41 |
42 | HoverHandler {
43 | id: mouse
44 |
45 | acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/settings/ProjectSettings.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace ProjectExplorer {
25 | class Project;
26 | }
27 |
28 | namespace QodeAssist::Settings {
29 |
30 | class ProjectSettings : public Utils::AspectContainer
31 | {
32 | public:
33 | explicit ProjectSettings(ProjectExplorer::Project *project);
34 | void save(ProjectExplorer::Project *project);
35 |
36 | void setUseGlobalSettings(bool useGlobalSettings);
37 | bool isEnabled() const;
38 |
39 | Utils::BoolAspect enableQodeAssist{this};
40 | Utils::BoolAspect useGlobalSettings{this};
41 | Utils::FilePathAspect chatHistoryPath{this};
42 | };
43 |
44 | } // namespace QodeAssist::Settings
45 |
--------------------------------------------------------------------------------
/tools/EditFileTool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Tools {
25 |
26 | class EditFileTool : public LLMCore::BaseTool
27 | {
28 | Q_OBJECT
29 | public:
30 | explicit EditFileTool(QObject *parent = nullptr);
31 |
32 | QString name() const override;
33 | QString stringName() const override;
34 | QString description() const override;
35 | QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
36 | LLMCore::ToolPermissions requiredPermissions() const override;
37 |
38 | QFuture executeAsync(const QJsonObject &input = QJsonObject()) override;
39 | };
40 |
41 | } // namespace QodeAssist::Tools
42 |
43 |
--------------------------------------------------------------------------------
/ChatView/ChatView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 |
27 | class ChatView : public QQuickView
28 | {
29 | Q_OBJECT
30 | Q_PROPERTY(bool isPin READ isPin WRITE setIsPin NOTIFY isPinChanged FINAL)
31 | public:
32 | ChatView();
33 |
34 | bool isPin() const;
35 | void setIsPin(bool newIsPin);
36 |
37 | signals:
38 | void isPinChanged();
39 |
40 | protected:
41 | void closeEvent(QCloseEvent *event) override;
42 |
43 | private:
44 | void saveSettings();
45 | void restoreSettings();
46 |
47 | bool m_isPin;
48 | QShortcut *m_closeShortcut;
49 | };
50 |
51 | } // namespace QodeAssist::Chat
52 |
--------------------------------------------------------------------------------
/tools/CreateNewFileTool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::Tools {
25 |
26 | class CreateNewFileTool : public LLMCore::BaseTool
27 | {
28 | Q_OBJECT
29 | public:
30 | explicit CreateNewFileTool(QObject *parent = nullptr);
31 |
32 | QString name() const override;
33 | QString stringName() const override;
34 | QString description() const override;
35 | QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
36 | LLMCore::ToolPermissions requiredPermissions() const override;
37 |
38 | QFuture executeAsync(const QJsonObject &input = QJsonObject()) override;
39 | };
40 |
41 | } // namespace QodeAssist::Tools
42 |
43 |
--------------------------------------------------------------------------------
/llmcore/ProvidersManager.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "ProvidersManager.hpp"
21 |
22 | namespace QodeAssist::LLMCore {
23 |
24 | ProvidersManager &ProvidersManager::instance()
25 | {
26 | static ProvidersManager instance;
27 | return instance;
28 | }
29 |
30 | QStringList ProvidersManager::providersNames() const
31 | {
32 | return m_providers.keys();
33 | }
34 |
35 | ProvidersManager::~ProvidersManager()
36 | {
37 | qDeleteAll(m_providers);
38 | }
39 |
40 | Provider *ProvidersManager::getProviderByName(const QString &providerName)
41 | {
42 | if (!m_providers.contains(providerName))
43 | return m_providers.first();
44 | return m_providers[providerName];
45 | }
46 |
47 | } // namespace QodeAssist::LLMCore
48 |
--------------------------------------------------------------------------------
/widgets/CompletionHintHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace TextEditor {
26 | class TextEditorWidget;
27 | }
28 |
29 | namespace QodeAssist {
30 |
31 | class CompletionHintWidget;
32 |
33 | class CompletionHintHandler
34 | {
35 | public:
36 | CompletionHintHandler();
37 | ~CompletionHintHandler();
38 |
39 | void showHint(TextEditor::TextEditorWidget *widget, QPoint position, int fontSize);
40 | void hideHint();
41 | bool isHintVisible() const;
42 | void updateHintPosition(TextEditor::TextEditorWidget *widget, QPoint position);
43 |
44 | private:
45 | QPointer m_hintWidget;
46 | };
47 |
48 | } // namespace QodeAssist
49 |
50 |
--------------------------------------------------------------------------------
/context/DocumentReaderQtCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "IDocumentReader.hpp"
23 |
24 | #include
25 |
26 | namespace QodeAssist::Context {
27 |
28 | class DocumentReaderQtCreator : public IDocumentReader
29 | {
30 | public:
31 | DocumentInfo readDocument(const QString &path) const override
32 | {
33 | auto *textDocument = TextEditor::TextDocument::textDocumentForFilePath(
34 | Utils::FilePath::fromString(path));
35 | if (!textDocument) {
36 | return {};
37 | }
38 | return {
39 | .document = textDocument->document(),
40 | .mimeType = textDocument->mimeType(),
41 | .filePath = path};
42 | }
43 | };
44 |
45 | } // namespace QodeAssist::Context
46 |
--------------------------------------------------------------------------------
/llmcore/PromptTemplate.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include "ContextData.hpp"
27 | #include "ProviderID.hpp"
28 |
29 | namespace QodeAssist::LLMCore {
30 |
31 | enum class TemplateType { Chat, FIM, FIMOnChat };
32 |
33 | class PromptTemplate
34 | {
35 | public:
36 | virtual ~PromptTemplate() = default;
37 | virtual TemplateType type() const = 0;
38 | virtual QString name() const = 0;
39 | virtual QStringList stopWords() const = 0;
40 | virtual void prepareRequest(QJsonObject &request, const ContextData &context) const = 0;
41 | virtual QString description() const = 0;
42 | virtual bool isSupportProvider(ProviderID id) const = 0;
43 | };
44 | } // namespace QodeAssist::LLMCore
45 |
--------------------------------------------------------------------------------
/UpdateStatusWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace QodeAssist {
29 |
30 | class UpdateStatusWidget : public QFrame
31 | {
32 | Q_OBJECT
33 | public:
34 | explicit UpdateStatusWidget(QWidget *parent = nullptr);
35 |
36 | void setDefaultAction(QAction *action);
37 | void showUpdateAvailable(const QString &version);
38 | void hideUpdateInfo();
39 | void setChatButtonAction(QAction *action);
40 |
41 | QPushButton *updateButton() const;
42 |
43 | private:
44 | QToolButton *m_actionButton;
45 | QToolButton *m_chatButton;
46 | QLabel *m_versionLabel;
47 | QPushButton *m_updateButton;
48 | };
49 | } // namespace QodeAssist
50 |
--------------------------------------------------------------------------------
/providers/OpenRouterAIProvider.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "OpenRouterAIProvider.hpp"
21 |
22 | #include "settings/ProviderSettings.hpp"
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | namespace QodeAssist::Providers {
30 |
31 | QString OpenRouterProvider::name() const
32 | {
33 | return "OpenRouter";
34 | }
35 |
36 | QString OpenRouterProvider::url() const
37 | {
38 | return "https://openrouter.ai/api";
39 | }
40 |
41 | QString OpenRouterProvider::apiKey() const
42 | {
43 | return Settings::providerSettings().openRouterApiKey();
44 | }
45 |
46 | LLMCore::ProviderID OpenRouterProvider::providerID() const
47 | {
48 | return LLMCore::ProviderID::OpenRouter;
49 | }
50 |
51 | } // namespace QodeAssist::Providers
52 |
--------------------------------------------------------------------------------
/logger/RequestPerformanceLogger.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "IRequestPerformanceLogger.hpp"
21 | #include
22 | #include
23 |
24 | namespace QodeAssist {
25 |
26 | class RequestPerformanceLogger : public IRequestPerformanceLogger
27 | {
28 | public:
29 | RequestPerformanceLogger() = default;
30 | ~RequestPerformanceLogger() override = default;
31 |
32 | void startTimeMeasurement(const QString &requestId) override;
33 | void endTimeMeasurement(const QString &requestId) override;
34 | void logPerformance(const QString &requestId, qint64 elapsedMs) override;
35 | void logPerformance(const QString &requestId, const QString &operation, qint64 elapsedMs);
36 |
37 | private:
38 | QMap m_requestStartTimes;
39 | };
40 |
41 | } // namespace QodeAssist
42 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskItem.cpp:
--------------------------------------------------------------------------------
1 | #include "TaskItem.hpp"
2 |
3 | namespace QodeAssist::TaskFlow {
4 |
5 | TaskItem::TaskItem(QQuickItem *parent)
6 | : QQuickItem(parent)
7 | {
8 | setObjectName("TaskItem");
9 | }
10 |
11 | QString TaskItem::taskId() const
12 | {
13 | return m_taskId;
14 | }
15 |
16 | void TaskItem::setTaskId(const QString &newTaskId)
17 | {
18 | if (m_taskId == newTaskId)
19 | return;
20 | m_taskId = newTaskId;
21 | emit taskIdChanged();
22 | }
23 |
24 | QString TaskItem::taskType() const
25 | {
26 | return m_task ? m_task->taskType() : QString();
27 | }
28 |
29 | BaseTask *TaskItem::task() const
30 | {
31 | return m_task;
32 | }
33 |
34 | void TaskItem::setTask(BaseTask *newTask)
35 | {
36 | if (m_task == newTask)
37 | return;
38 |
39 | m_task = newTask;
40 |
41 | if (m_task) {
42 | m_taskId = m_task->taskId();
43 |
44 | // Обновляем модели портов
45 | m_inputPorts = new TaskPortModel(m_task->getInputPorts(), this);
46 | m_outputPorts = new TaskPortModel(m_task->getOutputPorts(), this);
47 | } else {
48 | m_inputPorts = nullptr;
49 | m_outputPorts = nullptr;
50 | }
51 |
52 | emit taskChanged();
53 | emit inputPortsChanged();
54 | emit outputPortsChanged();
55 | emit taskIdChanged();
56 | emit taskTypeChanged();
57 | }
58 |
59 | TaskPortModel *TaskItem::inputPorts() const
60 | {
61 | return m_inputPorts;
62 | }
63 |
64 | TaskPortModel *TaskItem::outputPorts() const
65 | {
66 | return m_outputPorts;
67 | }
68 |
69 | } // namespace QodeAssist::TaskFlow
70 |
--------------------------------------------------------------------------------
/tools/ReadVisibleFilesTool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::Tools {
26 |
27 | class ReadVisibleFilesTool : public LLMCore::BaseTool
28 | {
29 | Q_OBJECT
30 | public:
31 | explicit ReadVisibleFilesTool(QObject *parent = nullptr);
32 |
33 | QString name() const override;
34 | QString stringName() const override;
35 | QString description() const override;
36 | QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
37 | LLMCore::ToolPermissions requiredPermissions() const override;
38 |
39 | QFuture executeAsync(const QJsonObject &input = QJsonObject()) override;
40 |
41 | private:
42 | Context::IgnoreManager *m_ignoreManager;
43 | };
44 |
45 | } // namespace QodeAssist::Tools
46 |
--------------------------------------------------------------------------------
/docs/openai-configuration.md:
--------------------------------------------------------------------------------
1 | # Configure for OpenAI
2 |
3 | QodeAssist supports both OpenAI's standard Chat Completions API and the new Responses API, giving you access to the latest GPT models including GPT-5.1 and GPT-5.1-codex.
4 |
5 | ## Standard OpenAI Configuration
6 |
7 | 1. Open Qt Creator settings and navigate to the QodeAssist section
8 | 2. Go to Provider Settings tab and configure OpenAI api key
9 | 3. Return to General tab and configure:
10 | - Set "OpenAI" as the provider for code completion or/and chat assistant
11 | - Set the OpenAI URL (https://api.openai.com)
12 | - Select your preferred model (e.g., gpt-4o, gpt-5.1, gpt-5.1-codex)
13 | - Choose the OpenAI template for code completion or/and chat
14 |
15 |
16 | Example of OpenAI settings: (click to expand)
17 |
18 |
19 |
20 |
21 | ## OpenAI Responses API Configuration
22 |
23 | The Responses API is OpenAI's newer endpoint that provides enhanced capabilities and improved performance. It supports the latest GPT-5.1 models.
24 |
25 | 1. Open Qt Creator settings and navigate to the QodeAssist section
26 | 2. Go to Provider Settings tab and configure OpenAI api key
27 | 3. Return to General tab and configure:
28 | - Set "OpenAI Responses" as the provider for code completion or/and chat assistant
29 | - Set the OpenAI URL (https://api.openai.com)
30 | - Select your preferred model (e.g., gpt-5.1, gpt-5.1-codex)
31 | - Choose the OpenAI Responses template for code completion or/and chat
32 |
33 |
--------------------------------------------------------------------------------
/ChatView/MessagePart.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include "ChatData.hpp"
26 |
27 | namespace QodeAssist::Chat {
28 |
29 | class MessagePart
30 | {
31 | Q_GADGET
32 | Q_PROPERTY(MessagePartType type MEMBER type CONSTANT FINAL)
33 | Q_PROPERTY(QString text MEMBER text CONSTANT FINAL)
34 | Q_PROPERTY(QString language MEMBER language CONSTANT FINAL)
35 | Q_PROPERTY(QString imageData MEMBER imageData CONSTANT FINAL)
36 | Q_PROPERTY(QString mediaType MEMBER mediaType CONSTANT FINAL)
37 | QML_VALUE_TYPE(messagePart)
38 | public:
39 | MessagePartType type;
40 | QString text;
41 | QString language;
42 | QString imageData; // Base64 data or URL
43 | QString mediaType; // e.g., "image/png", "image/jpeg"
44 | };
45 |
46 | } // namespace QodeAssist::Chat
47 |
--------------------------------------------------------------------------------
/llmcore/RequestHandlerBase.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestConfig.hpp"
23 | #include
24 | #include
25 |
26 | namespace QodeAssist::LLMCore {
27 |
28 | class RequestHandlerBase : public QObject
29 | {
30 | Q_OBJECT
31 |
32 | public:
33 | explicit RequestHandlerBase(QObject *parent = nullptr);
34 | ~RequestHandlerBase() override;
35 |
36 | virtual void sendLLMRequest(const LLMConfig &config, const QJsonObject &request) = 0;
37 | virtual bool cancelRequest(const QString &id) = 0;
38 |
39 | signals:
40 | void completionReceived(const QString &completion, const QJsonObject &request, bool isComplete);
41 | void requestFinished(const QString &requestId, bool success, const QString &errorString);
42 | void requestCancelled(const QString &id);
43 | };
44 |
45 | } // namespace QodeAssist::LLMCore
46 |
--------------------------------------------------------------------------------
/context/TokenUtils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "TokenUtils.hpp"
21 |
22 | namespace QodeAssist::Context {
23 |
24 | int TokenUtils::estimateTokens(const QString &text)
25 | {
26 | if (text.isEmpty()) {
27 | return 0;
28 | }
29 |
30 | // TODO: need to improve
31 | return text.length() / 4;
32 | }
33 |
34 | int TokenUtils::estimateFileTokens(const Context::ContentFile &file)
35 | {
36 | int total = 0;
37 |
38 | total += estimateTokens(file.filename);
39 | total += estimateTokens(file.content);
40 | total += 5;
41 |
42 | return total;
43 | }
44 |
45 | int TokenUtils::estimateFilesTokens(const QList &files)
46 | {
47 | int total = 0;
48 | for (const auto &file : files) {
49 | total += estimateFileTokens(file);
50 | }
51 | return total;
52 | }
53 |
54 | } // namespace QodeAssist::Context
55 |
--------------------------------------------------------------------------------
/settings/AgentRolesWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | class QListWidget;
25 | class QPushButton;
26 |
27 | namespace QodeAssist::Settings {
28 |
29 | class AgentRolesWidget : public QWidget
30 | {
31 | Q_OBJECT
32 |
33 | public:
34 | explicit AgentRolesWidget(QWidget *parent = nullptr);
35 |
36 | private:
37 | void setupUI();
38 | void loadRoles();
39 | void updateButtons();
40 |
41 | void onAddRole();
42 | void onEditRole();
43 | void onDuplicateRole();
44 | void onDeleteRole();
45 | void onOpenRolesFolder();
46 |
47 | QListWidget *m_rolesList = nullptr;
48 | QPushButton *m_addButton = nullptr;
49 | QPushButton *m_editButton = nullptr;
50 | QPushButton *m_duplicateButton = nullptr;
51 | QPushButton *m_deleteButton = nullptr;
52 | };
53 |
54 | } // namespace QodeAssist::Settings
55 |
--------------------------------------------------------------------------------
/settings/CustomPromptSettings.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "ButtonAspect.hpp"
25 |
26 | namespace QodeAssist::Settings {
27 |
28 | class CustomPromptSettings : public Utils::AspectContainer
29 | {
30 | public:
31 | CustomPromptSettings();
32 |
33 | Utils::StringAspect customJsonLabel{this};
34 | Utils::StringAspect customJsonTemplate{this};
35 | Utils::StringAspect customJsonLegend{this};
36 | ButtonAspect saveCustomTemplateButton{this};
37 | ButtonAspect loadCustomTemplateButton{this};
38 | ButtonAspect resetToDefaults{this};
39 |
40 | private:
41 | void setupConnection();
42 | void resetSettingsToDefaults();
43 | void saveCustomTemplate();
44 | void loadCustomTemplate();
45 | };
46 |
47 | CustomPromptSettings &customPromptSettings();
48 |
49 | } // namespace QodeAssist::Settings
50 |
--------------------------------------------------------------------------------
/providers/OpenAIResponses/CancelResponseRequest.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::OpenAIResponses {
25 |
26 | struct CancelResponseRequest
27 | {
28 | QString responseId;
29 |
30 | QString buildUrl(const QString &baseUrl) const
31 | {
32 | return QString("%1/v1/responses/%2/cancel").arg(baseUrl, responseId);
33 | }
34 |
35 | bool isValid() const { return !responseId.isEmpty(); }
36 | };
37 |
38 | class CancelResponseRequestBuilder
39 | {
40 | public:
41 | CancelResponseRequestBuilder &setResponseId(const QString &id)
42 | {
43 | m_request.responseId = id;
44 | return *this;
45 | }
46 |
47 | CancelResponseRequest build() const { return m_request; }
48 |
49 | private:
50 | CancelResponseRequest m_request;
51 | };
52 |
53 | } // namespace QodeAssist::OpenAIResponses
54 |
55 |
--------------------------------------------------------------------------------
/tools/ToolsFactory.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 |
26 | namespace QodeAssist::Tools {
27 |
28 | class ToolsFactory : public QObject
29 | {
30 | Q_OBJECT
31 | public:
32 | ToolsFactory(QObject *parent = nullptr);
33 | ~ToolsFactory() override = default;
34 |
35 | QList getAvailableTools() const;
36 | LLMCore::BaseTool *getToolByName(const QString &name) const;
37 | QJsonArray getToolsDefinitions(
38 | LLMCore::ToolSchemaFormat format,
39 | LLMCore::RunToolsFilter filter = LLMCore::RunToolsFilter::ALL) const;
40 | QString getStringName(const QString &name) const;
41 |
42 | private:
43 | void registerTools();
44 | void registerTool(LLMCore::BaseTool *tool);
45 |
46 | QHash m_tools;
47 | };
48 | } // namespace QodeAssist::Tools
49 |
--------------------------------------------------------------------------------
/TaskFlow/core/TaskRegistry.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace QodeAssist::TaskFlow {
28 |
29 | class BaseTask;
30 |
31 | class TaskRegistry : public QObject
32 | {
33 | Q_OBJECT
34 | public:
35 | using TaskCreator = std::function;
36 |
37 | explicit TaskRegistry(QObject *parent = nullptr);
38 |
39 | template
40 | inline void registerTask(const QString &taskType)
41 | {
42 | m_creators[taskType] = [](QObject *parent) -> BaseTask * { return new T(parent); };
43 | }
44 | BaseTask *createTask(const QString &taskType, QObject *parent = nullptr) const;
45 | QStringList getAvailableTypes() const;
46 |
47 | private:
48 | QHash m_creators;
49 | };
50 |
51 | } // namespace QodeAssist::TaskFlow
52 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/qml/TaskPort.qml:
--------------------------------------------------------------------------------
1 | import QtQuick
2 | import TaskFlow.Editor
3 |
4 | TaskPortItem {
5 | id: root
6 |
7 | property bool isInput: true
8 |
9 | width: 20
10 | height: 20
11 |
12 | // Port circle
13 | Rectangle {
14 | id: portCircle
15 | anchors.centerIn: parent
16 | width: 16
17 | height: 16
18 | radius: 8
19 | color: getPortColor()
20 | border.color: palette.windowText
21 | border.width: 1
22 |
23 | // Inner circle for connected state simulation
24 | Rectangle {
25 | anchors.centerIn: parent
26 | width: 8
27 | height: 8
28 | radius: 4
29 | color: root.port ? palette.windowText : "transparent"
30 | visible: root.port !== null
31 | }
32 | }
33 |
34 | MouseArea {
35 | anchors.fill: parent
36 | hoverEnabled: true
37 |
38 | onEntered: {
39 | portCircle.scale = 1.3
40 | portCircle.border.width = 2
41 | }
42 |
43 | onExited: {
44 | portCircle.scale = 1.0
45 | portCircle.border.width = 1
46 | }
47 | }
48 |
49 | function getPortColor() {
50 | if (!root.port) return palette.mid
51 |
52 | // Different colors for input/output using system palette
53 | if (root.isInput) {
54 | return palette.highlight // System highlight color for inputs
55 | } else {
56 | return Qt.lighter(palette.highlight, 1.3) // Lighter highlight for outputs
57 | }
58 | }
59 |
60 | Behavior on scale {
61 | NumberAnimation { duration: 100 }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/FlowsModel.cpp:
--------------------------------------------------------------------------------
1 | #include "FlowsModel.hpp"
2 |
3 | #include "FlowManager.hpp"
4 |
5 | namespace QodeAssist::TaskFlow {
6 |
7 | FlowsModel::FlowsModel(FlowManager *flowManager, QObject *parent)
8 | : QAbstractListModel(parent)
9 | , m_flowManager(flowManager)
10 | {
11 | connect(m_flowManager, &FlowManager::flowAdded, this, &FlowsModel::onFlowAdded);
12 | }
13 |
14 | int FlowsModel::rowCount(const QModelIndex &parent) const
15 | {
16 | return m_flowManager->flows().size();
17 | }
18 |
19 | QVariant FlowsModel::data(const QModelIndex &index, int role) const
20 | {
21 | if (!index.isValid() || !m_flowManager || index.row() >= m_flowManager->flows().size())
22 | return QVariant();
23 |
24 | const auto flows = m_flowManager->flows().values();
25 |
26 | switch (role) {
27 | case FlowRoles::FlowIdRole:
28 | return flows.at(index.row())->flowId();
29 | case FlowRoles::FlowDataRole:
30 | return QVariant::fromValue(flows.at(index.row()));
31 | default:
32 | return QVariant();
33 | }
34 | }
35 |
36 | QHash FlowsModel::roleNames() const
37 | {
38 | QHash roles;
39 | roles[FlowRoles::FlowIdRole] = "flowId";
40 | roles[FlowRoles::FlowDataRole] = "flowData";
41 | return roles;
42 | }
43 |
44 | void FlowsModel::onFlowAdded(const QString &flowId)
45 | {
46 | // qDebug() << "FlowsModel::Flow added: " << flowId;
47 | // int newIndex = m_flowManager->flows().size();
48 | // beginInsertRows(QModelIndex(), newIndex, newIndex);
49 | // endInsertRows();
50 | }
51 |
52 | void FlowsModel::onFlowRemoved(const QString &flowId) {}
53 |
54 | } // namespace QodeAssist::TaskFlow
55 |
--------------------------------------------------------------------------------
/tools/ListProjectFilesTool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 |
26 | namespace QodeAssist::Tools {
27 |
28 | class ListProjectFilesTool : public LLMCore::BaseTool
29 | {
30 | Q_OBJECT
31 | public:
32 | explicit ListProjectFilesTool(QObject *parent = nullptr);
33 |
34 | QString name() const override;
35 | QString stringName() const override;
36 | QString description() const override;
37 | QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
38 | LLMCore::ToolPermissions requiredPermissions() const override;
39 |
40 | QFuture executeAsync(const QJsonObject &input = QJsonObject()) override;
41 |
42 | private:
43 | QString formatFileList(const QStringList &files) const;
44 | Context::IgnoreManager *m_ignoreManager;
45 | };
46 |
47 | } // namespace QodeAssist::Tools
48 |
--------------------------------------------------------------------------------
/widgets/EditorChatButton.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | class EditorChatButton : public QWidget
29 | {
30 | Q_OBJECT
31 | public:
32 | explicit EditorChatButton(QWidget *parent = nullptr);
33 | ~EditorChatButton() override;
34 |
35 | signals:
36 | void clicked();
37 |
38 | protected:
39 | void paintEvent(QPaintEvent *event) override;
40 | void mousePressEvent(QMouseEvent *event) override;
41 | void mouseReleaseEvent(QMouseEvent *event) override;
42 | void enterEvent(QEnterEvent *event) override;
43 | void leaveEvent(QEvent *event) override;
44 |
45 | private:
46 | QPixmap m_logoPixmap;
47 | QColor m_textColor;
48 | QColor m_backgroundColor;
49 | bool m_isPressed = false;
50 | bool m_isHovered = false;
51 | };
52 |
53 | } // namespace QodeAssist
54 |
--------------------------------------------------------------------------------
/widgets/AddCustomInstructionDialog.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include "CustomInstructionsManager.hpp"
26 |
27 | class QLineEdit;
28 | class QPlainTextEdit;
29 | class QCheckBox;
30 |
31 | namespace QodeAssist {
32 |
33 | class AddCustomInstructionDialog : public QDialog
34 | {
35 | Q_OBJECT
36 |
37 | public:
38 | explicit AddCustomInstructionDialog(QWidget *parent = nullptr);
39 | explicit AddCustomInstructionDialog(const CustomInstruction &instruction, QWidget *parent = nullptr);
40 | ~AddCustomInstructionDialog() override = default;
41 |
42 | CustomInstruction getInstruction() const;
43 |
44 | private:
45 | void setupUi();
46 |
47 | QLineEdit *m_nameEdit;
48 | QPlainTextEdit *m_bodyEdit;
49 | QCheckBox *m_defaultCheckBox;
50 | CustomInstruction m_instruction;
51 | };
52 |
53 | } // namespace QodeAssist
54 |
55 |
--------------------------------------------------------------------------------
/ChatView/icons/thinking-icon-on.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/llmcore/IToolsManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include "BaseTool.hpp"
28 |
29 | namespace QodeAssist::LLMCore {
30 |
31 | class IToolsManager
32 | {
33 | public:
34 | virtual ~IToolsManager() = default;
35 |
36 | virtual void executeToolCall(
37 | const QString &requestId,
38 | const QString &toolId,
39 | const QString &toolName,
40 | const QJsonObject &input) = 0;
41 |
42 | virtual QJsonArray getToolsDefinitions(
43 | ToolSchemaFormat format,
44 | RunToolsFilter filter = RunToolsFilter::ALL) const = 0;
45 |
46 | virtual void cleanupRequest(const QString &requestId) = 0;
47 | virtual void setCurrentSessionId(const QString &sessionId) = 0;
48 | virtual void clearTodoSession(const QString &sessionId) = 0;
49 | };
50 |
51 | } // namespace QodeAssist::LLMCore
52 |
--------------------------------------------------------------------------------
/settings/ProviderSettings.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "ButtonAspect.hpp"
25 |
26 | namespace QodeAssist::Settings {
27 |
28 | class ProviderSettings : public Utils::AspectContainer
29 | {
30 | public:
31 | ProviderSettings();
32 |
33 | ButtonAspect resetToDefaults{this};
34 |
35 | // API Keys
36 | Utils::StringAspect openRouterApiKey{this};
37 | Utils::StringAspect openAiCompatApiKey{this};
38 | Utils::StringAspect claudeApiKey{this};
39 | Utils::StringAspect openAiApiKey{this};
40 | Utils::StringAspect mistralAiApiKey{this};
41 | Utils::StringAspect codestralApiKey{this};
42 | Utils::StringAspect googleAiApiKey{this};
43 | Utils::StringAspect ollamaBasicAuthApiKey{this};
44 |
45 | private:
46 | void setupConnections();
47 | void resetSettingsToDefaults();
48 | };
49 |
50 | ProviderSettings &providerSettings();
51 |
52 | } // namespace QodeAssist::Settings
53 |
--------------------------------------------------------------------------------
/settings/SettingsDialog.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 |
29 | namespace QodeAssist::Settings {
30 |
31 | class SettingsDialog : public QDialog
32 | {
33 | public:
34 | explicit SettingsDialog(const QString &title, QWidget *parent = Core::ICore::dialogParent());
35 |
36 | QLabel *addLabel(const QString &text);
37 | QLineEdit *addInputField(const QString &labelText, const QString &value);
38 | void addSpacing(int space = 12);
39 | QHBoxLayout *buttonLayout();
40 | QVBoxLayout *mainLayout() const;
41 |
42 | QComboBox *addComboBox(
43 | const QStringList &items, const QString ¤tText = QString(), bool editable = true);
44 |
45 | private:
46 | QVBoxLayout *m_mainLayout;
47 | QHBoxLayout *m_buttonLayout;
48 | };
49 |
50 | } // namespace QodeAssist::Settings
51 |
--------------------------------------------------------------------------------
/settings/AgentRoleDialog.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "AgentRole.hpp"
25 |
26 | class QLineEdit;
27 | class QTextEdit;
28 | class QDialogButtonBox;
29 |
30 | namespace QodeAssist::Settings {
31 |
32 | class AgentRoleDialog : public QDialog
33 | {
34 | Q_OBJECT
35 |
36 | public:
37 | explicit AgentRoleDialog(QWidget *parent = nullptr);
38 | explicit AgentRoleDialog(const AgentRole &role, bool editMode = true, QWidget *parent = nullptr);
39 |
40 | AgentRole getRole() const;
41 | void setRole(const AgentRole &role);
42 |
43 | private:
44 | void setupUI();
45 | void validateInput();
46 |
47 | QLineEdit *m_nameEdit = nullptr;
48 | QLineEdit *m_idEdit = nullptr;
49 | QTextEdit *m_descriptionEdit = nullptr;
50 | QTextEdit *m_systemPromptEdit = nullptr;
51 | QDialogButtonBox *m_buttonBox = nullptr;
52 | bool m_editMode = false;
53 | };
54 |
55 | } // namespace QodeAssist::Settings
56 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/TaskConnectionItem.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TaskConnection.hpp"
4 | #include
5 | #include
6 |
7 | namespace QodeAssist::TaskFlow {
8 |
9 | class TaskConnectionItem : public QQuickItem
10 | {
11 | Q_OBJECT
12 | QML_ELEMENT
13 |
14 | Q_PROPERTY(QPointF startPoint READ startPoint NOTIFY startPointChanged)
15 | Q_PROPERTY(QPointF endPoint READ endPoint NOTIFY endPointChanged)
16 | Q_PROPERTY(
17 | TaskConnection *connection READ connection WRITE setConnection NOTIFY connectionChanged)
18 |
19 | Q_PROPERTY(QVariantList taskItems READ taskItems WRITE setTaskItems NOTIFY taskItemsChanged)
20 |
21 | public:
22 | TaskConnectionItem(QQuickItem *parent = nullptr);
23 |
24 | QPointF startPoint() const { return m_startPoint; }
25 | QPointF endPoint() const { return m_endPoint; }
26 |
27 | TaskConnection *connection() const { return m_connection; }
28 | void setConnection(TaskConnection *connection);
29 |
30 | Q_INVOKABLE void updatePositions();
31 |
32 | QVariantList taskItems() const;
33 | void setTaskItems(const QVariantList &newTaskItems);
34 |
35 | signals:
36 | void startPointChanged();
37 | void endPointChanged();
38 | void connectionChanged();
39 |
40 | void taskItemsChanged();
41 |
42 | private:
43 | void calculatePositions();
44 | QQuickItem *findTaskItem(BaseTask *task);
45 | QQuickItem *findTaskItemRecursive(QQuickItem *item, BaseTask *task);
46 | QQuickItem *findPortItem(QQuickItem *taskItem, TaskPort *port);
47 |
48 | private:
49 | TaskConnection *m_connection = nullptr;
50 | QPointF m_startPoint;
51 | QPointF m_endPoint;
52 | QVariantList m_taskItems;
53 | };
54 |
55 | } // namespace QodeAssist::TaskFlow
56 |
--------------------------------------------------------------------------------
/chat/ChatOutputPane.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ChatView/ChatWidget.hpp"
23 | #include
24 |
25 | namespace QodeAssist::Chat {
26 |
27 | class ChatOutputPane : public Core::IOutputPane
28 | {
29 | Q_OBJECT
30 |
31 | public:
32 | explicit ChatOutputPane(QObject *parent = nullptr);
33 | ~ChatOutputPane() override;
34 |
35 | QWidget *outputWidget(QWidget *parent) override;
36 | QList toolBarWidgets() const override;
37 | void clearContents() override;
38 | void visibilityChanged(bool visible) override;
39 | void setFocus() override;
40 | bool hasFocus() const override;
41 | bool canFocus() const override;
42 | bool canNavigate() const override;
43 | bool canNext() const override;
44 | bool canPrevious() const override;
45 | void goToNext() override;
46 | void goToPrev() override;
47 |
48 | private:
49 | ChatWidget *m_chatWidget;
50 | };
51 |
52 | } // namespace QodeAssist::Chat
53 |
--------------------------------------------------------------------------------
/context/IContextManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include "ContentFile.hpp"
26 | #include "IDocumentReader.hpp"
27 | #include "ProgrammingLanguage.hpp"
28 |
29 | namespace ProjectExplorer {
30 | class Project;
31 | }
32 |
33 | namespace QodeAssist::Context {
34 |
35 | class IContextManager
36 | {
37 | public:
38 | virtual ~IContextManager() = default;
39 |
40 | virtual QString readFile(const QString &filePath) const = 0;
41 | virtual QList getContentFiles(const QStringList &filePaths) const = 0;
42 | virtual QStringList getProjectSourceFiles(ProjectExplorer::Project *project) const = 0;
43 | virtual ContentFile createContentFile(const QString &filePath) const = 0;
44 |
45 | virtual ProgrammingLanguage getDocumentLanguage(const DocumentInfo &documentInfo) const = 0;
46 | virtual bool isSpecifyCompletion(const DocumentInfo &documentInfo) const = 0;
47 | };
48 |
49 | } // namespace QodeAssist::Context
50 |
--------------------------------------------------------------------------------
/.github/workflows/README.md:
--------------------------------------------------------------------------------
1 | # GitHub Actions & Workflows
2 |
3 | The `build_cmake.yml` in this directory adds a [GitHub action][1] and workflow that builds
4 | your plugin anytime you push commits to GitHub on Windows, Linux and macOS.
5 |
6 | The build artifacts can be downloaded from GitHub and be installed into an existing Qt Creator
7 | installation.
8 |
9 | When you push a tag, the workflow also creates a new release on GitHub.
10 |
11 | ## Keeping it up to date
12 |
13 | Near the top of the file you find a section starting with `env:`.
14 |
15 | The value for `QT_VERSION` specifies the Qt version to use for building the plugin.
16 |
17 | The value for `QT_CREATOR_VERSION` specifies the Qt Creator version to use for building the plugin.
18 |
19 | The value for `QT_CREATOR_SNAPSHOT` can either be `NO` or `latest` or the build ID of a specific
20 | snapshot build for the Qt Creator version that you specified.
21 |
22 | You need to keep these values updated for different versions of your plugin, and take care
23 | that the Qt version and Qt Creator version you specify are compatible.
24 |
25 | ## What it does
26 |
27 | The build job consists of several steps:
28 |
29 | * Install required packages on the build host
30 | * Download, unpack and install the binary for the Qt version
31 | * Download and unpack the binary for the Qt Creator version
32 | * Build the plugin and upload the plugin libraries to GitHub
33 | * If a tag is pushed, create a release on GitHub for the tag, including zipped plugin libraries
34 | for download
35 |
36 | ## Limitations
37 |
38 | If your plugin requires additional resources besides the plugin library, you need to adapt the
39 | script accordingly.
40 |
41 | [1]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-github-actions
42 |
--------------------------------------------------------------------------------
/test/MockDocumentReader.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "context/IDocumentReader.hpp"
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | class MockDocumentReader : public Context::IDocumentReader
29 | {
30 | public:
31 | MockDocumentReader() = default;
32 |
33 | Context::DocumentInfo readDocument(const QString &path) const override
34 | {
35 | return m_documentInfo;
36 | }
37 |
38 | void setDocumentInfo(const QString &text, const QString &filePath, const QString &mimeType)
39 | {
40 | m_document = std::make_unique(text);
41 | m_documentInfo.document = m_document.get();
42 | m_documentInfo.filePath = filePath;
43 | m_documentInfo.mimeType = mimeType;
44 | }
45 |
46 | ~MockDocumentReader() = default;
47 |
48 | private:
49 | Context::DocumentInfo m_documentInfo;
50 | std::unique_ptr m_document;
51 | };
52 |
53 | } // namespace QodeAssist
54 |
--------------------------------------------------------------------------------
/llmcore/PromptProviderFim.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "IPromptProvider.hpp"
23 | #include "PromptTemplateManager.hpp"
24 |
25 | namespace QodeAssist::LLMCore {
26 |
27 | class PromptProviderFim : public IPromptProvider
28 | {
29 | public:
30 | explicit PromptProviderFim(PromptTemplateManager &templateManager)
31 | : m_templateManager(templateManager)
32 | {}
33 |
34 | ~PromptProviderFim() = default;
35 |
36 | PromptTemplate *getTemplateByName(const QString &templateName) const override
37 | {
38 | return m_templateManager.getFimTemplateByName(templateName);
39 | }
40 |
41 | QStringList templatesNames() const override { return m_templateManager.fimTemplatesNames(); }
42 |
43 | QStringList getTemplatesForProvider(ProviderID id) const override
44 | {
45 | return m_templateManager.getFimTemplatesForProvider(id);
46 | }
47 |
48 | private:
49 | PromptTemplateManager &m_templateManager;
50 | };
51 |
52 | } // namespace QodeAssist::LLMCore
53 |
--------------------------------------------------------------------------------
/widgets/CompletionErrorHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist {
26 |
27 | class ErrorWidget;
28 |
29 | class CompletionErrorHandler : public TextEditor::BaseHoverHandler
30 | {
31 | public:
32 | void showError(
33 | TextEditor::TextEditorWidget *widget,
34 | const QString &errorMessage,
35 | int autoHideMs = 5000);
36 |
37 | void hideError();
38 |
39 | bool isErrorVisible() const { return !m_errorWidget.isNull(); }
40 |
41 | protected:
42 | void identifyMatch(
43 | TextEditor::TextEditorWidget *editorWidget, int pos, ReportPriority report) override;
44 | void operateTooltip(TextEditor::TextEditorWidget *editorWidget, const QPoint &point) override;
45 |
46 | private:
47 | QPointer m_widget;
48 | QPointer m_errorWidget;
49 | QString m_errorMessage;
50 | QPoint m_errorPosition;
51 | };
52 |
53 | } // namespace QodeAssist
54 |
55 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/GridBackground.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace QodeAssist::TaskFlow {
27 |
28 | class GridBackground : public QQuickItem
29 | {
30 | Q_OBJECT
31 | QML_ELEMENT
32 |
33 | Q_PROPERTY(int gridSize READ gridSize WRITE setGridSize NOTIFY gridSizeChanged)
34 | Q_PROPERTY(QColor gridColor READ gridColor WRITE setGridColor NOTIFY gridColorChanged)
35 |
36 | public:
37 | explicit GridBackground(QQuickItem *parent = nullptr);
38 |
39 | int gridSize() const;
40 | void setGridSize(int size);
41 |
42 | QColor gridColor() const;
43 | void setGridColor(const QColor &color);
44 |
45 | signals:
46 | void gridSizeChanged();
47 | void gridColorChanged();
48 |
49 | protected:
50 | QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
51 |
52 | private:
53 | int m_gridSize = 20;
54 | QColor m_gridColor = QColor(128, 128, 128);
55 | };
56 |
57 | } // namespace QodeAssist::TaskFlow
58 |
--------------------------------------------------------------------------------
/tools/FindAndReadFileTool.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "FileSearchUtils.hpp"
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | namespace QodeAssist::Tools {
31 |
32 | class FindAndReadFileTool : public LLMCore::BaseTool
33 | {
34 | Q_OBJECT
35 |
36 | public:
37 | explicit FindAndReadFileTool(QObject *parent = nullptr);
38 |
39 | QString name() const override;
40 | QString stringName() const override;
41 | QString description() const override;
42 | QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
43 | LLMCore::ToolPermissions requiredPermissions() const override;
44 | QFuture executeAsync(const QJsonObject &input) override;
45 |
46 | private:
47 | QString formatResult(const FileSearchUtils::FileMatch &match, bool readContent) const;
48 |
49 | Context::IgnoreManager *m_ignoreManager;
50 | };
51 |
52 | } // namespace QodeAssist::Tools
53 |
--------------------------------------------------------------------------------
/ChatView/icons/thinking-icon-off.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/ChatView/qml/chatparts/TextBlock.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | import QtQuick
21 | import Qt.labs.platform as Platform
22 |
23 | TextEdit {
24 | id: root
25 |
26 | readOnly: true
27 | selectByMouse: true
28 | wrapMode: Text.WordWrap
29 | selectionColor: palette.highlight
30 | color: palette.text
31 |
32 | onLinkActivated: (link) => Qt.openUrlExternally(link)
33 |
34 | MouseArea {
35 | anchors.fill: parent
36 | acceptedButtons: Qt.RightButton
37 | onClicked: contextMenu.open()
38 | cursorShape: root.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
39 | }
40 |
41 | Platform.Menu {
42 | id: contextMenu
43 |
44 | Platform.MenuItem {
45 | text: qsTr("Copy")
46 | enabled: root.selectedText.length > 0
47 | onTriggered: root.copy()
48 | }
49 |
50 | Platform.MenuItem {
51 | text: qsTr("Select All")
52 | enabled: root.text.length > 0
53 | onTriggered: root.selectAll()
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/widgets/CompletionProgressHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | class ProgressWidget;
29 |
30 | class CompletionProgressHandler : public TextEditor::BaseHoverHandler
31 | {
32 | public:
33 | void showProgress(TextEditor::TextEditorWidget *widget);
34 | void hideProgress();
35 | void setCancelCallback(std::function callback);
36 | bool isProgressVisible() const { return !m_progressWidget.isNull(); }
37 |
38 | protected:
39 | void identifyMatch(
40 | TextEditor::TextEditorWidget *editorWidget, int pos, ReportPriority report) override;
41 | void operateTooltip(TextEditor::TextEditorWidget *editorWidget, const QPoint &point) override;
42 |
43 | private:
44 | QPointer m_widget;
45 | QPointer m_progressWidget;
46 | QPoint m_iconPosition;
47 | std::function m_cancelCallback;
48 | };
49 |
50 | } // namespace QodeAssist
51 |
--------------------------------------------------------------------------------
/widgets/ProgressWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 |
30 | namespace QodeAssist {
31 |
32 | class ProgressWidget : public QWidget
33 | {
34 | Q_OBJECT
35 | public:
36 | ProgressWidget(QWidget *parent = nullptr);
37 | ~ProgressWidget();
38 |
39 | void setCancelCallback(std::function callback);
40 |
41 | signals:
42 | void cancelRequested();
43 |
44 | protected:
45 | void paintEvent(QPaintEvent *) override;
46 | void enterEvent(QEnterEvent *event) override;
47 | void leaveEvent(QEvent *event) override;
48 | void mousePressEvent(QMouseEvent *event) override;
49 |
50 | private:
51 | QTimer m_timer;
52 | int m_dotPosition;
53 | QColor m_textColor;
54 | QColor m_backgroundColor;
55 | QPixmap m_logoPixmap;
56 | bool m_isHovered;
57 | std::function m_cancelCallback;
58 | };
59 |
60 | } // namespace QodeAssist
61 |
--------------------------------------------------------------------------------
/settings/PluginUpdater.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace QodeAssist {
29 |
30 | class PluginUpdater : public QObject
31 | {
32 | Q_OBJECT
33 | public:
34 | struct UpdateInfo
35 | {
36 | QString version;
37 | QString changeLog;
38 | bool isUpdateAvailable = false;
39 | };
40 |
41 | explicit PluginUpdater(QObject *parent = nullptr);
42 | ~PluginUpdater() = default;
43 |
44 | void checkForUpdates();
45 | QString currentVersion() const;
46 | bool isUpdateAvailable() const;
47 |
48 | signals:
49 | void updateCheckFinished(const UpdateInfo &info);
50 |
51 | private:
52 | void handleUpdateResponse(QNetworkReply *reply);
53 | QString getUpdateUrl() const;
54 |
55 | QNetworkAccessManager *m_networkManager;
56 | UpdateInfo m_lastUpdateInfo;
57 | bool m_isCheckingUpdate = false;
58 | };
59 |
60 | } // namespace QodeAssist
61 |
--------------------------------------------------------------------------------
/widgets/EditorChatButtonHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "widgets/EditorChatButton.hpp"
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | class EditorChatButtonHandler : public TextEditor::BaseHoverHandler
29 | {
30 | public:
31 | explicit EditorChatButtonHandler() = default;
32 | ~EditorChatButtonHandler() override;
33 |
34 | void showButton(TextEditor::TextEditorWidget *widget);
35 | void hideButton();
36 |
37 | signals:
38 | void chatButtonClicked(TextEditor::TextEditorWidget *widget);
39 |
40 | protected:
41 | void identifyMatch(
42 | TextEditor::TextEditorWidget *editorWidget, int pos, ReportPriority report) override;
43 | void operateTooltip(TextEditor::TextEditorWidget *editorWidget, const QPoint &point) override;
44 |
45 | private:
46 | QPointer m_widget;
47 | QPoint m_cursorPosition;
48 | EditorChatButton *m_chatButton = nullptr;
49 | int m_buttonHeight = 0;
50 | };
51 |
52 | } // namespace QodeAssist
53 |
--------------------------------------------------------------------------------
/llmcore/PromptProviderChat.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "IPromptProvider.hpp"
23 | #include "PromptTemplate.hpp"
24 | #include "PromptTemplateManager.hpp"
25 |
26 | namespace QodeAssist::LLMCore {
27 |
28 | class PromptProviderChat : public IPromptProvider
29 | {
30 | public:
31 | explicit PromptProviderChat(PromptTemplateManager &templateManager)
32 | : m_templateManager(templateManager)
33 | {}
34 |
35 | ~PromptProviderChat() = default;
36 |
37 | PromptTemplate *getTemplateByName(const QString &templateName) const override
38 | {
39 | return m_templateManager.getChatTemplateByName(templateName);
40 | }
41 |
42 | QStringList templatesNames() const override { return m_templateManager.chatTemplatesNames(); }
43 |
44 | QStringList getTemplatesForProvider(ProviderID id) const override
45 | {
46 | return m_templateManager.getChatTemplatesForProvider(id);
47 | }
48 |
49 | private:
50 | PromptTemplateManager &m_templateManager;
51 | };
52 |
53 | } // namespace QodeAssist::LLMCore
54 |
--------------------------------------------------------------------------------
/llmcore/ProvidersManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "IProviderRegistry.hpp"
25 | #include
26 |
27 | namespace QodeAssist::LLMCore {
28 |
29 | class ProvidersManager : public IProviderRegistry
30 | {
31 | public:
32 | static ProvidersManager &instance();
33 | ~ProvidersManager();
34 |
35 | template
36 | void registerProvider()
37 | {
38 | static_assert(std::is_base_of::value, "T must inherit from Provider");
39 | T *provider = new T();
40 | QString name = provider->name();
41 | m_providers[name] = provider;
42 | }
43 |
44 | Provider *getProviderByName(const QString &providerName) override;
45 |
46 | QStringList providersNames() const override;
47 |
48 | private:
49 | ProvidersManager() = default;
50 | ProvidersManager(const ProvidersManager &) = delete;
51 | ProvidersManager &operator=(const ProvidersManager &) = delete;
52 |
53 | QMap m_providers;
54 | };
55 |
56 | } // namespace QodeAssist::LLMCore
57 |
--------------------------------------------------------------------------------
/templates/DeepSeekCoderFim.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "llmcore/PromptTemplate.hpp"
23 |
24 | namespace QodeAssist::Templates {
25 |
26 | class DeepSeekCoderFim : public LLMCore::PromptTemplate
27 | {
28 | public:
29 | LLMCore::TemplateType type() const override { return LLMCore::TemplateType::Fim; }
30 | QString name() const override { return "DeepSeekCoder FIM"; }
31 | QString promptTemplate() const override
32 | {
33 | return "<|fim▁begin|>%1<|fim▁hole|>%2<|fim▁end|>";
34 | }
35 | QStringList stopWords() const override { return QStringList(); }
36 | void prepareRequest(QJsonObject &request, const LLMCore::ContextData &context) const override
37 | {
38 | QString formattedPrompt = promptTemplate().arg(context.prefix, context.suffix);
39 | request["prompt"] = formattedPrompt;
40 | }
41 | QString description() const override
42 | {
43 | return "The message will contain the following tokens: "
44 | "<|fim▁begin|>%1<|fim▁hole|>%2<|fim▁end|>";
45 | }
46 | };
47 |
48 | } // namespace QodeAssist::Templates
49 |
--------------------------------------------------------------------------------
/TaskFlow/Editor/FlowItem.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "TaskConnectionItem.hpp"
6 | #include "TaskConnectionsModel.hpp"
7 | #include "TaskItem.hpp"
8 | #include "TaskModel.hpp"
9 | #include
10 | #include
11 |
12 | namespace QodeAssist::TaskFlow {
13 |
14 | class FlowItem : public QQuickItem
15 | {
16 | Q_OBJECT
17 | QML_ELEMENT
18 |
19 | Q_PROPERTY(QString flowId READ flowId WRITE setFlowId NOTIFY flowIdChanged)
20 | Q_PROPERTY(Flow *flow READ flow WRITE setFlow NOTIFY flowChanged)
21 | Q_PROPERTY(TaskModel *taskModel READ taskModel NOTIFY taskModelChanged)
22 | Q_PROPERTY(
23 | TaskConnectionsModel *connectionsModel READ connectionsModel NOTIFY connectionsModelChanged)
24 | Q_PROPERTY(QVariantList taskItems READ taskItems WRITE setTaskItems NOTIFY taskItemsChanged)
25 |
26 | public:
27 | explicit FlowItem(QQuickItem *parent = nullptr);
28 |
29 | QString flowId() const;
30 | void setFlowId(const QString &newFlowId);
31 |
32 | Flow *flow() const;
33 | void setFlow(Flow *newFlow);
34 |
35 | TaskModel *taskModel() const;
36 |
37 | TaskConnectionsModel *connectionsModel() const;
38 |
39 | QVariantList taskItems() const;
40 | void setTaskItems(const QVariantList &newTaskItems);
41 |
42 | void updateFlowLayout();
43 |
44 | signals:
45 | void flowIdChanged();
46 | void flowChanged();
47 | void taskModelChanged();
48 | void connectionsModelChanged();
49 | void taskItemsChanged();
50 |
51 | private:
52 | Flow *m_flow = nullptr;
53 | TaskModel *m_taskModel = nullptr;
54 | TaskConnectionsModel *m_connectionsModel = nullptr;
55 | QVariantList m_taskItems;
56 |
57 | QHash m_taskItemsList;
58 | QHash m_taskConnectionsList;
59 | };
60 |
61 | } // namespace QodeAssist::TaskFlow
62 |
--------------------------------------------------------------------------------
/LLMSuggestion.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The Qt Company Ltd.
3 | * Copyright (C) 2024-2025 Petr Mironychev
4 | *
5 | * This file is part of QodeAssist.
6 | *
7 | * The Qt Company portions:
8 | * SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
9 | *
10 | * Petr Mironychev portions:
11 | * QodeAssist is free software: you can redistribute it and/or modify
12 | * it under the terms of the GNU General Public License as published by
13 | * the Free Software Foundation, either version 3 of the License, or
14 | * (at your option) any later version.
15 | *
16 | * QodeAssist is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | * GNU General Public License for more details.
20 | *
21 | * You should have received a copy of the GNU General Public License
22 | * along with QodeAssist. If not, see .
23 | */
24 |
25 | #pragma once
26 |
27 | #include
28 | #include
29 |
30 | namespace QodeAssist {
31 |
32 | class LLMSuggestion : public TextEditor::CyclicSuggestion
33 | {
34 | public:
35 | enum Part { Word, Line };
36 |
37 | LLMSuggestion(
38 | const QList &suggestions, QTextDocument *sourceDocument, int currentCompletion = 0);
39 |
40 | bool applyWord(TextEditor::TextEditorWidget *widget) override;
41 | bool applyLine(TextEditor::TextEditorWidget *widget) override;
42 | bool applyPart(Part part, TextEditor::TextEditorWidget *widget);
43 | bool apply() override;
44 |
45 | static int calculateReplaceLength(const QString &suggestion,
46 | const QString &rightText,
47 | const QString &entireLine);
48 | };
49 | } // namespace QodeAssist
50 |
--------------------------------------------------------------------------------
/UIControls/qml/QoAButton.qml:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | import QtQuick
21 | import QtQuick.Controls.Basic
22 |
23 | Button {
24 | id: control
25 |
26 | padding: 4
27 |
28 | icon.width: 16
29 | icon.height: 16
30 |
31 | contentItem.height: 20
32 |
33 | background: Rectangle {
34 | id: bg
35 |
36 | implicitHeight: 20
37 |
38 | color: !control.enabled || !control.down ? control.palette.button : control.palette.dark
39 | border.color: !control.enabled || (!control.hovered && !control.visualFocus) ? control.palette.mid : control.palette.highlight
40 | border.width: 1
41 | radius: 4
42 |
43 | Rectangle {
44 | anchors.fill: bg
45 | radius: bg.radius
46 | gradient: Gradient {
47 | GradientStop { position: 0.0; color: Qt.alpha(control.palette.highlight, 0.4) }
48 | GradientStop { position: 1.0; color: Qt.alpha(control.palette.highlight, 0.2) }
49 | }
50 | opacity: control.hovered ? 0.3 : 0.01
51 | Behavior on opacity {NumberAnimation{duration: 250}}
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CodeHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | class CodeHandler
29 | {
30 | public:
31 | static QString processText(QString text, QString currentFileName);
32 |
33 | /**
34 | * Detects language from line, or returns empty string if this was not possible
35 | */
36 | static QString detectLanguageFromLine(const QString &line);
37 |
38 | /**
39 | * Detects language file name, or returns empty string if this was not possible
40 | */
41 | static QString detectLanguageFromExtension(const QString &extension);
42 |
43 | /**
44 | * Detects if text contains code blocks, or returns false if this was not possible
45 | */
46 | static bool hasCodeBlocks(const QString &text);
47 |
48 | private:
49 | static QString getCommentPrefix(const QString &language);
50 |
51 | static const QRegularExpression &getFullCodeBlockRegex();
52 | static const QRegularExpression &getPartialStartBlockRegex();
53 | static const QRegularExpression &getPartialEndBlockRegex();
54 | };
55 |
56 | } // namespace QodeAssist
57 |
--------------------------------------------------------------------------------
/TaskFlow/core/TaskConnection.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace QodeAssist::TaskFlow {
26 |
27 | class BaseTask;
28 | class TaskPort;
29 |
30 | class TaskConnection : public QObject
31 | {
32 | Q_OBJECT
33 |
34 | public:
35 | // Constructor automatically sets up the connection
36 | explicit TaskConnection(TaskPort *sourcePort, TaskPort *targetPort, QObject *parent = nullptr);
37 |
38 | // Destructor automatically cleans up the connection
39 | ~TaskConnection() override;
40 |
41 | // Getters
42 | BaseTask *sourceTask() const;
43 | BaseTask *targetTask() const;
44 | TaskPort *sourcePort() const;
45 | TaskPort *targetPort() const;
46 |
47 | // Validation
48 | bool isValid() const;
49 | bool isTypeCompatible() const;
50 |
51 | // Utility
52 | QString toString() const;
53 |
54 | // Comparison
55 | bool operator==(const TaskConnection &other) const;
56 |
57 | private:
58 | TaskPort *m_sourcePort;
59 | TaskPort *m_targetPort;
60 |
61 | void setupConnection();
62 | void cleanupConnection();
63 | };
64 |
65 | } // namespace QodeAssist::TaskFlow
66 |
--------------------------------------------------------------------------------
/widgets/ErrorWidget.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 |
28 | namespace QodeAssist {
29 |
30 | class ErrorWidget : public QWidget
31 | {
32 | Q_OBJECT
33 | public:
34 | explicit ErrorWidget(const QString &errorMessage, QWidget *parent = nullptr, int autoHideMs = 5000);
35 | ~ErrorWidget();
36 |
37 | void setErrorMessage(const QString &message);
38 |
39 | QString errorMessage() const { return m_errorMessage; }
40 |
41 | signals:
42 | void dismissed();
43 |
44 | protected:
45 | void paintEvent(QPaintEvent *) override;
46 | void mousePressEvent(QMouseEvent *event) override;
47 | void enterEvent(QEnterEvent *event) override;
48 | void leaveEvent(QEvent *event) override;
49 |
50 | private:
51 | QString m_errorMessage;
52 | QTimer *m_autoHideTimer;
53 | QColor m_textColor;
54 | QColor m_backgroundColor;
55 | QColor m_errorColor;
56 | QPixmap m_errorIcon;
57 | bool m_isHovered;
58 |
59 | void setupColors();
60 | void setupIcon();
61 | QSize calculateSize() const;
62 | };
63 |
64 | } // namespace QodeAssist
65 |
66 |
--------------------------------------------------------------------------------
/TaskFlow/core/FlowManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | #include "Flow.hpp"
29 |
30 | namespace QodeAssist::TaskFlow {
31 |
32 | class TaskRegistry;
33 | class FlowRegistry;
34 |
35 | class FlowManager : public QObject
36 | {
37 | Q_OBJECT
38 |
39 | public:
40 | explicit FlowManager(QObject *parent = nullptr);
41 | ~FlowManager() override;
42 |
43 | // Flow *createFlow(const QString &flowId);
44 | void addFlow(Flow *flow);
45 |
46 | void clear();
47 |
48 | QStringList getAvailableTasksTypes();
49 | QStringList getAvailableFlows();
50 |
51 | QHash flows() const;
52 |
53 | TaskRegistry *taskRegistry() const;
54 | FlowRegistry *flowRegistry() const;
55 |
56 | Flow *getFlow(const QString &flowId = {}) const;
57 |
58 | signals:
59 | void flowAdded(const QString &flowId);
60 | void flowRemoved(const QString &flowId);
61 |
62 | private:
63 | QHash m_flows;
64 |
65 | TaskRegistry *m_taskRegistry;
66 | FlowRegistry *m_flowRegistry;
67 | };
68 |
69 | } // namespace QodeAssist::TaskFlow
70 |
--------------------------------------------------------------------------------
/settings/UpdateDialog.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include "PluginUpdater.hpp"
31 |
32 | namespace QodeAssist {
33 |
34 | class UpdateDialog : public QDialog
35 | {
36 | Q_OBJECT
37 | public:
38 | explicit UpdateDialog(QWidget *parent = nullptr);
39 |
40 | static void checkForUpdatesAndShow(QWidget *parent = nullptr);
41 |
42 | private slots:
43 | void handleUpdateInfo(const PluginUpdater::UpdateInfo &info);
44 | void openReleasePage();
45 | void openPluginFolder();
46 | void openUpdaterReleasePage();
47 |
48 | private:
49 | PluginUpdater *m_updater;
50 | QVBoxLayout *m_layout;
51 | QLabel *m_titleLabel;
52 | QLabel *m_versionLabel;
53 | QLabel *m_changelogLabel;
54 | QTextEdit *m_changelogText;
55 | QPushButton *m_buttonOpenReleasePage;
56 | QPushButton *m_buttonOpenPluginFolder;
57 | QPushButton *m_buttonOpenUpdaterRelease;
58 | QPushButton *m_closeButton;
59 | PluginUpdater::UpdateInfo m_updateInfo;
60 | };
61 |
62 | } // namespace QodeAssist
63 |
--------------------------------------------------------------------------------
/widgets/CustomInstructionsManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace QodeAssist {
27 |
28 | struct CustomInstruction
29 | {
30 | QString id;
31 | QString name;
32 | QString body;
33 | bool isDefault = false;
34 | };
35 |
36 | class CustomInstructionsManager : public QObject
37 | {
38 | Q_OBJECT
39 |
40 | public:
41 | static CustomInstructionsManager &instance();
42 |
43 | bool loadInstructions();
44 | bool saveInstruction(const CustomInstruction &instruction);
45 | bool deleteInstruction(const QString &id);
46 |
47 | QVector instructions() const { return m_instructions; }
48 | CustomInstruction getInstructionById(const QString &id) const;
49 |
50 | signals:
51 | void instructionsChanged();
52 |
53 | private:
54 | explicit CustomInstructionsManager(QObject *parent = nullptr);
55 | ~CustomInstructionsManager() override = default;
56 |
57 | QString getInstructionsDirectory() const;
58 | bool ensureDirectoryExists() const;
59 |
60 | QVector m_instructions;
61 | };
62 |
63 | } // namespace QodeAssist
64 |
65 |
--------------------------------------------------------------------------------
/ChatView/ChatFileManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace QodeAssist::Chat {
28 |
29 | class ChatFileManager : public QObject
30 | {
31 | Q_OBJECT
32 |
33 | public:
34 | explicit ChatFileManager(QObject *parent = nullptr);
35 | ~ChatFileManager();
36 |
37 | QStringList processDroppedFiles(const QStringList &filePaths);
38 | void setChatFilePath(const QString &chatFilePath);
39 | QString chatFilePath() const;
40 | void clearIntermediateStorage();
41 |
42 | static bool isFileAccessible(const QString &filePath);
43 | static void cleanupGlobalIntermediateStorage();
44 |
45 | signals:
46 | void fileOperationFailed(const QString &error);
47 | void fileCopiedToStorage(const QString &originalPath, const QString &newPath);
48 |
49 | private:
50 | QString copyToIntermediateStorage(const QString &filePath);
51 | QString getIntermediateStorageDir();
52 | QString generateIntermediateFileName(const QString &originalPath);
53 |
54 | QString m_chatFilePath;
55 | QString m_intermediateStorageDir;
56 | };
57 |
58 | } // namespace QodeAssist::Chat
59 |
60 |
--------------------------------------------------------------------------------
/settings/ToolsSettings.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024-2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "ButtonAspect.hpp"
25 |
26 | namespace QodeAssist::Settings {
27 |
28 | class ToolsSettings : public Utils::AspectContainer
29 | {
30 | public:
31 | ToolsSettings();
32 |
33 | ButtonAspect resetToDefaults{this};
34 |
35 | Utils::BoolAspect allowFileSystemRead{this};
36 | Utils::BoolAspect allowFileSystemWrite{this};
37 | Utils::BoolAspect allowNetworkAccess{this};
38 | Utils::BoolAspect allowAccessOutsideProject{this};
39 |
40 | // Experimental features
41 | Utils::BoolAspect enableEditFileTool{this};
42 | Utils::BoolAspect enableBuildProjectTool{this};
43 | Utils::BoolAspect enableTerminalCommandTool{this};
44 | Utils::BoolAspect enableTodoTool{this};
45 | Utils::StringAspect allowedTerminalCommandsLinux{this};
46 | Utils::StringAspect allowedTerminalCommandsMacOS{this};
47 | Utils::StringAspect allowedTerminalCommandsWindows{this};
48 | Utils::BoolAspect autoApplyFileEdits{this};
49 |
50 | private:
51 | void setupConnections();
52 | void resetSettingsToDefaults();
53 | };
54 |
55 | ToolsSettings &toolsSettings();
56 |
57 | } // namespace QodeAssist::Settings
58 |
--------------------------------------------------------------------------------
/test/MockRequestHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Povilas Kanapickas
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace QodeAssist::LLMCore {
25 |
26 | class MockRequestHandler : public RequestHandlerBase
27 | {
28 | public:
29 | explicit MockRequestHandler(QObject *parent = nullptr)
30 | : RequestHandlerBase(parent)
31 | , m_fakeCompletion("")
32 | {}
33 |
34 | void setFakeCompletion(const QString &completion) { m_fakeCompletion = completion; }
35 |
36 | void sendLLMRequest(const LLMConfig &config, const QJsonObject &request) override
37 | {
38 | m_receivedRequests.append(config);
39 |
40 | emit completionReceived(m_fakeCompletion, request, true);
41 |
42 | QString requestId = request["id"].toString();
43 | emit requestFinished(requestId, true, QString());
44 | }
45 |
46 | bool cancelRequest(const QString &id) override
47 | {
48 | emit requestCancelled(id);
49 | return true;
50 | }
51 |
52 | const QVector &receivedRequests() const { return m_receivedRequests; }
53 |
54 | private:
55 | QString m_fakeCompletion;
56 | QVector m_receivedRequests;
57 | };
58 |
59 | } // namespace QodeAssist::LLMCore
60 |
--------------------------------------------------------------------------------
/TaskFlow/core/TaskRegistry.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #include "TaskRegistry.hpp"
21 |
22 | #include
23 |
24 | #include "BaseTask.hpp"
25 |
26 | namespace QodeAssist::TaskFlow {
27 |
28 | TaskRegistry::TaskRegistry(QObject *parent)
29 | : QObject(parent)
30 | {}
31 |
32 | BaseTask *TaskRegistry::createTask(const QString &taskType, QObject *parent) const
33 | {
34 | LOG_MESSAGE(QString("Trying to create task: %1").arg(taskType));
35 |
36 | if (m_creators.contains(taskType)) {
37 | LOG_MESSAGE(QString("Found creator for task type: %1").arg(taskType));
38 | try {
39 | BaseTask *task = m_creators[taskType](parent);
40 | if (task) {
41 | LOG_MESSAGE(QString("Successfully created task: %1").arg(taskType));
42 | return task;
43 | }
44 | } catch (...) {
45 | LOG_MESSAGE(QString("Exception while creating task of type: %1").arg(taskType));
46 | }
47 | } else {
48 | LOG_MESSAGE(QString("No creator found for task type: %1").arg(taskType));
49 | }
50 |
51 | return nullptr;
52 | }
53 |
54 | QStringList TaskRegistry::getAvailableTypes() const
55 | {
56 | return m_creators.keys();
57 | }
58 |
59 | } // namespace QodeAssist::TaskFlow
60 |
--------------------------------------------------------------------------------
/TaskFlow/core/BaseTask.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Petr Mironychev
3 | *
4 | * This file is part of QodeAssist.
5 | *
6 | * QodeAssist is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * QodeAssist is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with QodeAssist. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include