mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
chat: fix #includes with include-what-you-use (#2401)
Also use qGuiApp instead of qApp. Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
55d709862f
commit
d3d777bc51
@ -1,9 +1,23 @@
|
||||
#include "chat.h"
|
||||
|
||||
#include "chatlistmodel.h"
|
||||
#include "mysettings.h"
|
||||
#include "modellist.h"
|
||||
#include "network.h"
|
||||
#include "server.h"
|
||||
#include "database.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QLatin1String>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <utility>
|
||||
|
||||
Chat::Chat(QObject *parent)
|
||||
: QObject(parent)
|
||||
|
@ -1,14 +1,19 @@
|
||||
#ifndef CHAT_H
|
||||
#define CHAT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtQml>
|
||||
#include <QDataStream>
|
||||
|
||||
#include "chatllm.h"
|
||||
#include "chatmodel.h"
|
||||
#include "database.h"
|
||||
#include "localdocsmodel.h"
|
||||
#include "localdocsmodel.h" // IWYU pragma: keep
|
||||
#include "modellist.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
class QDataStream;
|
||||
struct ResultInfo;
|
||||
|
||||
class Chat : public QObject
|
||||
{
|
||||
|
@ -1,15 +1,23 @@
|
||||
#include "chatapi.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QThread>
|
||||
#include <QEventLoop>
|
||||
#include <QGuiApplication>
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
@ -192,7 +200,7 @@ void ChatAPIWorker::request(const QString &apiKey,
|
||||
request.setRawHeader("Authorization", authorization.toUtf8());
|
||||
m_networkManager = new QNetworkAccessManager(this);
|
||||
QNetworkReply *reply = m_networkManager->post(request, array);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(reply, &QNetworkReply::finished, this, &ChatAPIWorker::handleFinished);
|
||||
connect(reply, &QNetworkReply::readyRead, this, &ChatAPIWorker::handleReadyRead);
|
||||
connect(reply, &QNetworkReply::errorOccurred, this, &ChatAPIWorker::handleErrorOccurred);
|
||||
|
@ -1,17 +1,23 @@
|
||||
#ifndef CHATAPI_H
|
||||
#define CHATAPI_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class QByteArray;
|
||||
class QNetworkAccessManager;
|
||||
|
||||
class ChatAPI;
|
||||
class ChatAPIWorker : public QObject {
|
||||
|
@ -1,8 +1,21 @@
|
||||
#include "chatlistmodel.h"
|
||||
|
||||
#include "database.h" // IWYU pragma: keep
|
||||
#include "mysettings.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGuiApplication>
|
||||
#include <QIODevice>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <Qt>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define CHAT_FORMAT_MAGIC 0xF5D553CC
|
||||
#define CHAT_FORMAT_VERSION 7
|
||||
@ -223,7 +236,7 @@ void ChatsRestoreThread::run()
|
||||
qDebug() << "deserializing chat" << f.file;
|
||||
|
||||
Chat *chat = new Chat;
|
||||
chat->moveToThread(qApp->thread());
|
||||
chat->moveToThread(qGuiApp->thread());
|
||||
if (!chat->deserialize(in, version)) {
|
||||
qWarning() << "ERROR: Couldn't deserialize chat from file:" << file.fileName();
|
||||
} else {
|
||||
|
@ -1,8 +1,22 @@
|
||||
#ifndef CHATLISTMODEL_H
|
||||
#define CHATLISTMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include "chat.h"
|
||||
#include "chatllm.h"
|
||||
#include "chatmodel.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QtLogging>
|
||||
|
||||
class ChatsRestoreThread : public QThread
|
||||
{
|
||||
|
@ -1,11 +1,27 @@
|
||||
#include "chatllm.h"
|
||||
|
||||
#include "chat.h"
|
||||
#include "chatapi.h"
|
||||
#include "database.h"
|
||||
#include "localdocs.h"
|
||||
#include "modellist.h"
|
||||
#include "network.h"
|
||||
#include "mysettings.h"
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
#include "network.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QGlobalStatic>
|
||||
#include <QIODevice>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QSet>
|
||||
#include <QVariantMap>
|
||||
#include <QWaitCondition>
|
||||
#include <Qt>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
@ -13,12 +29,10 @@
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_MODEL_LOADING
|
||||
|
||||
|
@ -1,16 +1,29 @@
|
||||
#ifndef CHATLLM_H
|
||||
#define CHATLLM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "database.h"
|
||||
#include "modellist.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class QDataStream;
|
||||
struct ResultInfo;
|
||||
template <typename T> class QList;
|
||||
|
||||
enum LLModelType {
|
||||
GPTJ_,
|
||||
LLAMA_,
|
||||
|
@ -2,8 +2,17 @@
|
||||
#define CHATMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QtQml>
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
struct ChatItem
|
||||
{
|
||||
|
@ -2,11 +2,32 @@
|
||||
|
||||
#include "embeddings.h"
|
||||
#include "embllm.h"
|
||||
#include "modellist.h"
|
||||
#include "mysettings.h"
|
||||
#include "network.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QFile>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QIODevice>
|
||||
#include <QPdfDocument>
|
||||
#include <QPdfSelection>
|
||||
#include <QRegularExpression>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <QSqlQuery>
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QVariant>
|
||||
#include <Qt>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_EXAMPLE
|
||||
|
@ -3,16 +3,26 @@
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QLatin1String>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
#include <QtSql>
|
||||
|
||||
#include "embllm.h"
|
||||
#include <cstddef>
|
||||
|
||||
class EmbeddingLLM;
|
||||
class Embeddings;
|
||||
class QFileSystemWatcher;
|
||||
class QSqlError;
|
||||
class QTextStream;
|
||||
class QTimer;
|
||||
struct EmbeddingResult;
|
||||
|
||||
struct DocumentInfo
|
||||
{
|
||||
|
@ -1,18 +1,37 @@
|
||||
#include "download.h"
|
||||
#include "network.h"
|
||||
|
||||
#include "modellist.h"
|
||||
#include "mysettings.h"
|
||||
#include "network.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QCoreApplication>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QDebug>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGuiApplication>
|
||||
#include <QIODevice>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QNetworkRequest>
|
||||
#include <QPair>
|
||||
#include <QSettings>
|
||||
#include <QSslConfiguration>
|
||||
#include <QSslError>
|
||||
#include <QSslSocket>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <Qt>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
class MyDownload: public Download { };
|
||||
Q_GLOBAL_STATIC(MyDownload, downloadInstance)
|
||||
@ -104,7 +123,7 @@ void Download::updateReleaseNotes()
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *jsonReply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(jsonReply, &QNetworkReply::finished, this, &Download::handleReleaseJsonDownloadFinished);
|
||||
}
|
||||
|
||||
@ -149,7 +168,7 @@ void Download::downloadModel(const QString &modelFile)
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *modelReply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, modelReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, modelReply, &QNetworkReply::abort);
|
||||
connect(modelReply, &QNetworkReply::downloadProgress, this, &Download::handleDownloadProgress);
|
||||
connect(modelReply, &QNetworkReply::errorOccurred, this, &Download::handleErrorOccurred);
|
||||
connect(modelReply, &QNetworkReply::finished, this, &Download::handleModelDownloadFinished);
|
||||
|
@ -1,13 +1,22 @@
|
||||
#ifndef DOWNLOAD_H
|
||||
#define DOWNLOAD_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QFile>
|
||||
#include <QVariant>
|
||||
#include <QTemporaryFile>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
#include <QtGlobal>
|
||||
|
||||
class QByteArray;
|
||||
class QFile;
|
||||
class QSslError;
|
||||
template <typename T> class QList;
|
||||
|
||||
struct ReleaseInfo {
|
||||
Q_GADGET
|
||||
|
@ -1,12 +1,21 @@
|
||||
#include "embeddings.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
#include "mysettings.h"
|
||||
|
||||
#include "hnswlib/hnswlib.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QtGlobal>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <exception>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#define EMBEDDINGS_VERSION 0
|
||||
|
||||
const int s_dim = 384; // Dimension of the elements
|
||||
|
@ -2,11 +2,14 @@
|
||||
#define EMBEDDINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace hnswlib {
|
||||
template <typename T>
|
||||
class HierarchicalNSW;
|
||||
class InnerProductSpace;
|
||||
template <typename T> class HierarchicalNSW;
|
||||
}
|
||||
|
||||
class Embeddings : public QObject
|
||||
|
@ -1,6 +1,32 @@
|
||||
#include "embllm.h"
|
||||
|
||||
#include "modellist.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QGuiApplication>
|
||||
#include <QIODevice>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QUrl>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
EmbeddingLLMWorker::EmbeddingLLMWorker()
|
||||
: QObject(nullptr)
|
||||
, m_networkManager(new QNetworkAccessManager(this))
|
||||
@ -128,7 +154,7 @@ void EmbeddingLLMWorker::sendAtlasRequest(const QStringList &texts, const QStrin
|
||||
request.setRawHeader("Authorization", authorization.toUtf8());
|
||||
request.setAttribute(QNetworkRequest::User, userData);
|
||||
QNetworkReply *reply = m_networkManager->post(request, doc.toJson(QJsonDocument::Compact));
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(reply, &QNetworkReply::finished, this, &EmbeddingLLMWorker::handleFinished);
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,20 @@
|
||||
#ifndef EMBLLM_H
|
||||
#define EMBLLM_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
|
||||
class LLModel;
|
||||
class QNetworkAccessManager;
|
||||
|
||||
struct EmbeddingChunk {
|
||||
int folder_id;
|
||||
|
@ -1,20 +1,22 @@
|
||||
#include "llm.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
#include "../gpt4all-backend/sysinfo.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QNetworkInformation>
|
||||
#include <QProcess>
|
||||
#include <QResource>
|
||||
#include <QSettings>
|
||||
#include <QUrl>
|
||||
#include <QNetworkInformation>
|
||||
#include <fstream>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef GPT4ALL_OFFLINE_INSTALLER
|
||||
#include "network.h"
|
||||
# include "network.h"
|
||||
#endif
|
||||
|
||||
class MyLLM: public LLM { };
|
||||
|
@ -2,6 +2,8 @@
|
||||
#define LLM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
class LLM : public QObject
|
||||
{
|
||||
|
@ -1,6 +1,14 @@
|
||||
#include "localdocs.h"
|
||||
|
||||
#include "database.h"
|
||||
#include "mysettings.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGuiApplication>
|
||||
#include <QUrl>
|
||||
#include <Qt>
|
||||
|
||||
class MyLocalDocs: public LocalDocs { };
|
||||
Q_GLOBAL_STATIC(MyLocalDocs, localDocsInstance)
|
||||
LocalDocs *LocalDocs::globalInstance()
|
||||
@ -55,7 +63,7 @@ LocalDocs::LocalDocs()
|
||||
connect(m_database, &Database::collectionListUpdated,
|
||||
m_localDocsModel, &LocalDocsModel::collectionListUpdated, Qt::QueuedConnection);
|
||||
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, this, &LocalDocs::aboutToQuit);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, this, &LocalDocs::aboutToQuit);
|
||||
}
|
||||
|
||||
void LocalDocs::aboutToQuit()
|
||||
|
@ -1,10 +1,12 @@
|
||||
#ifndef LOCALDOCS_H
|
||||
#define LOCALDOCS_H
|
||||
|
||||
#include "localdocsmodel.h"
|
||||
#include "database.h"
|
||||
#include "localdocsmodel.h" // IWYU pragma: keep
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class Database;
|
||||
|
||||
class LocalDocs : public QObject
|
||||
{
|
||||
|
@ -3,6 +3,11 @@
|
||||
#include "localdocs.h"
|
||||
#include "network.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <utility>
|
||||
|
||||
LocalDocsCollectionsModel::LocalDocsCollectionsModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
@ -1,9 +1,23 @@
|
||||
#ifndef LOCALDOCSMODEL_H
|
||||
#define LOCALDOCSMODEL_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include "database.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
#include <Qt>
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
class LocalDocsCollectionsModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -1,10 +1,14 @@
|
||||
#include "logger.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QStandardPaths>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QGlobalStatic>
|
||||
#include <QIODevice>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
class MyLogger: public Logger { };
|
||||
Q_GLOBAL_STATIC(MyLogger, loggerInstance)
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
#include <QtLogging>
|
||||
|
||||
class Logger
|
||||
{
|
||||
|
@ -1,19 +1,24 @@
|
||||
#include <QDirIterator>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include "llm.h"
|
||||
#include "modellist.h"
|
||||
#include "chatlistmodel.h"
|
||||
#include "localdocs.h"
|
||||
#include "download.h"
|
||||
#include "network.h"
|
||||
#include "mysettings.h"
|
||||
#include "config.h"
|
||||
#include "download.h"
|
||||
#include "llm.h"
|
||||
#include "localdocs.h"
|
||||
#include "logger.h"
|
||||
#include "modellist.h"
|
||||
#include "mysettings.h"
|
||||
#include "network.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QObject>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlEngine>
|
||||
#include <QString>
|
||||
#include <Qt>
|
||||
#include <QUrl>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setOrganizationName("nomic.ai");
|
||||
|
@ -1,12 +1,43 @@
|
||||
#include "modellist.h"
|
||||
|
||||
#include "mysettings.h"
|
||||
#include "network.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QChar>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QEventLoop>
|
||||
#include <QFile>
|
||||
#include <QStandardPaths>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGuiApplication>
|
||||
#include <QIODevice>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QNetworkRequest>
|
||||
#include <QObject>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QSslConfiguration>
|
||||
#include <QSslError>
|
||||
#include <QSslSocket>
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QtLogging>
|
||||
#include <QUrl>
|
||||
|
||||
#include <algorithm>
|
||||
#include <compare>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
//#define USE_LOCAL_MODELSJSON
|
||||
|
||||
@ -1278,7 +1309,7 @@ void ModelList::updateModelsFromJson()
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *jsonReply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
QEventLoop loop;
|
||||
connect(jsonReply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||
QTimer::singleShot(1500, &loop, &QEventLoop::quit);
|
||||
@ -1322,7 +1353,7 @@ void ModelList::updateModelsFromJsonAsync()
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *jsonReply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(jsonReply, &QNetworkReply::finished, this, &ModelList::handleModelsJsonDownloadFinished);
|
||||
connect(jsonReply, &QNetworkReply::errorOccurred, this, &ModelList::handleModelsJsonDownloadErrorOccurred);
|
||||
}
|
||||
@ -1914,7 +1945,7 @@ void ModelList::discoverSearch(const QString &search)
|
||||
QNetworkRequest request(hfUrl);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
QNetworkReply *reply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(reply, &QNetworkReply::finished, this, &ModelList::handleDiscoveryFinished);
|
||||
connect(reply, &QNetworkReply::errorOccurred, this, &ModelList::handleDiscoveryErrorOccurred);
|
||||
}
|
||||
@ -2022,7 +2053,7 @@ void ModelList::parseDiscoveryJsonFile(const QByteArray &jsonData)
|
||||
request.setAttribute(QNetworkRequest::User, jsonData);
|
||||
request.setAttribute(QNetworkRequest::UserMax, filename);
|
||||
QNetworkReply *reply = m_networkManager.head(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(reply, &QNetworkReply::finished, this, &ModelList::handleDiscoveryItemFinished);
|
||||
connect(reply, &QNetworkReply::errorOccurred, this, &ModelList::handleDiscoveryItemErrorOccurred);
|
||||
}
|
||||
|
@ -2,7 +2,24 @@
|
||||
#define MODELLIST_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMutex>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QObject>
|
||||
#include <QPair>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QString>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QtQml>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
|
||||
class QSslError;
|
||||
|
||||
struct ModelInfo {
|
||||
Q_GADGET
|
||||
|
@ -1,13 +1,26 @@
|
||||
#include "mysettings.h"
|
||||
|
||||
#include "modellist.h"
|
||||
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QGlobalStatic>
|
||||
#include <QIODevice>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QThread>
|
||||
#include <QtLogging>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
static int default_threadCount = std::min(4, (int32_t) std::thread::hardware_concurrency());
|
||||
static bool default_saveChatsContext = false;
|
||||
|
@ -1,12 +1,16 @@
|
||||
#ifndef MYSETTINGS_H
|
||||
#define MYSETTINGS_H
|
||||
|
||||
#include "modellist.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
|
||||
#include "modellist.h"
|
||||
struct ModelInfo;
|
||||
|
||||
class MySettings : public QObject
|
||||
{
|
||||
|
@ -1,21 +1,44 @@
|
||||
#include "network.h"
|
||||
|
||||
#include "chat.h"
|
||||
#include "chatlistmodel.h"
|
||||
#include "download.h"
|
||||
#include "llm.h"
|
||||
#include "localdocs.h"
|
||||
#include "localdocsmodel.h"
|
||||
#include "modellist.h"
|
||||
#include "mysettings.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "../gpt4all-backend/llmodel.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QGlobalStatic>
|
||||
#include <QGuiApplication>
|
||||
#include <QUuid>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QScreen>
|
||||
#include <QSettings>
|
||||
#include <QSize>
|
||||
#include <QSslConfiguration>
|
||||
#include <QSslError>
|
||||
#include <QSslSocket>
|
||||
#include <QSysInfo>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QtLogging>
|
||||
#include <QUrl>
|
||||
#include <QUuid>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
@ -162,7 +185,7 @@ bool Network::packageAndSendJson(const QString &ingestId, const QString &json)
|
||||
QByteArray body(newDoc.toJson(QJsonDocument::Compact));
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
QNetworkReply *jsonReply = m_networkManager.post(request, body);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, jsonReply, &QNetworkReply::abort);
|
||||
connect(jsonReply, &QNetworkReply::finished, this, &Network::handleJsonUploadFinished);
|
||||
m_activeUploads.append(jsonReply);
|
||||
return true;
|
||||
@ -336,7 +359,7 @@ void Network::sendIpify()
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *reply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, reply, &QNetworkReply::abort);
|
||||
connect(reply, &QNetworkReply::finished, this, &Network::handleIpifyFinished);
|
||||
}
|
||||
|
||||
@ -349,7 +372,7 @@ void Network::sendMixpanel(const QByteArray &json)
|
||||
request.setSslConfiguration(conf);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
QNetworkReply *trackReply = m_networkManager.post(request, json);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, trackReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, trackReply, &QNetworkReply::abort);
|
||||
connect(trackReply, &QNetworkReply::finished, this, &Network::handleMixpanelFinished);
|
||||
}
|
||||
|
||||
@ -411,7 +434,7 @@ void Network::sendHealth()
|
||||
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
request.setSslConfiguration(conf);
|
||||
QNetworkReply *healthReply = m_networkManager.get(request);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, healthReply, &QNetworkReply::abort);
|
||||
connect(qGuiApp, &QCoreApplication::aboutToQuit, healthReply, &QNetworkReply::abort);
|
||||
connect(healthReply, &QNetworkReply::finished, this, &Network::handleHealthFinished);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,18 @@
|
||||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonValue>
|
||||
#include <QMap>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
|
||||
class QByteArray;
|
||||
class QNetworkReply;
|
||||
class QSslError;
|
||||
template <typename T> class QList;
|
||||
|
||||
struct KeyValue {
|
||||
QString key;
|
||||
|
@ -1,13 +1,24 @@
|
||||
#include "responsetext.h"
|
||||
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextDocument>
|
||||
#include <QTextDocumentFragment>
|
||||
#include <QFontMetricsF>
|
||||
#include <QTextTableCell>
|
||||
#include <QGuiApplication>
|
||||
#include <QBrush>
|
||||
#include <QChar>
|
||||
#include <QClipboard>
|
||||
#include <QFont>
|
||||
#include <QFontMetricsF>
|
||||
#include <QGuiApplication>
|
||||
#include <QList>
|
||||
#include <QPainter>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QRegularExpression>
|
||||
#include <Qt>
|
||||
#include <QTextBlock>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
#include <QTextFrame>
|
||||
#include <QTextTableCell>
|
||||
#include <QtGlobal>
|
||||
#include <QVariant>
|
||||
|
||||
enum Language {
|
||||
None,
|
||||
|
@ -1,12 +1,20 @@
|
||||
#ifndef RESPONSETEXT_H
|
||||
#define RESPONSETEXT_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickTextDocument>
|
||||
#include <QQuickTextDocument> // IWYU pragma: keep
|
||||
#include <QRectF>
|
||||
#include <QSizeF>
|
||||
#include <QString>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextObjectInterface>
|
||||
#include <QVector>
|
||||
|
||||
class QPainter;
|
||||
class QTextDocument;
|
||||
class QTextFormat;
|
||||
|
||||
class SyntaxHighlighter : public QSyntaxHighlighter {
|
||||
Q_OBJECT
|
||||
|
@ -1,13 +1,28 @@
|
||||
#include "server.h"
|
||||
#include "chat.h"
|
||||
#include "mysettings.h"
|
||||
#include "modellist.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include "chat.h"
|
||||
#include "modellist.h"
|
||||
#include "mysettings.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QHostAddress>
|
||||
#include <QHttpServer>
|
||||
#include <QHttpServerRequest>
|
||||
#include <QHttpServerResponder>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QPair>
|
||||
#include <Qt>
|
||||
#include <QtLogging>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
|
@ -2,9 +2,16 @@
|
||||
#define SERVER_H
|
||||
|
||||
#include "chatllm.h"
|
||||
#include "database.h"
|
||||
|
||||
#include <QHttpServerResponse>
|
||||
#include <QObject>
|
||||
#include <QtHttpServer/QHttpServer>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
class Chat;
|
||||
class QHttpServer;
|
||||
class QHttpServerRequest;
|
||||
|
||||
class Server : public ChatLLM
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user