initial commit

This commit is contained in:
Sebastian Hugentobler 2025-07-01 08:55:08 +02:00
commit 0bd97d0ed3
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
25 changed files with 6581 additions and 0 deletions

62
src/cli.rs Normal file
View file

@ -0,0 +1,62 @@
//! Command-line interface definitions.
use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
/// Main CLI configuration.
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
pub struct Cli {
/// Where to read the database connection string from ('-' is stdin).
#[arg(short, long, default_value = "-")]
pub db_url: String,
/// Path to content tokenizer.
#[arg(short, long, default_value = "./tokenizer.json")]
pub tokenizer_path: PathBuf,
/// Path to ONNX model used for embeddings..
#[arg(short, long, default_value = "./model.onnx")]
pub model_path: PathBuf,
/// Maximum text chunk size when splitting up content. Documents are not updated if chunk size
/// changes.
#[arg(short, long, default_value = "500")]
pub chunk_size: usize,
#[command(subcommand)]
pub command: Commands,
}
/// Configuration for the ask command.
#[derive(Args, Clone)]
pub struct AskConfig {
/// Query to run.
#[arg(short, long)]
pub query: String,
/// Maximum number of results.
#[arg(short, long, default_value = "5")]
pub limit: usize,
/// Path to reranking model.
#[arg(short, long, default_value = "./reranking.onnx")]
pub reranking_path: PathBuf,
}
/// Configuration for the scan command.
#[derive(Args, Clone)]
pub struct ScanConfig {
/// Root directory of calibre library.
#[arg(short, long)]
pub library_path: PathBuf,
}
/// Available CLI commands.
#[derive(Subcommand)]
pub enum Commands {
Ask(AskConfig),
Scan(ScanConfig),
}