mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-10-23 12:24:38 -04:00
fix: Improve tool handler tools execution
This commit is contained in:
@ -41,7 +41,7 @@ QFuture<QString> ToolHandler::executeToolAsync(
|
||||
return QtConcurrent::run([]() -> QString { throw std::runtime_error("Tool is null"); });
|
||||
}
|
||||
|
||||
auto execution = new ToolExecution();
|
||||
auto execution = std::make_unique<ToolExecution>();
|
||||
execution->requestId = requestId;
|
||||
execution->toolId = toolId;
|
||||
execution->toolName = tool->name();
|
||||
@ -55,7 +55,7 @@ QFuture<QString> ToolHandler::executeToolAsync(
|
||||
|
||||
auto future = tool->executeAsync(input);
|
||||
execution->watcher->setFuture(future);
|
||||
m_activeExecutions.insert(toolId, execution);
|
||||
m_activeExecutions.insert(toolId, execution.release());
|
||||
|
||||
return future;
|
||||
}
|
||||
|
@ -86,8 +86,12 @@ QJsonArray ToolsManager::getToolsDefinitions(LLMCore::ToolSchemaFormat format) c
|
||||
|
||||
void ToolsManager::cleanupRequest(const QString &requestId)
|
||||
{
|
||||
m_pendingTools.remove(requestId);
|
||||
m_toolHandler->cleanupRequest(requestId);
|
||||
if (m_pendingTools.contains(requestId)) {
|
||||
LOG_MESSAGE(QString("ToolsManager: Canceling pending tools for request %1").arg(requestId));
|
||||
m_toolHandler->cleanupRequest(requestId);
|
||||
m_pendingTools.remove(requestId);
|
||||
}
|
||||
|
||||
LOG_MESSAGE(QString("ToolsManager: Cleaned up request %1").arg(requestId));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user