fix: truncate webfetch content to fit context
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 2m18s
C++ / clang-tidy (pull_request) Failing after 2m7s
JS/TS / fmt (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Successful in 29s
Rust / build (pull_request) Successful in 50s
Python / verify (pull_request) Successful in 1m38s
Rust / fmt (pull_request) Successful in 26s
Rust / clippy (pull_request) Successful in 47s
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 2m18s
C++ / clang-tidy (pull_request) Failing after 2m7s
JS/TS / fmt (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Successful in 29s
Rust / build (pull_request) Successful in 50s
Python / verify (pull_request) Successful in 1m38s
Rust / fmt (pull_request) Successful in 26s
Rust / clippy (pull_request) Successful in 47s
This commit is contained in:
@@ -6,10 +6,13 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
#include <QVariantList>
|
||||
#include <QtQml>
|
||||
|
||||
namespace ZShell::llm {
|
||||
|
||||
class LlmClient;
|
||||
|
||||
class ChatGeneration : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
@@ -33,6 +36,12 @@ class ChatGeneration : public QObject {
|
||||
QList<ZShell::llm::LlmSegment*> segments READ segments NOTIFY
|
||||
segmentsChanged)
|
||||
Q_PROPERTY(int toolCallCount READ toolCallCount NOTIFY segmentsChanged)
|
||||
Q_PROPERTY(
|
||||
bool toolApprovalPending READ toolApprovalPending NOTIFY
|
||||
toolApprovalPendingChanged)
|
||||
Q_PROPERTY(
|
||||
QVariantList pendingToolCalls READ pendingToolCalls NOTIFY
|
||||
toolApprovalPendingChanged)
|
||||
|
||||
public:
|
||||
explicit ChatGeneration(qint64 timestamp, QObject* parent = nullptr);
|
||||
@@ -48,6 +57,14 @@ class ChatGeneration : public QObject {
|
||||
[[nodiscard]] QList<LlmSegment*> segments() const { return m_segments; }
|
||||
[[nodiscard]] int toolCallCount() const;
|
||||
[[nodiscard]] bool hasRunningTool() const;
|
||||
[[nodiscard]] bool hasPendingTool() const;
|
||||
|
||||
[[nodiscard]] bool toolApprovalPending() const { return m_approvalPending; }
|
||||
void setApprovalPending(bool value);
|
||||
[[nodiscard]] QVariantList pendingToolCalls() const;
|
||||
|
||||
Q_INVOKABLE void approveTools();
|
||||
Q_INVOKABLE void denyTools();
|
||||
|
||||
void setContent(const QString& value);
|
||||
void appendContent(const QString& piece);
|
||||
@@ -69,14 +86,17 @@ class ChatGeneration : public QObject {
|
||||
void streamingChanged();
|
||||
void toolStateChanged();
|
||||
void segmentsChanged();
|
||||
void toolApprovalPendingChanged();
|
||||
|
||||
private:
|
||||
void updateReasoningActive();
|
||||
LlmClient* client() const;
|
||||
|
||||
QTimer m_timer;
|
||||
QList<LlmSegment*> m_segments;
|
||||
bool m_reasoningActive = false;
|
||||
bool m_streaming = false;
|
||||
bool m_approvalPending = false;
|
||||
qint64 m_timestamp;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user