mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-12-20 00:02:47 -05: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"); });
|
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->requestId = requestId;
|
||||||
execution->toolId = toolId;
|
execution->toolId = toolId;
|
||||||
execution->toolName = tool->name();
|
execution->toolName = tool->name();
|
||||||
@ -55,7 +55,7 @@ QFuture<QString> ToolHandler::executeToolAsync(
|
|||||||
|
|
||||||
auto future = tool->executeAsync(input);
|
auto future = tool->executeAsync(input);
|
||||||
execution->watcher->setFuture(future);
|
execution->watcher->setFuture(future);
|
||||||
m_activeExecutions.insert(toolId, execution);
|
m_activeExecutions.insert(toolId, execution.release());
|
||||||
|
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,8 +86,12 @@ QJsonArray ToolsManager::getToolsDefinitions(LLMCore::ToolSchemaFormat format) c
|
|||||||
|
|
||||||
void ToolsManager::cleanupRequest(const QString &requestId)
|
void ToolsManager::cleanupRequest(const QString &requestId)
|
||||||
{
|
{
|
||||||
m_pendingTools.remove(requestId);
|
if (m_pendingTools.contains(requestId)) {
|
||||||
|
LOG_MESSAGE(QString("ToolsManager: Canceling pending tools for request %1").arg(requestId));
|
||||||
m_toolHandler->cleanupRequest(requestId);
|
m_toolHandler->cleanupRequest(requestId);
|
||||||
|
m_pendingTools.remove(requestId);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_MESSAGE(QString("ToolsManager: Cleaned up request %1").arg(requestId));
|
LOG_MESSAGE(QString("ToolsManager: Cleaned up request %1").arg(requestId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user