Show settings command

This commit is contained in:
Yiorgis Gozadinos 2025-07-02 13:18:29 +03:00
parent 7f862a057a
commit 27e1c9fd49
No known key found for this signature in database
3 changed files with 33 additions and 0 deletions

View file

@ -66,6 +66,13 @@ haiku-rag ask "Who is the author of haiku.rag?"
The QA agent will search your documents for relevant information and provide a comprehensive answer.
## Configuration
View current configuration settings:
```bash
haiku-rag settings
```
## Server
Start the MCP server:

View file

@ -97,6 +97,26 @@ class HaikuRAGApp:
except Exception as e:
self.console.print(f"[red]Error rebuilding database: {e}[/red]")
def show_settings(self):
"""Display current configuration settings."""
self.console.print("[bold]haiku.rag configuration[/bold]")
self.console.print()
# Get all config fields dynamically
for field_name, field_value in Config.model_dump().items():
# Format the display value
if isinstance(field_value, str) and (
"key" in field_name.lower()
or "password" in field_name.lower()
or "token" in field_name.lower()
):
# Hide sensitive values but show if they're set
display_value = "✓ Set" if field_value else "✗ Not set"
else:
display_value = field_value
self.console.print(f" [cyan]{field_name}[/cyan]: {display_value}")
def _rich_print_document(self, doc: Document, truncate: bool = False):
"""Format a document for display."""
if truncate:

View file

@ -128,6 +128,12 @@ def ask(
event_loop.run_until_complete(app.ask(question=question))
@cli.command("settings", help="Display current configuration settings")
def settings():
app = HaikuRAGApp(db_path=Path()) # Don't need actual DB for settings
app.show_settings()
@cli.command(
"rebuild",
help="Rebuild the database by deleting all chunks and re-indexing all documents",