fix: Add handling final argument for OpenAI responses tool calling

This commit is contained in:
Petr Mironychev
2026-05-21 14:19:16 +02:00
parent c4e34bb3d9
commit b33a1c2d43
6 changed files with 72 additions and 20 deletions

View File

@@ -77,10 +77,20 @@ QFuture<LLMQore::ToolResult> CreateNewFileTool::executeAsync(const QJsonObject &
if (!isInProject) {
const auto &settings = Settings::toolsSettings();
if (!settings.allowAccessOutsideProject()) {
const QString projectRoot = Context::ProjectUtils::getProjectRoot();
const QString hint = projectRoot.isEmpty()
? QStringLiteral(
"No project is currently open. Open a project in Qt Creator or "
"enable 'Allow file access outside project' in QodeAssist settings.")
: QString(
"Retry with a path under the active project root: '%1'. The build "
"directory is for compiler output only and cannot accept new source "
"files. If you really need to write outside the project, enable "
"'Allow file access outside project' in QodeAssist settings.")
.arg(projectRoot);
throw LLMQore::ToolRuntimeError(
QString("Error: File path '%1' is not within the current project. "
"Enable 'Allow file access outside project' in settings to create files outside project scope.")
.arg(absolutePath));
QString("Error: File path '%1' is not within the current project. %2")
.arg(absolutePath, hint));
}
LOG_MESSAGE(QString("Creating file outside project scope: %1").arg(absolutePath));
}