Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

1.0 KB
Raw Blame
#[cfg(feature = "tauri")]
mod commands;
pub mod db;
mod error;
mod state;
mod utils;

pub use error::VectorDBError;
pub use state::VectorDBState;

#[cfg(feature = "tauri")]
pub fn init<R: tauri::Runtime>(base_dir: std::path::PathBuf) -> tauri::plugin::TauriPlugin<R> {
    use tauri::Manager;

    tauri::plugin::Builder::new("vector-db")
        .invoke_handler(tauri::generate_handler![
            commands::create_collection,
            commands::insert_chunks,
            commands::create_file,
            commands::search_collection,
            commands::delete_chunks,
            commands::delete_file,
            commands::delete_collection,
            commands::chunk_text,
            commands::get_status,
            commands::list_attachments,
            commands::get_chunks,
            commands::memory_index,
            commands::memory_search,
            commands::memory_clear,
        ])
        .setup(move |app, _api| {
            app.manage(state::VectorDBState::new(base_dir));
            Ok(())
        })
        .build()
}