Add stream text to chat

This commit is contained in:
Petr Mironychev
2024-10-16 22:51:34 +02:00
parent 3db2691114
commit 80eda8c167
5 changed files with 43 additions and 37 deletions

View File

@ -46,6 +46,7 @@ public:
ChatRole role;
QString content;
int tokenCount;
QString id;
};
explicit ChatModel(QObject *parent = nullptr);
@ -54,7 +55,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void addMessage(const QString &content, ChatRole role);
Q_INVOKABLE void addMessage(const QString &content, ChatRole role, const QString &id);
Q_INVOKABLE void clear();
Q_INVOKABLE QList<MessagePart> processMessageContent(const QString &content) const;