gpt4all/gpt4all-chat/localdocs.h

56 lines
1.7 KiB
C
Raw Permalink Normal View History

2023-05-18 18:59:10 -04:00
#ifndef LOCALDOCS_H
#define LOCALDOCS_H
#include "database.h"
#include "localdocsmodel.h" // IWYU pragma: keep
2023-05-18 18:59:10 -04:00
#include <QObject>
#include <QString>
#include <QStringList>
2023-05-18 18:59:10 -04:00
class LocalDocs : public QObject
{
Q_OBJECT
Q_PROPERTY(bool databaseValid READ databaseValid NOTIFY databaseValidChanged)
Q_PROPERTY(LocalDocsModel *localDocsModel READ localDocsModel NOTIFY localDocsModelChanged)
2023-05-18 18:59:10 -04:00
public:
static LocalDocs *globalInstance();
LocalDocsModel *localDocsModel() const { return m_localDocsModel; }
2023-05-21 15:13:28 -04:00
Q_INVOKABLE void addFolder(const QString &collection, const QString &path);
Q_INVOKABLE void removeFolder(const QString &collection, const QString &path);
Q_INVOKABLE void forceIndexing(const QString &collection);
2023-06-01 14:13:12 -04:00
Database *database() const { return m_database; }
2023-05-18 18:59:10 -04:00
bool databaseValid() const { return m_database->isValid(); }
public Q_SLOTS:
void handleChunkSizeChanged();
void handleFileExtensionsChanged();
void aboutToQuit();
2023-05-23 20:26:31 -04:00
2023-05-18 18:59:10 -04:00
Q_SIGNALS:
void requestStart();
void requestForceIndexing(const QString &collection, const QString &embedding_model);
void forceRebuildFolder(const QString &path);
void requestAddFolder(const QString &collection, const QString &path, const QString &embedding_model);
2023-05-18 18:59:10 -04:00
void requestRemoveFolder(const QString &collection, const QString &path);
2023-05-23 20:26:31 -04:00
void requestChunkSizeChange(int chunkSize);
void requestFileExtensionsChange(const QStringList &extensions);
void localDocsModelChanged();
void databaseValidChanged();
2023-05-18 18:59:10 -04:00
private:
LocalDocsModel *m_localDocsModel;
2023-05-18 18:59:10 -04:00
Database *m_database;
private:
explicit LocalDocs();
friend class MyLocalDocs;
};
#endif // LOCALDOCS_H