feat: add chunking

This commit is contained in:
Petr Mironychev
2025-02-09 10:10:06 +01:00
parent 02101665ca
commit 5dfcf74128
9 changed files with 338 additions and 0 deletions

View File

@ -39,6 +39,7 @@
#include "Logger.hpp"
#include "ProjectSettings.hpp"
#include "context/ContextManager.hpp"
#include "context/FileChunker.hpp"
#include "context/RAGManager.hpp"
#include "context/TokenUtils.hpp"
@ -484,6 +485,18 @@ void ChatRootView::testRAG(const QString &message)
});
}
void ChatRootView::testChunking()
{
auto project = ProjectExplorer::ProjectTree::currentProject();
if (!project) {
qDebug() << "No active project found";
return;
}
Context::FileChunker::ChunkingConfig config;
Context::ContextManager::instance().testProjectChunks(project, config);
}
void ChatRootView::updateInputTokensCount()
{
int inputTokens = m_messageTokensCount;

View File

@ -66,6 +66,7 @@ public:
Q_INVOKABLE void setIsSyncOpenFiles(bool state);
Q_INVOKABLE void openChatHistoryFolder();
Q_INVOKABLE void testRAG(const QString &message);
Q_INVOKABLE void testChunking();
Q_INVOKABLE void updateInputTokensCount();
int inputTokensCount() const;

View File

@ -199,6 +199,7 @@ ChatRootView {
attachFiles.onClicked: root.showAttachFilesDialog()
linkFiles.onClicked: root.showLinkFilesDialog()
testRag.onClicked: root.testRAG(messageInput.text)
testChunks.onClicked: root.testChunking()
}
}

View File

@ -31,6 +31,7 @@ Rectangle {
property alias attachFiles: attachFilesId
property alias linkFiles: linkFilesId
property alias testRag: testRagId
property alias testChunks: testChunksId
color: palette.window.hslLightness > 0.5 ?
Qt.darker(palette.window, 1.1) :
@ -98,6 +99,12 @@ Rectangle {
text: qsTr("Test RAG")
}
QoAButton {
id: testChunksId
text: qsTr("Test Chunks")
}
Item {
Layout.fillWidth: true
}