fix: truncate context logic
C++ / fmt (pull_request) Successful in 4s
C++ / build (pull_request) Failing after 2m6s
C++ / clang-tidy (pull_request) Failing after 2m5s
JS/TS / fmt (pull_request) Failing after 3m8s
Python / static (pull_request) Successful in 24s
Python / verify (pull_request) Successful in 1m21s
JS/TS / lint (pull_request) Successful in 5m10s
Rust / fmt (pull_request) Successful in 30s
Rust / build (pull_request) Successful in 56s
Rust / clippy (pull_request) Successful in 46s

This commit is contained in:
2026-09-04 02:20:37 +02:00
parent 34dde4bbfb
commit cd3da1941b
15 changed files with 238 additions and 126 deletions
+4 -6
View File
@@ -20,8 +20,6 @@ class WebFetchTool : public LlmTool {
static constexpr int MaxResponseBytes = 5 * 1024 * 1024;
static constexpr int DefaultTimeoutSeconds = 30;
static constexpr int MaxTimeoutSeconds = 120;
// Where the full (untruncated) output of each call is stored so the
// model can page through it with the readfile tool.
static const QString StoragePath;
explicit WebFetchTool(QObject* parent = nullptr);
@@ -33,6 +31,7 @@ class WebFetchTool : public LlmTool {
void execute(
const QString& toolCallId,
const QJsonObject& args,
int outputBudgetChars,
std::function<void(const QJsonObject& result)> done) override;
void cancel() override;
@@ -47,14 +46,13 @@ class WebFetchTool : public LlmTool {
bool tooLarge = false;
QString format;
QString toolCallId;
int budgetChars = 0;
std::function<void(const QJsonObject& result)> done;
};
void completeJob(Job* job, QJsonObject result);
// Writes the full output to StoragePath; returns the file path, or an
// empty string when saving failed.
QString saveToFile(const Job& job, const QString& content,
const QString& mime) const;
QString saveToFile(
const Job& job, const QString& content, const QString& mime) const;
QNetworkAccessManager m_manager;
QList<Job*> m_jobs;