From a118ee7aaa55ce687a5fe4ba9ea4501d1a7cd0e0 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 3 Apr 2026 19:54:35 +0300 Subject: [PATCH] Cleanup --- CHANGELOG.md | 2 +- haiku_rag_slim/haiku/rag/app.py | 11 ++++------- .../haiku/rag/inspector/widgets/info_modal.py | 8 +++----- haiku_rag_slim/haiku/rag/store/engine.py | 2 -- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44945886..21b38a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Added -- **S3/Object storage support**: Connect to LanceDB on S3, GCS, Azure Blob, or HDFS via `lancedb.uri` and `storage_options` config. Supports S3-compatible stores (MinIO, Tigris) with custom endpoints. +- **S3/Object storage support**: Connect to LanceDB on S3, GCS, Azure Blob, or HDFS via `lancedb.uri` and `storage_options` config. Supports S3-compatible stores with custom endpoints. - **Remote skill generation**: `create-skill` now supports remote databases — omit `--db` and provide `--config-file` to generate skills that connect to object storage at runtime instead of bundling the database. ## [0.38.0] - 2026-04-07 diff --git a/haiku_rag_slim/haiku/rag/app.py b/haiku_rag_slim/haiku/rag/app.py index 1b09d38a..b06eef1b 100644 --- a/haiku_rag_slim/haiku/rag/app.py +++ b/haiku_rag_slim/haiku/rag/app.py @@ -45,11 +45,10 @@ class HaikuRAGApp: # pragma: no cover self.before = before self.console = Console() - @property - def _is_local(self) -> bool: from haiku.rag.store.engine import ConnectionMode - return ConnectionMode.from_config(self.config) == ConnectionMode.LOCAL + self._is_local = ConnectionMode.from_config(self.config) == ConnectionMode.LOCAL + self._display_path = self.db_path if self._is_local else self.config.lancedb.uri async def init(self): """Initialize a new database.""" @@ -62,9 +61,8 @@ class HaikuRAGApp: # pragma: no cover # Create the database client = HaikuRAG(db_path=self.db_path, config=self.config, create=True) client.close() - display_path = self.config.lancedb.uri if not self._is_local else self.db_path self.console.print( - f"[bold green]Database initialized at {display_path}[/bold green]" + f"[bold green]Database initialized at {self._display_path}[/bold green]" ) async def info(self): @@ -74,9 +72,8 @@ class HaikuRAGApp: # pragma: no cover # Basic: show path/URI self.console.print("[bold]haiku.rag database info[/bold]") - display_path = self.config.lancedb.uri if not self._is_local else self.db_path self.console.print( - f" [repr.attrib_name]path[/repr.attrib_name]: {display_path}" + f" [repr.attrib_name]path[/repr.attrib_name]: {self._display_path}" ) if self._is_local and not self.db_path.exists(): diff --git a/haiku_rag_slim/haiku/rag/inspector/widgets/info_modal.py b/haiku_rag_slim/haiku/rag/inspector/widgets/info_modal.py index 23dc4f8f..38eb1d76 100644 --- a/haiku_rag_slim/haiku/rag/inspector/widgets/info_modal.py +++ b/haiku_rag_slim/haiku/rag/inspector/widgets/info_modal.py @@ -71,18 +71,16 @@ class InfoModal(ModalScreen): # Path lines.append(f"[bold $accent]path[/bold $accent]: {self.db_path}") - is_local = ( - ConnectionMode.from_config(self.client.store._config) - == ConnectionMode.LOCAL - ) + is_local = self.client.store._connection_mode == ConnectionMode.LOCAL if is_local and not self.db_path.exists(): lines.append("[red]Database path does not exist.[/red]") self._content_widget.update("\n".join(lines)) return # Connect to get table info + config = self.client.store._config try: - db = connect_lancedb(self.client.store._config, self.db_path) + db = connect_lancedb(config, self.db_path) table_names = set(db.list_tables().tables) except Exception as e: lines.append(f"[red]Failed to open database: {e}[/red]") diff --git a/haiku_rag_slim/haiku/rag/store/engine.py b/haiku_rag_slim/haiku/rag/store/engine.py index 3620b8ff..26cd4b71 100644 --- a/haiku_rag_slim/haiku/rag/store/engine.py +++ b/haiku_rag_slim/haiku/rag/store/engine.py @@ -19,8 +19,6 @@ from haiku.rag.store.exceptions import MigrationRequiredError, ReadOnlyError logger = logging.getLogger(__name__) -OBJECT_STORAGE_PREFIXES = ("s3://", "gs://", "az://", "hdfs://") - class ConnectionMode(Enum): LOCAL = "local"