new chatlistview component, file attachments, performance & primitive test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "attachment.hpp"
|
||||
#include "generation.hpp"
|
||||
|
||||
#include <QList>
|
||||
@@ -27,6 +28,9 @@ class ChatMessage : public QObject {
|
||||
Q_PROPERTY(
|
||||
int activeGenerationIndex READ activeGenerationIndex NOTIFY
|
||||
activeGenerationChanged)
|
||||
Q_PROPERTY(
|
||||
QList<ZShell::llm::Attachment*> attachments READ attachments NOTIFY
|
||||
attachmentsChanged)
|
||||
|
||||
public:
|
||||
enum class Role : int { User = 0, Assistant };
|
||||
@@ -46,12 +50,16 @@ class ChatMessage : public QObject {
|
||||
return generation(m_active);
|
||||
}
|
||||
[[nodiscard]] int activeGenerationIndex() const { return m_active; }
|
||||
[[nodiscard]] QList<Attachment*> attachments() const {
|
||||
return m_attachments;
|
||||
}
|
||||
[[nodiscard]] ChatGeneration* generation(int index) const {
|
||||
if (index < 0 || index >= m_generations.size()) return nullptr;
|
||||
return m_generations.at(index);
|
||||
}
|
||||
|
||||
Q_INVOKABLE void setActiveGeneration(int index);
|
||||
void setAttachments(QList<Attachment*> attachments);
|
||||
Q_INVOKABLE void edit(const QString& newContent);
|
||||
Q_INVOKABLE void retry();
|
||||
Q_INVOKABLE void generate();
|
||||
@@ -63,6 +71,7 @@ class ChatMessage : public QObject {
|
||||
Q_SIGNALS:
|
||||
void generationsChanged();
|
||||
void activeGenerationChanged();
|
||||
void attachmentsChanged();
|
||||
|
||||
private:
|
||||
void setActiveInternal(int index);
|
||||
@@ -70,6 +79,7 @@ class ChatMessage : public QObject {
|
||||
Role m_role;
|
||||
qint64 m_timestamp;
|
||||
QList<ChatGeneration*> m_generations;
|
||||
QList<Attachment*> m_attachments;
|
||||
int m_active = -1;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user