Skip to content

Commit

Permalink
fix: fix bug introduced in v0.16.0: update build script and store SQL…
Browse files Browse the repository at this point in the history
…ite files in `knowledge` folder and not `Docker` volume
  • Loading branch information
charnould committed Dec 3, 2024
1 parent 091a2a0 commit bc7f2c9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions config/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Database.setCustomSQLite('/opt/homebrew/opt/sqlite/lib/libsqlite3.dylib')
// For vector databases, the `sqlite_vec` module is loaded to provide vector search.
export const db = (db_name: Db_Name): Database | (Database & sqlite_vec.Db) => {
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
}
Expand Down
8 changes: 5 additions & 3 deletions utils/knowledge/clean-outdated-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions utils/knowledge/create-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc7f2c9

Please sign in to comment.