mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 19:02:16 +00:00
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
"""Rich-formatted error hints for common CLI failure modes."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
|
|
def hint_no_config() -> str:
|
|
"""Return a suggestion when no config file is found."""
|
|
return (
|
|
"[yellow]Hint:[/yellow] No config file found.\n"
|
|
" Run [bold]jarvis init[/bold] to detect hardware and generate "
|
|
"[cyan]~/.openjarvis/config.toml[/cyan].\n"
|
|
" Or run [bold]jarvis quickstart[/bold] for a guided setup."
|
|
)
|
|
|
|
|
|
def hint_no_engine(engine_name: Optional[str] = None) -> str:
|
|
"""Return a suggestion when the inference engine is unreachable."""
|
|
name = engine_name or "ollama"
|
|
return (
|
|
f"[yellow]Hint:[/yellow] Engine '{name}' is not reachable.\n"
|
|
f" Make sure the {name} server is running.\n"
|
|
" Run [bold]jarvis doctor[/bold] to check all engines.\n"
|
|
" Run [bold]jarvis quickstart[/bold] for guided setup."
|
|
)
|
|
|
|
|
|
def hint_no_model(model_name: Optional[str] = None) -> str:
|
|
"""Return a suggestion when no model is available."""
|
|
if model_name:
|
|
return (
|
|
f"[yellow]Hint:[/yellow] Model '{model_name}' not found.\n"
|
|
f" Try: [bold]ollama pull {model_name}[/bold]\n"
|
|
" Run [bold]jarvis model list[/bold] to see available models."
|
|
)
|
|
return (
|
|
"[yellow]Hint:[/yellow] No models available.\n"
|
|
" Pull a model first: [bold]ollama pull qwen3.5:3b[/bold]\n"
|
|
" Run [bold]jarvis model list[/bold] to see available models."
|
|
)
|