Merge pull request #20 from ggozad/fix/honour-default_data_dir
Honour DEFAULT_DATA_DIR env variable in CLI
This commit is contained in:
commit
6a7d2ff319
1 changed files with 11 additions and 10 deletions
|
|
@ -5,7 +5,8 @@ import typer
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
|
|
||||||
from haiku.rag.app import HaikuRAGApp
|
from haiku.rag.app import HaikuRAGApp
|
||||||
from haiku.rag.utils import get_default_data_dir, is_up_to_date
|
from haiku.rag.config import Config
|
||||||
|
from haiku.rag.utils import is_up_to_date
|
||||||
|
|
||||||
cli = typer.Typer(
|
cli = typer.Typer(
|
||||||
context_settings={"help_option_names": ["-h", "--help"]}, no_args_is_help=True
|
context_settings={"help_option_names": ["-h", "--help"]}, no_args_is_help=True
|
||||||
|
|
@ -35,7 +36,7 @@ def main():
|
||||||
@cli.command("list", help="List all stored documents")
|
@cli.command("list", help="List all stored documents")
|
||||||
def list_documents(
|
def list_documents(
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -50,7 +51,7 @@ def add_document_text(
|
||||||
help="The text content of the document to add",
|
help="The text content of the document to add",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -65,7 +66,7 @@ def add_document_src(
|
||||||
help="The file path or URL of the document to add",
|
help="The file path or URL of the document to add",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -80,7 +81,7 @@ def get_document(
|
||||||
help="The ID of the document to get",
|
help="The ID of the document to get",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -95,7 +96,7 @@ def delete_document(
|
||||||
help="The ID of the document to delete",
|
help="The ID of the document to delete",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -121,7 +122,7 @@ def search(
|
||||||
help="Reciprocal Rank Fusion k parameter",
|
help="Reciprocal Rank Fusion k parameter",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -136,7 +137,7 @@ def ask(
|
||||||
help="The question to ask",
|
help="The question to ask",
|
||||||
),
|
),
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -157,7 +158,7 @@ def settings():
|
||||||
)
|
)
|
||||||
def rebuild(
|
def rebuild(
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
@ -171,7 +172,7 @@ def rebuild(
|
||||||
)
|
)
|
||||||
def serve(
|
def serve(
|
||||||
db: Path = typer.Option(
|
db: Path = typer.Option(
|
||||||
get_default_data_dir() / "haiku.rag.sqlite",
|
Config.DEFAULT_DATA_DIR / "haiku.rag.sqlite",
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the SQLite database file",
|
help="Path to the SQLite database file",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue