2023-05-18 22:59:10 +00:00
|
|
|
#ifndef LOCALDOCS_H
|
|
|
|
#define LOCALDOCS_H
|
|
|
|
|
2024-06-24 22:49:23 +00:00
|
|
|
#include "database.h"
|
2024-06-04 18:47:11 +00:00
|
|
|
#include "localdocsmodel.h" // IWYU pragma: keep
|
2023-05-18 22:59:10 +00:00
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
#include <QObject>
|
2024-06-04 18:47:11 +00:00
|
|
|
#include <QString>
|
2024-06-24 22:49:23 +00:00
|
|
|
#include <QStringList>
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
class LocalDocs : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2024-06-24 22:49:23 +00:00
|
|
|
Q_PROPERTY(bool databaseValid READ databaseValid NOTIFY databaseValidChanged)
|
2023-05-23 02:13:42 +00:00
|
|
|
Q_PROPERTY(LocalDocsModel *localDocsModel READ localDocsModel NOTIFY localDocsModelChanged)
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
static LocalDocs *globalInstance();
|
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
LocalDocsModel *localDocsModel() const { return m_localDocsModel; }
|
2023-05-21 19:13:28 +00:00
|
|
|
|
2023-05-23 02:13:42 +00:00
|
|
|
Q_INVOKABLE void addFolder(const QString &collection, const QString &path);
|
|
|
|
Q_INVOKABLE void removeFolder(const QString &collection, const QString &path);
|
2024-06-24 22:49:23 +00:00
|
|
|
Q_INVOKABLE void forceIndexing(const QString &collection);
|
2023-06-01 18:13:12 +00:00
|
|
|
|
|
|
|
Database *database() const { return m_database; }
|
2023-05-18 22:59:10 +00:00
|
|
|
|
2024-06-24 22:49:23 +00:00
|
|
|
bool databaseValid() const { return m_database->isValid(); }
|
|
|
|
|
2023-06-29 00:42:40 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void handleChunkSizeChanged();
|
2024-06-24 22:49:23 +00:00
|
|
|
void handleFileExtensionsChanged();
|
2023-10-24 16:13:32 +00:00
|
|
|
void aboutToQuit();
|
2023-05-24 00:26:31 +00:00
|
|
|
|
2023-05-18 22:59:10 +00:00
|
|
|
Q_SIGNALS:
|
2024-04-25 17:16:52 +00:00
|
|
|
void requestStart();
|
2024-06-24 22:49:23 +00:00
|
|
|
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 22:59:10 +00:00
|
|
|
void requestRemoveFolder(const QString &collection, const QString &path);
|
2023-05-24 00:26:31 +00:00
|
|
|
void requestChunkSizeChange(int chunkSize);
|
2024-06-24 22:49:23 +00:00
|
|
|
void requestFileExtensionsChange(const QStringList &extensions);
|
2023-05-23 02:13:42 +00:00
|
|
|
void localDocsModelChanged();
|
2024-06-24 22:49:23 +00:00
|
|
|
void databaseValidChanged();
|
2023-05-18 22:59:10 +00:00
|
|
|
|
|
|
|
private:
|
2023-05-23 02:13:42 +00:00
|
|
|
LocalDocsModel *m_localDocsModel;
|
2023-05-18 22:59:10 +00:00
|
|
|
Database *m_database;
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit LocalDocs();
|
|
|
|
friend class MyLocalDocs;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCALDOCS_H
|