gpt4all/network.h

46 lines
1.0 KiB
C
Raw Normal View History

#ifndef NETWORK_H
#define NETWORK_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
class Network : public QObject
{
Q_OBJECT
Q_PROPERTY(bool isActive READ isActive WRITE setActive NOTIFY activeChanged)
public:
static Network *globalInstance();
bool isActive() const { return m_isActive; }
void setActive(bool b);
Q_INVOKABLE QString generateUniqueId() const;
2023-04-24 01:05:38 +00:00
Q_INVOKABLE bool sendConversation(const QString &ingestId, const QString &conversation);
Q_SIGNALS:
void activeChanged();
void healthCheckFailed(int code);
private Q_SLOTS:
void handleHealthFinished();
void handleJsonUploadFinished();
private:
void sendHealth();
2023-04-24 01:05:38 +00:00
bool packageAndSendJson(const QString &ingestId, const QString &json);
private:
bool m_isActive;
QString m_uniqueId;
QNetworkAccessManager m_networkManager;
QVector<QNetworkReply*> m_activeUploads;
private:
explicit Network();
~Network() {}
friend class MyNetwork;
};
#endif // LLM_H