new chatlistview component, file attachments, performance & primitive test
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "tool.hpp"
|
||||
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <QStringList>
|
||||
|
||||
class QProcess;
|
||||
class QTimer;
|
||||
|
||||
namespace ZShell::llm {
|
||||
|
||||
class LlmClient;
|
||||
|
||||
class ShellTool : public LlmTool {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ShellTool(LlmClient* client, QObject* parent = nullptr);
|
||||
~ShellTool() override;
|
||||
|
||||
QString name() const override;
|
||||
QString description() const override;
|
||||
QJsonObject parameters() const override;
|
||||
void execute(
|
||||
const QString& toolCallId,
|
||||
const QJsonObject& args,
|
||||
int outputBudgetChars,
|
||||
std::function<void(const QJsonObject& result)> done) override;
|
||||
void cancel() override;
|
||||
|
||||
static constexpr int DefaultTimeoutSeconds = 60;
|
||||
static constexpr int MaxTimeoutSeconds = 300;
|
||||
|
||||
private:
|
||||
struct Job {
|
||||
QPointer<QProcess> process;
|
||||
QPointer<QTimer> timer;
|
||||
int timeoutSeconds = DefaultTimeoutSeconds;
|
||||
int outputBudgetChars = 0;
|
||||
std::function<void(const QJsonObject&)> done;
|
||||
QString startError;
|
||||
bool timedOut = false;
|
||||
bool cancelled = false;
|
||||
bool finished = false;
|
||||
};
|
||||
|
||||
static QStringList sandboxArguments(const QString& workspace);
|
||||
|
||||
void finishJob(Job* job);
|
||||
|
||||
QPointer<LlmClient> m_client;
|
||||
QList<Job*> m_jobs;
|
||||
};
|
||||
|
||||
} // namespace ZShell::llm
|
||||
Reference in New Issue
Block a user