mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-02-03 13:50:19 -05:00
feat: Improve showing tools in chat (#235)
This commit is contained in:
@ -41,6 +41,11 @@ QString ListProjectFilesTool::name() const
|
||||
return "list_project_files";
|
||||
}
|
||||
|
||||
QString ListProjectFilesTool::stringName() const
|
||||
{
|
||||
return {"Reading project files list"};
|
||||
}
|
||||
|
||||
QString ListProjectFilesTool::description() const
|
||||
{
|
||||
return "Get a list of all source files in the current project. "
|
||||
|
||||
@ -32,6 +32,7 @@ public:
|
||||
explicit ListProjectFilesTool(QObject *parent = nullptr);
|
||||
|
||||
QString name() const override;
|
||||
QString stringName() const override;
|
||||
QString description() const override;
|
||||
QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
|
||||
QFuture<QString> executeAsync(const QJsonObject &input = QJsonObject()) override;
|
||||
|
||||
@ -44,6 +44,11 @@ QString ReadProjectFileByNameTool::name() const
|
||||
return "read_project_file_by_name";
|
||||
}
|
||||
|
||||
QString ReadProjectFileByNameTool::stringName() const
|
||||
{
|
||||
return {"Reading project file by name"};
|
||||
}
|
||||
|
||||
QString ReadProjectFileByNameTool::description() const
|
||||
{
|
||||
return "Read the content of a specific file from the current project by providing its filename "
|
||||
|
||||
@ -31,6 +31,7 @@ public:
|
||||
explicit ReadProjectFileByNameTool(QObject *parent = nullptr);
|
||||
|
||||
QString name() const override;
|
||||
QString stringName() const override;
|
||||
QString description() const override;
|
||||
QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
|
||||
QFuture<QString> executeAsync(const QJsonObject &input = QJsonObject()) override;
|
||||
|
||||
@ -39,6 +39,11 @@ QString ReadVisibleFilesTool::name() const
|
||||
return "read_visible_files";
|
||||
}
|
||||
|
||||
QString ReadVisibleFilesTool::stringName() const
|
||||
{
|
||||
return {"Reading currently opened and visible files in IDE editors"};
|
||||
}
|
||||
|
||||
QString ReadVisibleFilesTool::description() const
|
||||
{
|
||||
return "Read the content of all currently visible files in editor tabs. "
|
||||
|
||||
@ -31,6 +31,7 @@ public:
|
||||
explicit ReadVisibleFilesTool(QObject *parent = nullptr);
|
||||
|
||||
QString name() const override;
|
||||
QString stringName() const override;
|
||||
QString description() const override;
|
||||
QJsonObject getDefinition(LLMCore::ToolSchemaFormat format) const override;
|
||||
QFuture<QString> executeAsync(const QJsonObject &input = QJsonObject()) override;
|
||||
|
||||
@ -82,4 +82,9 @@ QJsonArray ToolsFactory::getToolsDefinitions(LLMCore::ToolSchemaFormat format) c
|
||||
return toolsArray;
|
||||
}
|
||||
|
||||
QString ToolsFactory::getStringName(const QString &name) const
|
||||
{
|
||||
return m_tools.contains(name) ? m_tools.value(name)->stringName() : QString("Unknown tools");
|
||||
}
|
||||
|
||||
} // namespace QodeAssist::Tools
|
||||
|
||||
@ -35,6 +35,7 @@ public:
|
||||
QList<LLMCore::BaseTool *> getAvailableTools() const;
|
||||
LLMCore::BaseTool *getToolByName(const QString &name) const;
|
||||
QJsonArray getToolsDefinitions(LLMCore::ToolSchemaFormat format) const;
|
||||
QString getStringName(const QString &name) const;
|
||||
|
||||
private:
|
||||
void registerTools();
|
||||
|
||||
@ -123,6 +123,11 @@ void ToolsManager::onToolFinished(
|
||||
}
|
||||
}
|
||||
|
||||
ToolsFactory *ToolsManager::toolsFactory() const
|
||||
{
|
||||
return m_toolsFactory;
|
||||
}
|
||||
|
||||
bool ToolsManager::isExecutionComplete(const QString &requestId) const
|
||||
{
|
||||
if (!m_pendingTools.contains(requestId)) {
|
||||
|
||||
@ -56,6 +56,8 @@ public:
|
||||
QJsonArray getToolsDefinitions(ToolSchemaFormat format) const;
|
||||
void cleanupRequest(const QString &requestId);
|
||||
|
||||
ToolsFactory *toolsFactory() const;
|
||||
|
||||
signals:
|
||||
void toolExecutionComplete(const QString &requestId, const QHash<QString, QString> &toolResults);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user