Commit b90a3485 authored by MD. SHAHIDUL ISLAM's avatar MD. SHAHIDUL ISLAM

feat: implement standardized CLI theming and unify prompt interactions via new theme configuration

parent 5ed46a51
...@@ -9,6 +9,7 @@ import typer ...@@ -9,6 +9,7 @@ import typer
from rich.console import Console from rich.console import Console
from rich.panel import Panel from rich.panel import Panel
from dohasecuritiesstockai.api.repository import AnalysisRepository
from dohasecuritiesstockai.dashboard import ( from dohasecuritiesstockai.dashboard import (
dashboard_url, dashboard_url,
launch_dashboard, launch_dashboard,
...@@ -28,6 +29,14 @@ def show_dashboard( ...@@ -28,6 +29,14 @@ def show_dashboard(
str | None, str | None,
typer.Option("--date", "-d", help="Dashboard data date (YYYY-MM-DD)."), typer.Option("--date", "-d", help="Dashboard data date (YYYY-MM-DD)."),
] = None, ] = None,
saved_run: Annotated[
bool,
typer.Option(
"--saved-run/--fresh",
help="Load the completed multi-agent state for this symbol/date instead of "
"opening a data-only dashboard.",
),
] = False,
use_ai: Annotated[ use_ai: Annotated[
bool, bool,
typer.Option( typer.Option(
...@@ -65,11 +74,32 @@ def show_dashboard( ...@@ -65,11 +74,32 @@ def show_dashboard(
Panel.fit( Panel.fit(
f"[bold]DSE score dashboard[/bold]\n" f"[bold]DSE score dashboard[/bold]\n"
f"{symbol.strip().upper()} · {requested_date.isoformat()} · " f"{symbol.strip().upper()} · {requested_date.isoformat()} · "
f"{'grounded AI research' if use_ai else 'calculated data only'}", f"{'saved multi-agent run' if saved_run else 'fresh DSE evidence'} · "
f"{'AI synthesis' if use_ai else 'no additional AI call'}",
border_style="cyan", border_style="cyan",
) )
) )
agent_state = None
state_path = None
if saved_run:
repository = AnalysisRepository(DEFAULT_CONFIG["results_dir"])
state_path = repository.find_state_log(symbol, requested_date)
if state_path is None:
console.print(
"[bold red]Saved run not found:[/bold red] "
f"{symbol.strip().upper()} on {requested_date.isoformat()}"
)
raise typer.Exit(code=1)
try:
agent_state = repository.load_state(state_path)
except (OSError, ValueError) as exc:
console.print(f"[bold red]Saved run could not be read:[/bold red] {exc}")
raise typer.Exit(code=1) from None
try: try:
if saved_run:
status = "Loading the saved reports and current dashboard metrics…"
else:
status = ( status = (
"Collecting yearly DSE evidence and running the configured AI analyst…" "Collecting yearly DSE evidence and running the configured AI analyst…"
if use_ai if use_ai
...@@ -79,7 +109,7 @@ def show_dashboard( ...@@ -79,7 +109,7 @@ def show_dashboard(
analysis, saved_path = prepare_dashboard_analysis( analysis, saved_path = prepare_dashboard_analysis(
symbol, symbol,
requested_date, requested_date,
agent_state=None, agent_state=agent_state,
results_dir=DEFAULT_CONFIG["results_dir"], results_dir=DEFAULT_CONFIG["results_dir"],
use_ai=use_ai, use_ai=use_ai,
config=DEFAULT_CONFIG, config=DEFAULT_CONFIG,
...@@ -93,6 +123,8 @@ def show_dashboard( ...@@ -93,6 +123,8 @@ def show_dashboard(
f"[green]✓ Fundamental score:[/green] " f"[green]✓ Fundamental score:[/green] "
f"{analysis.fundamental_score}/100 ({analysis.score_label.en})" f"{analysis.fundamental_score}/100 ({analysis.score_label.en})"
) )
if state_path is not None:
console.print(f"[green]✓ Saved reports loaded:[/green] {state_path}")
if analysis.ai_research is not None: if analysis.ai_research is not None:
console.print( console.print(
f"[green]✓ AI analyst:[/green] {analysis.ai_research.provider} / " f"[green]✓ AI analyst:[/green] {analysis.ai_research.provider} / "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment