refactor: remove AI slop - mock data, stubs, dead code

- auth.py: remove dead code after return in SSO section
- agent.py: replace mock list with real registry call
- dashboard.py: add [DEMO] indicator, improve comments
- batch_orchestrator.py: log warnings when no API client
- textual_repl.py: clarify context tracking comment
This commit is contained in:
2026-01-18 20:25:27 -08:00
parent 7f6ca12558
commit ffb281d9b8
6 changed files with 49 additions and 40 deletions
@@ -344,7 +344,7 @@ class HanzoTextualREPL(App):
messages.write("")
# Update context usage (mock)
# Update context usage indicator (estimated - real tracking pending)
self.context_usage = max(5, self.context_usage - 2)
context_indicator = self.query_one("#permissions", ContextIndicator)
context_indicator.context_percent = self.context_usage
+6 -3
View File
@@ -511,10 +511,12 @@ class BatchOrchestrator:
"success": True,
}
else:
logger.warning(f"No API client configured - returning empty response for {model}")
return {
"model": model,
"response": f"Mock response from {model}",
"success": True,
"response": "",
"success": False,
"error": "No API client configured (set HANZO_API_KEY or use MCP)",
}
except Exception as e:
return {"model": model, "error": str(e), "success": False}
@@ -603,7 +605,8 @@ Provide your critical analysis:"""
)
review = response.choices[0].message.content
else:
review = f"Mock critic review from {model}"
logger.warning(f"No API client configured for critic {model}")
review = f"[No API client configured for {model}]"
reviews.append(
{
+21 -9
View File
@@ -45,22 +45,34 @@ async def create(ctx, name: str, model: str, description: Optional[str], local:
@click.pass_context
def list(ctx):
"""List available agents."""
# TODO: Connect to agent registry
table = Table(title="Available Agents")
table.add_column("Name", style="cyan", no_wrap=True)
table.add_column("Model", style="green")
table.add_column("Status", style="yellow")
table.add_column("Description")
# Mock data for now
agents = [
("helper", "llama-3.2-3b", "active", "General purpose assistant"),
("coder", "codellama-7b", "idle", "Code generation specialist"),
("researcher", "llama-3.2-3b", "idle", "Research and analysis"),
]
# Try to get agents from registry
agents = []
try:
from hanzoai.agents import list_agents
agents = list_agents()
except ImportError:
console.print("[dim]Install hanzo-agents for full registry support[/dim]")
except Exception as e:
console.print(f"[dim]Could not connect to registry: {e}[/dim]")
for name, model, status, desc in agents:
table.add_row(name, model, status, desc)
if not agents:
console.print("[yellow]No agents registered. Create one with:[/yellow]")
console.print(" hanzo agent create --name myagent --model llama-3.2-3b")
return
for agent in agents:
table.add_row(
agent.get("name", "unknown"),
agent.get("model", "unknown"),
agent.get("status", "unknown"),
agent.get("description", ""),
)
console.print(table)
+10 -20
View File
@@ -97,17 +97,11 @@ def login(ctx, email: str, password: str, api_key: str, sso: bool):
from hanzoai.auth import HanzoAuth
hanzo_auth = HanzoAuth()
# SSO not implemented yet
console.print("[yellow]SSO authentication not yet implemented[/yellow]")
# SSO flow: initiate browser-based auth
# TODO: Implement when HanzoAuth.sso_login() is available
console.print("[yellow]SSO authentication not yet available[/yellow]")
console.print("[dim]Use API key authentication instead: hanzo auth login --api-key[/dim]")
return
auth = {
"email": result.get("email"),
"logged_in": True,
"last_login": datetime.now().isoformat(),
}
auth_mgr.save_auth(auth)
console.print(f"[green]✓[/green] Logged in as {result.get('email')}")
except ImportError:
console.print("[yellow]SSO requires hanzoai package[/yellow]")
console.print("Install with: pip install hanzoai")
@@ -126,11 +120,9 @@ def login(ctx, email: str, password: str, api_key: str, sso: bool):
from hanzoai.auth import HanzoAuth
hanzo_auth = HanzoAuth()
# Email auth not implemented yet
console.print(
"[yellow]Email authentication not yet implemented[/yellow]"
)
console.print("[dim]Saving credentials locally for development[/dim]")
# Email/password auth: falls back to local storage
# TODO: Implement when HanzoAuth.login() is available
console.print("[dim]Saving credentials locally (remote auth pending)[/dim]")
auth = {
"email": email,
@@ -167,12 +159,10 @@ def logout(ctx):
# Try using hanzoai if available
try:
from hanzoai.auth import HanzoAuth
hanzo_auth = HanzoAuth()
# Logout not implemented yet
pass
# TODO: Call hanzo_auth.logout() when available
HanzoAuth() # Validate import works
except ImportError:
pass # hanzoai not installed, just clear local auth
pass # hanzoai not installed, local-only auth
# Clear local auth
auth_mgr.save_auth({})
+11 -7
View File
@@ -19,11 +19,15 @@ def run_dashboard(refresh_rate: float = 1.0):
Layout(name="footer", size=3),
)
# Check if connected to real cluster
demo_mode = True # TODO: Check hanzo cluster status
header_text = Text()
header_text.append("Hanzo AI Dashboard", style="bold cyan")
if demo_mode:
header_text.append(" [DEMO]", style="bold yellow")
layout["header"].update(
Panel(
Text("Hanzo AI Dashboard", style="bold cyan", justify="center"),
border_style="cyan",
)
Panel(header_text, border_style="cyan" if not demo_mode else "yellow")
)
layout["body"].split_row(Layout(name="left"), Layout(name="right"))
@@ -38,7 +42,7 @@ def run_dashboard(refresh_rate: float = 1.0):
table.add_column("Key", style="cyan")
table.add_column("Value", style="white")
# Mock data - would be real in production
# Demo data (connect to cluster for live data)
table.add_row("Status", "[green]Running[/green]")
table.add_row("Nodes", "3")
table.add_row("Models", "llama-3.2-3b, gpt-4")
@@ -54,7 +58,7 @@ def run_dashboard(refresh_rate: float = 1.0):
table.add_column("Status", style="yellow")
table.add_column("Jobs", style="magenta")
# Mock data
# Demo data
table.add_row("a1b2", "researcher", "idle", "42")
table.add_row("c3d4", "coder", "busy", "17")
table.add_row("e5f6", "analyst", "idle", "23")
@@ -68,7 +72,7 @@ def run_dashboard(refresh_rate: float = 1.0):
table.add_column("Type", style="green")
table.add_column("Status", style="yellow")
# Mock data
# Demo data
table.add_row("j001", "chat", "complete")
table.add_row("j002", "analysis", "running")
table.add_row("j003", "search", "queued")