mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-14 05:52:50 -05:00
fix: Add active project name and path to system prompt
This commit is contained in:
@ -99,13 +99,19 @@ void ClientInterface::sendMessage(
|
|||||||
QString systemPrompt = chatAssistantSettings.systemPrompt();
|
QString systemPrompt = chatAssistantSettings.systemPrompt();
|
||||||
|
|
||||||
auto project = LLMCore::RulesLoader::getActiveProject();
|
auto project = LLMCore::RulesLoader::getActiveProject();
|
||||||
|
|
||||||
if (project) {
|
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
|
QString projectRules
|
||||||
= LLMCore::RulesLoader::loadRulesForProject(project, LLMCore::RulesContext::Chat);
|
= LLMCore::RulesLoader::loadRulesForProject(project, LLMCore::RulesContext::Chat);
|
||||||
|
|
||||||
if (!projectRules.isEmpty()) {
|
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()) {
|
if (!linkedFiles.isEmpty()) {
|
||||||
|
|||||||
@ -86,7 +86,7 @@ QFuture<QString> ListProjectFilesTool::executeAsync(const QJsonObject &input)
|
|||||||
return QtConcurrent::run([this]() -> QString {
|
return QtConcurrent::run([this]() -> QString {
|
||||||
QList<ProjectExplorer::Project *> projects = ProjectExplorer::ProjectManager::projects();
|
QList<ProjectExplorer::Project *> projects = ProjectExplorer::ProjectManager::projects();
|
||||||
if (projects.isEmpty()) {
|
if (projects.isEmpty()) {
|
||||||
QString error = "Error: No projects found";
|
QString error = "No projects found";
|
||||||
throw ToolRuntimeError(error);
|
throw ToolRuntimeError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user