urface document_meta in info, history, and the inspector
This commit is contained in:
parent
2b8b9477b7
commit
bfc51b8b28
4 changed files with 27 additions and 5 deletions
|
|
@ -107,7 +107,7 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
|
|
||||||
# Per-table row counts and sizes. Missing required tables are
|
# Per-table row counts and sizes. Missing required tables are
|
||||||
# reported as "absent" rather than raising.
|
# 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]
|
entry = tables[name]
|
||||||
if entry.exists:
|
if entry.exists:
|
||||||
self.console.print(
|
self.console.print(
|
||||||
|
|
@ -155,6 +155,11 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
f" [repr.attrib_name]versions (documents)[/repr.attrib_name]: "
|
f" [repr.attrib_name]versions (documents)[/repr.attrib_name]: "
|
||||||
f"{tables['documents'].num_versions}"
|
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:
|
if tables["chunks"].exists:
|
||||||
self.console.print(
|
self.console.print(
|
||||||
f" [repr.attrib_name]versions (chunks)[/repr.attrib_name]: "
|
f" [repr.attrib_name]versions (chunks)[/repr.attrib_name]: "
|
||||||
|
|
@ -215,7 +220,13 @@ class HaikuRAGApp: # pragma: no cover
|
||||||
skip_migration_check=True,
|
skip_migration_check=True,
|
||||||
before=self.before,
|
before=self.before,
|
||||||
) as store:
|
) as store:
|
||||||
tables = ["documents", "chunks", "settings"]
|
tables = [
|
||||||
|
"documents",
|
||||||
|
"document_meta",
|
||||||
|
"chunks",
|
||||||
|
"document_items",
|
||||||
|
"settings",
|
||||||
|
]
|
||||||
if table:
|
if table:
|
||||||
if table not in tables:
|
if table not in tables:
|
||||||
self.console.print(
|
self.console.print(
|
||||||
|
|
|
||||||
|
|
@ -597,7 +597,7 @@ def history( # pragma: no cover
|
||||||
None,
|
None,
|
||||||
"--table",
|
"--table",
|
||||||
"-t",
|
"-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(
|
limit: int | None = typer.Option(
|
||||||
None,
|
None,
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,10 @@ class InfoModal(ModalScreen):
|
||||||
num_docs = stats["documents"].get("num_rows", 0)
|
num_docs = stats["documents"].get("num_rows", 0)
|
||||||
doc_bytes = stats["documents"].get("total_bytes", 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)
|
num_chunks = stats["chunks"].get("num_rows", 0)
|
||||||
chunk_bytes = stats["chunks"].get("total_bytes", 0)
|
chunk_bytes = stats["chunks"].get("total_bytes", 0)
|
||||||
|
|
||||||
|
|
@ -148,6 +152,9 @@ class InfoModal(ModalScreen):
|
||||||
lines.append(
|
lines.append(
|
||||||
f"[bold $accent]documents[/bold $accent]: {num_docs} ({format_bytes(doc_bytes)})"
|
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(
|
lines.append(
|
||||||
f"[bold $accent]chunks[/bold $accent]: {num_chunks} ({format_bytes(chunk_bytes)})"
|
f"[bold $accent]chunks[/bold $accent]: {num_chunks} ({format_bytes(chunk_bytes)})"
|
||||||
)
|
)
|
||||||
|
|
@ -180,6 +187,9 @@ class InfoModal(ModalScreen):
|
||||||
lines.append(
|
lines.append(
|
||||||
f"[bold $accent]versions (documents)[/bold $accent]: {doc_versions}"
|
f"[bold $accent]versions (documents)[/bold $accent]: {doc_versions}"
|
||||||
)
|
)
|
||||||
|
lines.append(
|
||||||
|
f"[bold $accent]versions (document_meta)[/bold $accent]: {meta_versions}"
|
||||||
|
)
|
||||||
lines.append(
|
lines.append(
|
||||||
f"[bold $accent]versions (chunks)[/bold $accent]: {chunk_versions}"
|
f"[bold $accent]versions (chunks)[/bold $accent]: {chunk_versions}"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,7 @@ async def gather_database_info(config: AppConfig, db_path: Path) -> DatabaseInfo
|
||||||
total_bytes=stats[name].get("total_bytes", 0),
|
total_bytes=stats[name].get("total_bytes", 0),
|
||||||
num_versions=stats[name].get("num_versions", 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()
|
vector_index = VectorIndexInfo()
|
||||||
|
|
@ -878,7 +878,8 @@ class Store:
|
||||||
"""List version history for a table.
|
"""List version history for a table.
|
||||||
|
|
||||||
Args:
|
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:
|
Returns:
|
||||||
List of version info dicts with "version" and "timestamp" keys
|
List of version info dicts with "version" and "timestamp" keys
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue