chore: restructure llm plugin to be more coherent & fix various bugs in llm ui
C++ / fmt (pull_request) Failing after 6s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 30s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m35s
Rust / fmt (pull_request) Successful in 36s
Rust / clippy (pull_request) Successful in 54s

This commit is contained in:
2026-10-18 12:58:38 +02:00
parent fc81be922f
commit 1fe8a3a959
54 changed files with 3022 additions and 2559 deletions
+16 -2
View File
@@ -10,13 +10,16 @@
namespace ZShell::llm {
class ChatSession;
class ChatMessage : public QObject {
Q_OBJECT
QML_ELEMENT
QML_UNCREATABLE("Chat messages are created by the Chat singleton")
QML_UNCREATABLE("Chat messages are created by ChatMessageModel")
Q_PROPERTY(Role role READ role CONSTANT)
Q_PROPERTY(qint64 timestamp READ timestamp CONSTANT)
Q_PROPERTY(QString content READ content NOTIFY contentChanged)
Q_PROPERTY(
int generationCount READ generationCount NOTIFY generationsChanged)
Q_PROPERTY(
@@ -36,10 +39,16 @@ class ChatMessage : public QObject {
enum class Role : int { User = 0, Assistant };
Q_ENUM(Role)
explicit ChatMessage(Role role, qint64 timestamp, QObject* parent = nullptr);
ChatMessage(
ChatSession* session,
Role role,
qint64 timestamp,
QObject* parent = nullptr);
[[nodiscard]] ChatSession* session() const { return m_session; }
[[nodiscard]] Role role() const { return m_role; }
[[nodiscard]] qint64 timestamp() const { return m_timestamp; }
[[nodiscard]] QString content() const;
[[nodiscard]] int generationCount() const {
return static_cast<int>(m_generations.size());
}
@@ -68,7 +77,10 @@ class ChatMessage : public QObject {
ChatGeneration* appendGeneration(qint64 timestamp);
void removeGeneration(ChatGeneration* generation);
void setContent(const QString& value);
Q_SIGNALS:
void contentChanged();
void generationsChanged();
void activeGenerationChanged();
void attachmentsChanged();
@@ -76,8 +88,10 @@ class ChatMessage : public QObject {
private:
void setActiveInternal(int index);
ChatSession* m_session;
Role m_role;
qint64 m_timestamp;
QString m_content;
QList<ChatGeneration*> m_generations;
QList<Attachment*> m_attachments;
int m_active = -1;