mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-10-06 12:05:35 -04:00
feat: Add list project files tool
This commit is contained in:
@ -25,37 +25,6 @@ BaseTool::BaseTool(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
QJsonObject BaseTool::getDefinition(ToolSchemaFormat format) const
|
||||
{
|
||||
QJsonObject properties;
|
||||
QJsonObject filenameProperty;
|
||||
filenameProperty["type"] = "string";
|
||||
filenameProperty["description"] = "The filename or relative path to read";
|
||||
properties["filename"] = filenameProperty;
|
||||
|
||||
QJsonObject definition;
|
||||
definition["type"] = "object";
|
||||
definition["properties"] = properties;
|
||||
|
||||
QJsonArray required;
|
||||
required.append("filename");
|
||||
definition["required"] = required;
|
||||
|
||||
switch (format) {
|
||||
case LLMCore::ToolSchemaFormat::OpenAI:
|
||||
definition = customizeForOpenAI(definition);
|
||||
break;
|
||||
case LLMCore::ToolSchemaFormat::Claude:
|
||||
definition = customizeForClaude(definition);
|
||||
break;
|
||||
case LLMCore::ToolSchemaFormat::Ollama:
|
||||
definition = customizeForOllama(definition);
|
||||
break;
|
||||
}
|
||||
|
||||
return definition;
|
||||
}
|
||||
|
||||
QJsonObject BaseTool::customizeForOpenAI(const QJsonObject &baseDefinition) const
|
||||
{
|
||||
QJsonObject function;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual QString description() const = 0;
|
||||
virtual QJsonObject getDefinition(ToolSchemaFormat format) const;
|
||||
virtual QJsonObject getDefinition(ToolSchemaFormat format) const = 0;
|
||||
|
||||
virtual QFuture<QString> executeAsync(const QJsonObject &input = QJsonObject()) = 0;
|
||||
|
||||
|
@ -63,6 +63,8 @@ public:
|
||||
virtual void sendRequest(const RequestID &requestId, const QUrl &url, const QJsonObject &payload)
|
||||
= 0;
|
||||
|
||||
virtual bool supportsTools() { return false; };
|
||||
|
||||
HttpClient *httpClient() const;
|
||||
|
||||
public slots:
|
||||
|
Reference in New Issue
Block a user