gpt4all/gpt4all-chat/server.h

43 lines
943 B
C
Raw Normal View History

2023-05-11 16:46:25 -04:00
#ifndef SERVER_H
#define SERVER_H
#include "llamacpp_model.h"
#include "database.h"
2023-05-11 16:46:25 -04:00
#include <QHttpServerRequest>
#include <QHttpServerResponse>
2023-05-11 16:46:25 -04:00
#include <QObject>
#include <QList>
#include <QString>
class Chat;
class QHttpServer;
2023-05-11 16:46:25 -04:00
class Server : public LlamaCppModel
2023-05-11 16:46:25 -04:00
{
Q_OBJECT
public:
Server(Chat *parent);
virtual ~Server();
public Q_SLOTS:
void start();
Q_SIGNALS:
void requestServerNewPromptResponsePair(const QString &prompt);
private Q_SLOTS:
QHttpServerResponse handleCompletionRequest(const QHttpServerRequest &request, bool isChat);
2023-06-19 18:23:54 -04:00
void handleDatabaseResultsChanged(const QList<ResultInfo> &results) { m_databaseResults = results; }
void handleCollectionListChanged(const QList<QString> &collectionList) { m_collections = collectionList; }
2023-05-11 16:46:25 -04:00
private:
Chat *m_chat;
QHttpServer *m_server;
2023-06-19 18:23:54 -04:00
QList<ResultInfo> m_databaseResults;
QList<QString> m_collections;
2023-05-11 16:46:25 -04:00
};
#endif // SERVER_H