-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathllamastorage.h
More file actions
46 lines (37 loc) · 1.46 KB
/
llamastorage.h
File metadata and controls
46 lines (37 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include <QSqlDatabase>
#include <QVariant>
#include <QVector>
namespace LlamaCpp {
struct Conversation;
struct Message;
class Storage : public QObject
{
Q_OBJECT
public:
Storage();
static Storage &instance(); // singleton
QList<Conversation> getAllConversations();
Conversation getOneConversation(const QString &convId);
Conversation createConversation(const QString &name);
void renameConversation(const QString &convId, const QString &name);
void deleteConversation(const QString &convId);
QVector<Message> getMessages(const QString &convId);
void appendMsg(Message &msg, qint64 parentNodeId);
QVector<Message> filterByLeafNodeId(const QVector<Message> &msgs,
qint64 leafNodeId,
bool includeRoot);
bool updateMessageExtra(const LlamaCpp::Message &msg, const QList<QVariantMap> &extra);
bool updateMessageContent(const Message &msg);
bool deleteMessageBranch(qint64 msgId);
signals:
void conversationCreated(const QString &convId);
void conversationRenamed(const QString &convId);
void conversationDeleted(const QString &convId);
void messageAppended(const LlamaCpp::Message &msg, qint64 pendingId);
void messageExtraUpdated(const LlamaCpp::Message &msg, const QList<QVariantMap> &newExtra);
void messageContentUpdated(const LlamaCpp::Message &msg);
private:
QSqlDatabase db;
};
} // namespace LlamaCpp