Refactor CLI and LLM runtime handling for improved user experience
- Removed deprecated console usage in favor of structured logging functions for error handling and user prompts. - Enhanced CLI prompts for LLM runtime and preset selection, utilizing menu helpers for better user interaction. - Updated GPU pool scanning output with improved formatting and error indication for clarity. - Refactored setup wizard to streamline LLM runtime and preset configuration, ensuring a more intuitive setup process. - Improved documentation and user feedback in CLI outputs to enhance overall usability.
This commit is contained in:
+12
-8
@@ -186,31 +186,35 @@ def scan_pools(cfg: Config, pools: tuple[str, ...] | None = None) -> list[PoolGp
|
||||
|
||||
def format_pool_scan(offers: list[PoolGpuOffer], preference: tuple[str, ...]) -> list[str]:
|
||||
lines = [
|
||||
"скан пулов (мультизональные + кандидаты) × характеристики GPU:",
|
||||
" (серые кнопки панели ≠ Nova; available_count бывает только у части flavors)",
|
||||
"[bold cyan]скан пулов[/bold cyan] (мультизональные + кандидаты) × характеристики GPU:",
|
||||
" [dim](серые кнопки панели ≠ Nova; available_count бывает только у части flavors)[/dim]",
|
||||
]
|
||||
for offer in offers:
|
||||
tag = "multizone" if offer.multizone else "pool"
|
||||
prefix = f" {offer.region} ({tag}):"
|
||||
prefix = f" [bold]{offer.region}[/bold] ({tag}):"
|
||||
if offer.error:
|
||||
lines.append(f"{prefix} ОШИБКА — {offer.error}")
|
||||
lines.append(f"{prefix} [red]ОШИБКА[/red] — {offer.error}")
|
||||
continue
|
||||
types_s = ", ".join(offer.gpu_types) if offer.gpu_types else "—"
|
||||
lines.append(f"{prefix} типы: {types_s}")
|
||||
if offer.gpu_labels_found:
|
||||
best = offer.matched[0] if offer.matched else None
|
||||
best_s = f" → лучший {best.name} ({best.label})" if best else ""
|
||||
best_s = (
|
||||
f" → [green]лучший {best.name} ({best.label})[/green]" if best else ""
|
||||
)
|
||||
lines.append(
|
||||
f" preference: {', '.join(offer.gpu_labels_found)}{best_s}"
|
||||
)
|
||||
else:
|
||||
lines.append(f" preference: нет совпадений с {','.join(preference)}")
|
||||
lines.append(
|
||||
f" [yellow]preference: нет совпадений с {','.join(preference)}[/yellow]"
|
||||
)
|
||||
for offer in offers:
|
||||
if offer.matched and not offer.error:
|
||||
lines.append(
|
||||
f"рекомендация: OS_REGION_NAME={offer.region} "
|
||||
f"[green]рекомендация:[/green] OS_REGION_NAME={offer.region} "
|
||||
f"GPU_RENT_AZ={offer.region}a "
|
||||
f"(сегмент a/b/c — в панели; диски и VM в одном AZ)"
|
||||
f"[dim](сегмент a/b/c — в панели; диски и VM в одном AZ)[/dim]"
|
||||
)
|
||||
break
|
||||
return lines
|
||||
|
||||
Reference in New Issue
Block a user