diff --git a/config/telemetry.sh b/config/telemetry.sh index 8c71f85..54cd21f 100644 --- a/config/telemetry.sh +++ b/config/telemetry.sh @@ -2,9 +2,9 @@ init_db () { - # Ensure that `telemetry` folder exists. - # If `telemetry` directory already exists, it won’t raise any errors. - # mkdir -p telemetry + # Ensure that `datastores` folder exists. + # If `datastores` directory already exists, it won’t raise any errors. + mkdir -p datastores # Create `datastore.sqlite` if it does not exist. sqlite3 datastores/datastore.sqlite < { if (db_name === 'community') { - const db = new Database('./datastores/community.sqlite') + const db = new Database('./knowledge/.data/community.sqlite') sqlite_vec.load(db) return db } if (db_name === 'proprietary.private') { - const db = new Database('./datastores/proprietary.private.sqlite') + const db = new Database('./knowledge/.data/proprietary.private.sqlite') sqlite_vec.load(db) return db } if (db_name === 'proprietary.public') { - const db = new Database('./datastores/proprietary.public.sqlite') + const db = new Database('./knowledge/.data/proprietary.public.sqlite') sqlite_vec.load(db) return db } diff --git a/utils/knowledge/clean-outdated-data.ts b/utils/knowledge/clean-outdated-data.ts index 36c017f..5ddde0c 100644 --- a/utils/knowledge/clean-outdated-data.ts +++ b/utils/knowledge/clean-outdated-data.ts @@ -10,15 +10,17 @@ export const clean_outdated_data = async (args: Args) => { // Start spinner const spinner = ora('Ménage en cours').start() + await $`mkdir ./knowledge/.data/` + if (args['--community'] === true) { await $`rm -rf ./knowledge/wikipedia` - await $`rm -rf ./datastores/community.sqlite` + await $`rm -rf ./knowledge/.data/community.sqlite` } if (args['--proprietary'] === true) { await $`rm -rf ./datastores/__temp__` - await $`rm -rf ./datastores/proprietary.public.sqlite` - await $`rm -rf ./datastores/proprietary.private.sqlite` + await $`rm -rf ./knowledge/.data/proprietary.public.sqlite` + await $`rm -rf ./knowledge/.data/proprietary.private.sqlite` } // End spinner diff --git a/utils/knowledge/create-database.ts b/utils/knowledge/create-database.ts index 3de170e..d4d8512 100644 --- a/utils/knowledge/create-database.ts +++ b/utils/knowledge/create-database.ts @@ -23,14 +23,12 @@ export const create_database = async (args: Args) => { } if (args['--community'] === true) { - // Create `knowledge/.data/community.sqlite` - initialize_db('./datastores/community.sqlite') + initialize_db('./knowledge/.data/community.sqlite') } if (args['--proprietary'] === true) { - // Create `knowledge/.data/proprietary.*.sqlite` - initialize_db('./datastores/proprietary.private.sqlite') - initialize_db('./datastores/proprietary.public.sqlite') + initialize_db('./knowledge/.data/proprietary.private.sqlite') + initialize_db('./knowledge/.data/proprietary.public.sqlite') } // End spinner