fix: truncate webfetch content to fit context
This commit is contained in:
@@ -56,6 +56,13 @@ class LlmClient : public QObject {
|
||||
void clearOnFinish(ChatSession* session);
|
||||
void sessionRemoved(ChatSession* session);
|
||||
|
||||
// Tool calls are executed only after the user approves the batch the
|
||||
// model requested. The per-generation state (toolApprovalPending,
|
||||
// pendingToolCalls) is mirrored onto ChatGeneration; these are the
|
||||
// entry points QML reaches through it.
|
||||
void approveTools();
|
||||
void denyTools();
|
||||
|
||||
void refreshModels();
|
||||
void requestTitle(ChatSession* session, const QString& userText);
|
||||
void requestIcon(ChatSession* session, const QString& userText);
|
||||
@@ -83,11 +90,13 @@ class LlmClient : public QObject {
|
||||
|
||||
void sendRound();
|
||||
QJsonArray buildContextMessages(
|
||||
ChatSession* session, int stopBeforeRow) const;
|
||||
ChatSession* session, int stopBeforeRow, int extraReserveTokens) const;
|
||||
void applyToolCallDelta(const QJsonObject& call);
|
||||
void roundFinished();
|
||||
void executeAllCalls();
|
||||
void flushCallResults();
|
||||
void setApprovalPending(bool value);
|
||||
void finishPendingCalls(const QString& resultText);
|
||||
void finishTurn();
|
||||
void fail(const QString& message);
|
||||
void handleLine(const QByteArray& line);
|
||||
@@ -109,8 +118,11 @@ class LlmClient : public QObject {
|
||||
ToolRegistry* m_tools = nullptr;
|
||||
QNetworkReply* m_reply = nullptr;
|
||||
QByteArray m_buffer;
|
||||
ChatSession* m_active = nullptr;
|
||||
ChatGeneration* m_streaming = nullptr;
|
||||
// QPointer: these objects are owned by the ChatStore tree, which Qt
|
||||
// destroys *before* this client on shutdown (children die in creation
|
||||
// order). The pointers must self-null instead of dangling.
|
||||
QPointer<ChatSession> m_active;
|
||||
QPointer<ChatGeneration> m_streaming;
|
||||
QPointer<ChatSession> m_pendingClear;
|
||||
bool m_busy = false;
|
||||
QString m_streamingChatId;
|
||||
@@ -133,6 +145,7 @@ class LlmClient : public QObject {
|
||||
qsizetype m_reasoningMark = 0;
|
||||
bool m_roundDone = false;
|
||||
bool m_toolPhase = false;
|
||||
bool m_approvalPending = false;
|
||||
int m_pendingCalls = 0;
|
||||
static constexpr int kMaxToolRounds = 12;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user