chore: format llm c files
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
JS/TS / lint (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 16s
C++ / clang-tidy (pull_request) Failing after 43s
Python / static (pull_request) Failing after 57s
Rust / fmt (pull_request) Successful in 1m30s
Rust / build (pull_request) Successful in 2m5s
Rust / clippy (pull_request) Successful in 1m55s
Python / verify (pull_request) Successful in 2m23s

This commit is contained in:
2026-08-31 19:02:26 +02:00
parent dbb51ceadd
commit 52feb6006a
27 changed files with 741 additions and 1190 deletions
+2 -25
View File
@@ -8,10 +8,6 @@
namespace ZShell::llm {
// One unit of activity within a ChatGeneration. A generation keeps its
// segments in chronological order: zero or more reasoning bursts and
// tool calls interleaved, plus at most one content segment holding the
// final answer.
class LlmSegment : public QObject {
Q_OBJECT
QML_ELEMENT
@@ -27,26 +23,13 @@ class LlmSegment : public QObject {
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
Q_PROPERTY(qint64 elapsedMs READ elapsedMs NOTIFY elapsedMsChanged)
// Parsed markdown blocks (QVariantList of maps, see MarkdownParser).
// Only Content segments are parsed. Refreshes are debounced so a
// streaming segment re-parses at a steady cadence rather than per
// chunk.
Q_PROPERTY(QVariantList markdown READ markdown NOTIFY markdownChanged)
public:
enum class Type : int {
Reasoning = 0,
ToolCall,
Content
};
enum class Type : int { Reasoning = 0, ToolCall, Content };
Q_ENUM(Type)
enum class Status : int {
None = 0,
Running,
Success,
Error
};
enum class Status : int { None = 0, Running, Success, Error };
Q_ENUM(Status)
explicit LlmSegment(Type type, qint64 timestamp, QObject* parent = nullptr);
@@ -63,9 +46,7 @@ class LlmSegment : public QObject {
[[nodiscard]] qint64 elapsedMs() const;
[[nodiscard]] QVariantList markdown() const { return m_markdown; }
// Starts the segment's clock; a no-op while already running.
void begin();
// Stops the segment's clock; a no-op when not running.
void close();
void appendText(const QString& piece);
void setText(const QString& value);
@@ -74,9 +55,7 @@ class LlmSegment : public QObject {
void appendArguments(const QString& piece);
void setResult(const QString& value);
void setStatus(Status value);
// Completes a tool call with the model-facing result text.
void finishTool(const QString& resultText, bool success);
// Restores persisted timing without a live clock.
void restore(qint64 elapsedMs);
Q_SIGNALS:
@@ -92,8 +71,6 @@ class LlmSegment : public QObject {
private:
void scheduleMarkdown();
// Kicks off an off-thread parse; returns false when one is already
// in flight (the pending change is picked up when it completes).
bool parseMarkdown();
Type m_type;