new chatlistview component, file attachments, performance & primitive test
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QtQml>
|
||||
|
||||
namespace ZShell::llm {
|
||||
|
||||
class Attachment : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("Attachments are created by ChatSession.addAttachments")
|
||||
|
||||
Q_PROPERTY(QString name READ name CONSTANT)
|
||||
Q_PROPERTY(QString path READ path CONSTANT)
|
||||
Q_PROPERTY(Kind kind READ kind CONSTANT)
|
||||
Q_PROPERTY(bool isImage READ isImage CONSTANT)
|
||||
Q_PROPERTY(QString mimeType READ mimeType CONSTANT)
|
||||
Q_PROPERTY(qint64 size READ size CONSTANT)
|
||||
|
||||
public:
|
||||
enum class Kind : int { Image = 0, File = 1 };
|
||||
Q_ENUM(Kind)
|
||||
|
||||
Attachment(
|
||||
const QString& name,
|
||||
const QString& path,
|
||||
Kind kind,
|
||||
const QString& mimeType,
|
||||
qint64 size,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
[[nodiscard]] QString name() const { return m_name; }
|
||||
[[nodiscard]] QString path() const { return m_path; }
|
||||
[[nodiscard]] Kind kind() const { return m_kind; }
|
||||
[[nodiscard]] bool isImage() const { return m_kind == Kind::Image; }
|
||||
[[nodiscard]] QString mimeType() const { return m_mimeType; }
|
||||
[[nodiscard]] qint64 size() const { return m_size; }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_path;
|
||||
Kind m_kind;
|
||||
QString m_mimeType;
|
||||
qint64 m_size = 0;
|
||||
};
|
||||
|
||||
} // namespace ZShell::llm
|
||||
Reference in New Issue
Block a user