From a26d4758069276fbe75449a7198b5ac0c1954fb4 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Wed, 12 Nov 2025 19:29:33 +0100 Subject: [PATCH] fix: Add active project name and path to system prompt --- ChatView/ClientInterface.cpp | 8 +++++++- tools/ListProjectFilesTool.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChatView/ClientInterface.cpp b/ChatView/ClientInterface.cpp index a4083c0..6ff560e 100644 --- a/ChatView/ClientInterface.cpp +++ b/ChatView/ClientInterface.cpp @@ -99,13 +99,19 @@ void ClientInterface::sendMessage( QString systemPrompt = chatAssistantSettings.systemPrompt(); auto project = LLMCore::RulesLoader::getActiveProject(); + if (project) { + systemPrompt += QString("\n# Active project name: %1").arg(project->displayName()); + systemPrompt += QString("\n# Active Project path: %1").arg(project->projectDirectory().toUrlishString()); + QString projectRules = LLMCore::RulesLoader::loadRulesForProject(project, LLMCore::RulesContext::Chat); if (!projectRules.isEmpty()) { - systemPrompt += "\n# Project Rules\n\n" + projectRules; + systemPrompt += QString("\n# Project Rules\n\n") + projectRules; } + } else { + systemPrompt += QString("\n# No active project in IDE"); } if (!linkedFiles.isEmpty()) { diff --git a/tools/ListProjectFilesTool.cpp b/tools/ListProjectFilesTool.cpp index 4ad2d28..f39e45b 100644 --- a/tools/ListProjectFilesTool.cpp +++ b/tools/ListProjectFilesTool.cpp @@ -86,7 +86,7 @@ QFuture ListProjectFilesTool::executeAsync(const QJsonObject &input) return QtConcurrent::run([this]() -> QString { QList projects = ProjectExplorer::ProjectManager::projects(); if (projects.isEmpty()) { - QString error = "Error: No projects found"; + QString error = "No projects found"; throw ToolRuntimeError(error); }