Files
z-bar-qt/Plugins/ZShell/Llm/attachment.hpp
T
zach 99949ff255
C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Failing after 11s
JS/TS / lint (pull_request) Successful in 9s
Python / static (pull_request) Failing after 31s
Rust / build (pull_request) Successful in 49s
Python / verify (pull_request) Successful in 1m37s
Rust / fmt (pull_request) Successful in 27s
Rust / clippy (pull_request) Successful in 58s
new chatlistview component, file attachments, performance & primitive test
2026-09-17 15:20:41 +02:00

49 lines
1.2 KiB
C++

#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