gpt4all/llm.h

53 lines
1.2 KiB
C
Raw Normal View History

2023-04-09 03:28:39 +00:00
#ifndef LLM_H
#define LLM_H
#include <QObject>
#include "chat.h"
2023-04-09 03:28:39 +00:00
class LLM : public QObject
{
Q_OBJECT
Q_PROPERTY(QList<QString> modelList READ modelList NOTIFY modelListChanged)
Q_PROPERTY(bool isRecalc READ isRecalc NOTIFY recalcChanged)
Q_PROPERTY(Chat *currentChat READ currentChat NOTIFY currentChatChanged)
Q_PROPERTY(QList<QString> chatList READ chatList NOTIFY chatListChanged)
2023-04-09 03:28:39 +00:00
public:
static LLM *globalInstance();
QList<QString> modelList() const;
bool isRecalc() const;
Chat *currentChat() const;
QList<QString> chatList() const;
Q_INVOKABLE QString addChat();
Q_INVOKABLE void removeChat(const QString &id);
Q_INVOKABLE Chat *chatFromId(const QString &id) const;
Q_INVOKABLE void setCurrentChatFromId(const QString &id);
Q_INVOKABLE bool checkForUpdates() const;
2023-04-09 03:28:39 +00:00
Q_SIGNALS:
void modelListChanged();
void currentChatChanged();
void recalcChanged();
void chatListChanged();
void responseChanged();
2023-04-09 03:28:39 +00:00
private:
void connectChat(Chat *chat);
void disconnectChat(Chat *chat);
private:
QString m_currentChat;
QMap<QString, Chat*> m_chats;
2023-04-09 03:28:39 +00:00
private:
explicit LLM();
~LLM() {}
friend class MyLLM;
};
#endif // LLM_H