feat: Add todo tool (#286)

This commit is contained in:
Petr Mironychev
2025-12-03 21:28:59 +01:00
committed by GitHub
parent fb941cea99
commit 498eb4d932
17 changed files with 563 additions and 13 deletions

View File

@ -311,6 +311,12 @@ void ChatRootView::clearLinkedFiles()
emit linkedFilesChanged();
}
void ChatRootView::clearMessages()
{
m_clientInterface->clearMessages();
clearLinkedFiles();
}
QString ChatRootView::getChatsHistoryDir() const
{
QString path;

View File

@ -161,6 +161,7 @@ public slots:
void cancelRequest();
void clearAttachmentFiles();
void clearLinkedFiles();
void clearMessages();
signals:
void chatModelChanged();

View File

@ -318,12 +318,23 @@ void ClientInterface::sendMessage(
Qt::UniqueConnection);
provider->sendRequest(requestId, config.url, config.providerRequest);
if (provider->supportsTools() && provider->toolsManager()) {
provider->toolsManager()->setCurrentSessionId(m_chatFilePath);
}
}
void ClientInterface::clearMessages()
{
const auto providerName = Settings::generalSettings().caProvider();
auto *provider = LLMCore::ProvidersManager::instance().getProviderByName(providerName);
if (provider && !m_chatFilePath.isEmpty() && provider->supportsTools()
&& provider->toolsManager()) {
provider->toolsManager()->clearTodoSession(m_chatFilePath);
}
m_chatModel->clear();
LOG_MESSAGE("Chat history cleared");
}
void ClientInterface::cancelRequest()
@ -596,6 +607,15 @@ QVector<LLMCore::ImageAttachment> ClientInterface::loadImagesFromStorage(
void ClientInterface::setChatFilePath(const QString &filePath)
{
if (!m_chatFilePath.isEmpty() && m_chatFilePath != filePath) {
const auto providerName = Settings::generalSettings().caProvider();
auto *provider = LLMCore::ProvidersManager::instance().getProviderByName(providerName);
if (provider && provider->supportsTools() && provider->toolsManager()) {
provider->toolsManager()->clearTodoSession(m_chatFilePath);
}
}
m_chatFilePath = filePath;
m_chatModel->setChatFilePath(filePath);
}

View File

@ -446,7 +446,7 @@ ChatRootView {
}
function clearChat() {
root.chatModel.clear()
root.clearMessages()
root.clearAttachmentFiles()
root.updateInputTokensCount()
}