2023-04-08 23:28:39 -04:00
|
|
|
#ifndef LLM_H
|
|
|
|
#define LLM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2023-04-30 20:28:07 -04:00
|
|
|
|
|
|
|
#include "chat.h"
|
2023-04-08 23:28:39 -04:00
|
|
|
|
|
|
|
class LLM : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2023-04-18 11:42:16 -04:00
|
|
|
Q_PROPERTY(QList<QString> modelList READ modelList NOTIFY modelListChanged)
|
2023-05-01 12:41:03 -04:00
|
|
|
Q_PROPERTY(bool isRecalc READ isRecalc NOTIFY recalcChanged)
|
2023-05-01 14:24:16 -04:00
|
|
|
Q_PROPERTY(Chat *currentChat READ currentChat NOTIFY currentChatChanged)
|
|
|
|
Q_PROPERTY(QList<QString> chatList READ chatList NOTIFY chatListChanged)
|
2023-04-25 11:20:51 -04:00
|
|
|
|
2023-04-08 23:28:39 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
static LLM *globalInstance();
|
|
|
|
|
2023-04-18 11:42:16 -04:00
|
|
|
QList<QString> modelList() const;
|
2023-05-01 12:41:03 -04:00
|
|
|
bool isRecalc() const;
|
2023-05-01 14:24:16 -04:00
|
|
|
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-30 20:28:07 -04:00
|
|
|
|
2023-04-08 23:28:39 -04:00
|
|
|
Q_SIGNALS:
|
2023-04-18 11:42:16 -04:00
|
|
|
void modelListChanged();
|
2023-04-30 20:28:07 -04:00
|
|
|
void currentChatChanged();
|
2023-05-01 12:41:03 -04:00
|
|
|
void recalcChanged();
|
2023-05-01 14:24:16 -04:00
|
|
|
void chatListChanged();
|
2023-05-01 12:41:03 -04:00
|
|
|
void responseChanged();
|
2023-04-08 23:28:39 -04:00
|
|
|
|
|
|
|
private:
|
2023-05-01 14:24:16 -04:00
|
|
|
void connectChat(Chat *chat);
|
|
|
|
void disconnectChat(Chat *chat);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_currentChat;
|
|
|
|
QMap<QString, Chat*> m_chats;
|
2023-04-08 23:28:39 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
explicit LLM();
|
|
|
|
~LLM() {}
|
|
|
|
friend class MyLLM;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LLM_H
|