()
| 876 | |
| 877 | // SQLITE DB |
| 878 | private async getOrCreateSqliteDb() { |
| 879 | if (!this.sqliteDb) { |
| 880 | const db = await open({ |
| 881 | filename: getDocsSqlitePath(), |
| 882 | driver: sqlite3.Database, |
| 883 | }); |
| 884 | |
| 885 | await db.exec("PRAGMA busy_timeout = 3000;"); |
| 886 | |
| 887 | // First create the table if it doesn't exist |
| 888 | await db.exec(`CREATE TABLE IF NOT EXISTS ${DocsService.sqlitebTableName} ( |
| 889 | id INTEGER PRIMARY KEY AUTOINCREMENT, |
| 890 | title STRING NOT NULL, |
| 891 | startUrl STRING NOT NULL, |
| 892 | favicon STRING, |
| 893 | embeddingsProviderId STRING |
| 894 | )`); |
| 895 | |
| 896 | await runSqliteMigrations(db); |
| 897 | |
| 898 | this.sqliteDb = db; |
| 899 | } |
| 900 | |
| 901 | return this.sqliteDb; |
| 902 | } |
| 903 | |
| 904 | async getFavicon(startUrl: string) { |
| 905 | if (!this.config.selectedModelByRole.embed) { |
no test coverage detected