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