Ask the daemon to test the embedding model; print results. Return True if all pass. Drives the check via `DoctorRequest(project_root=None)`. The daemon loads the model once and stays running, so the user's next `ccc index` starts warm. Both DaemonStartError and generic exceptions are re
()
| 425 | |
| 426 | |
| 427 | def _run_init_model_check() -> bool: |
| 428 | """Ask the daemon to test the embedding model; print results. Return True if all pass. |
| 429 | |
| 430 | Drives the check via `DoctorRequest(project_root=None)`. The daemon loads |
| 431 | the model once and stays running, so the user's next `ccc index` starts |
| 432 | warm. Both DaemonStartError and generic exceptions are rendered as a |
| 433 | synthetic failed DoctorCheckResult — uniform failure-output shape. The |
| 434 | caller decides what to show on failure (retry prompt / next-steps block). |
| 435 | """ |
| 436 | from rich.console import Console as _Console |
| 437 | from rich.live import Live as _Live |
| 438 | from rich.spinner import Spinner as _Spinner |
| 439 | |
| 440 | from . import client as _client |
| 441 | from .protocol import DoctorCheckResult |
| 442 | |
| 443 | err_console = _Console(stderr=True) |
| 444 | results: list[DoctorCheckResult] = [] |
| 445 | try: |
| 446 | with _Live( |
| 447 | _Spinner("dots", "Testing embedding model..."), |
| 448 | console=err_console, |
| 449 | transient=True, |
| 450 | ): |
| 451 | results = _client.doctor(project_root=None) |
| 452 | except Exception as e: |
| 453 | results = [ |
| 454 | DoctorCheckResult( |
| 455 | name="Model Check", |
| 456 | ok=False, |
| 457 | details=[], |
| 458 | errors=[f"{type(e).__name__}: {e}"], |
| 459 | ) |
| 460 | ] |
| 461 | |
| 462 | ok = True |
| 463 | for r in results: |
| 464 | if r.name == "done": |
| 465 | continue |
| 466 | _print_doctor_result(r, verbose=False) |
| 467 | if not r.ok: |
| 468 | ok = False |
| 469 | return ok |
| 470 | |
| 471 | |
| 472 | def _print_init_next_steps(settings_path: Path) -> None: |
no test coverage detected