new chatlistview component, file attachments, performance & primitive test

This commit is contained in:
2026-09-30 15:01:28 +02:00
parent 51ed270774
commit d8a3d5732e
36 changed files with 4368 additions and 310 deletions
+21
View File
@@ -6,6 +6,8 @@
#include <QDateTime>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QVariantList>
#include <QtQml>
namespace ZShell::llm {
@@ -27,6 +29,10 @@ class ChatSession : public QObject {
Q_PROPERTY(int messageCount READ messageCount NOTIFY messageCountChanged)
Q_PROPERTY(
ZShell::llm::ChatMessageModel* messagesModel READ messagesModel CONSTANT)
Q_PROPERTY(QString workspace READ workspacePath CONSTANT)
Q_PROPERTY(
QString attachmentError READ attachmentError NOTIFY
attachmentErrorChanged)
public:
explicit ChatSession(const QString& id, QObject* parent = nullptr);
@@ -55,6 +61,13 @@ class ChatSession : public QObject {
[[nodiscard]] int lastTokenCount() const { return m_lastTokenCount; }
void setLastTokenCount(int value);
[[nodiscard]] QString workspacePath() const { return m_workspace; }
[[nodiscard]] QString attachmentError() const { return m_attachmentError; }
void setAttachmentError(const QString& value);
static QString sandboxDirFor(const QString& sessionId);
void ensureWorkspace();
void setTitle(const QString& value);
void setIcon(const QString& value);
void setUpdatedAt(qint64 value);
@@ -71,7 +84,12 @@ class ChatSession : public QObject {
void removeMessage(ChatMessage* message);
void clearMessages();
Q_INVOKABLE QVariantList addAttachments(const QStringList& paths);
Q_INVOKABLE bool clipboardHasAttachment();
Q_INVOKABLE QVariantList pasteAttachments();
Q_INVOKABLE void sendMessage(const QString& text);
Q_INVOKABLE void sendMessage(
const QString& text, const QVariantList& attachments);
Q_INVOKABLE void retry(ZShell::llm::ChatMessage* target);
Q_INVOKABLE void continueFrom(ZShell::llm::ChatMessage* message);
Q_INVOKABLE void clear();
@@ -83,6 +101,7 @@ class ChatSession : public QObject {
void pinnedChanged();
void messageCountChanged();
void loaded();
void attachmentErrorChanged();
private:
void onModelRowsChanged();
@@ -103,6 +122,8 @@ class ChatSession : public QObject {
bool m_loaded = false;
bool m_clearPending = false;
int m_lastTokenCount = 0;
QString m_workspace;
QString m_attachmentError;
};
} // namespace ZShell::llm