urface document_meta in info, history, and the inspector

This commit is contained in:
Yiorgis Gozadinos 2026-06-11 12:27:44 +03:00
parent 2b8b9477b7
commit bfc51b8b28
No known key found for this signature in database
4 changed files with 27 additions and 5 deletions

View file

@ -107,7 +107,7 @@ class HaikuRAGApp: # pragma: no cover
# Per-table row counts and sizes. Missing required tables are
# reported as "absent" rather than raising.
for name in ("documents", "chunks", "document_items"):
for name in ("documents", "document_meta", "chunks", "document_items"):
entry = tables[name]
if entry.exists:
self.console.print(
@ -155,6 +155,11 @@ class HaikuRAGApp: # pragma: no cover
f" [repr.attrib_name]versions (documents)[/repr.attrib_name]: "
f"{tables['documents'].num_versions}"
)
if tables["document_meta"].exists:
self.console.print(
f" [repr.attrib_name]versions (document_meta)[/repr.attrib_name]: "
f"{tables['document_meta'].num_versions}"
)
if tables["chunks"].exists:
self.console.print(
f" [repr.attrib_name]versions (chunks)[/repr.attrib_name]: "
@ -215,7 +220,13 @@ class HaikuRAGApp: # pragma: no cover
skip_migration_check=True,
before=self.before,
) as store:
tables = ["documents", "chunks", "settings"]
tables = [
"documents",
"document_meta",
"chunks",
"document_items",
"settings",
]
if table:
if table not in tables:
self.console.print(

View file

@ -597,7 +597,7 @@ def history( # pragma: no cover
None,
"--table",
"-t",
help="Specific table to show history for (documents, chunks, settings)",
help="Specific table to show history for (documents, document_meta, chunks, document_items, settings)",
),
limit: int | None = typer.Option(
None,

View file

@ -119,6 +119,10 @@ class InfoModal(ModalScreen):
num_docs = stats["documents"].get("num_rows", 0)
doc_bytes = stats["documents"].get("total_bytes", 0)
num_meta = stats["document_meta"].get("num_rows", 0)
meta_bytes = stats["document_meta"].get("total_bytes", 0)
meta_versions = stats["document_meta"].get("num_versions", 0)
num_chunks = stats["chunks"].get("num_rows", 0)
chunk_bytes = stats["chunks"].get("total_bytes", 0)
@ -148,6 +152,9 @@ class InfoModal(ModalScreen):
lines.append(
f"[bold $accent]documents[/bold $accent]: {num_docs} ({format_bytes(doc_bytes)})"
)
lines.append(
f"[bold $accent]document_meta[/bold $accent]: {num_meta} ({format_bytes(meta_bytes)})"
)
lines.append(
f"[bold $accent]chunks[/bold $accent]: {num_chunks} ({format_bytes(chunk_bytes)})"
)
@ -180,6 +187,9 @@ class InfoModal(ModalScreen):
lines.append(
f"[bold $accent]versions (documents)[/bold $accent]: {doc_versions}"
)
lines.append(
f"[bold $accent]versions (document_meta)[/bold $accent]: {meta_versions}"
)
lines.append(
f"[bold $accent]versions (chunks)[/bold $accent]: {chunk_versions}"
)

View file

@ -309,7 +309,7 @@ async def gather_database_info(config: AppConfig, db_path: Path) -> DatabaseInfo
total_bytes=stats[name].get("total_bytes", 0),
num_versions=stats[name].get("num_versions", 0),
)
for name in ("documents", "chunks", "document_items")
for name in ("documents", "document_meta", "chunks", "document_items")
]
vector_index = VectorIndexInfo()
@ -878,7 +878,8 @@ class Store:
"""List version history for a table.
Args:
table_name: Name of the table ("documents", "chunks", or "settings")
table_name: Name of the table ("documents", "document_meta",
"chunks", "document_items", or "settings")
Returns:
List of version info dicts with "version" and "timestamp" keys