Show current configuration.
()
| 16 | def register(app: typer.Typer) -> None: |
| 17 | @app.command("show") |
| 18 | def config_show() -> None: |
| 19 | """Show current configuration.""" |
| 20 | import json |
| 21 | |
| 22 | from deeptutor.services.config import ( |
| 23 | load_config_with_main, |
| 24 | load_system_settings, |
| 25 | resolve_embedding_runtime_config, |
| 26 | resolve_llm_runtime_config, |
| 27 | resolve_search_runtime_config, |
| 28 | ) |
| 29 | |
| 30 | system_settings = load_system_settings() |
| 31 | llm_runtime = resolve_llm_runtime_config() |
| 32 | search_runtime = resolve_search_runtime_config() |
| 33 | llm_info = { |
| 34 | "binding_hint": llm_runtime.binding_hint, |
| 35 | "provider": llm_runtime.provider_name, |
| 36 | "provider_mode": llm_runtime.provider_mode, |
| 37 | "model": llm_runtime.model, |
| 38 | "base_url": llm_runtime.effective_url, |
| 39 | "api_version": llm_runtime.api_version, |
| 40 | "extra_headers": llm_runtime.extra_headers, |
| 41 | "api_key": "***" if llm_runtime.api_key else "(not set)", |
| 42 | } |
| 43 | try: |
| 44 | embedding_runtime = resolve_embedding_runtime_config() |
| 45 | embedding_info = { |
| 46 | "status": "configured", |
| 47 | "binding_hint": embedding_runtime.binding_hint, |
| 48 | "provider": embedding_runtime.provider_name, |
| 49 | "provider_mode": embedding_runtime.provider_mode, |
| 50 | "model": embedding_runtime.model, |
| 51 | "base_url": embedding_runtime.effective_url, |
| 52 | "api_version": embedding_runtime.api_version, |
| 53 | "extra_headers": embedding_runtime.extra_headers, |
| 54 | "api_key": "***" if embedding_runtime.api_key else "(not set)", |
| 55 | "dimension": embedding_runtime.dimension, |
| 56 | } |
| 57 | except ValueError as exc: |
| 58 | embedding_info = { |
| 59 | "status": "not_configured", |
| 60 | "message": str(exc), |
| 61 | } |
| 62 | |
| 63 | try: |
| 64 | main_cfg = load_config_with_main("main.yaml") |
| 65 | except Exception: |
| 66 | main_cfg = {} |
| 67 | |
| 68 | console.print_json( |
| 69 | json.dumps( |
| 70 | { |
| 71 | "ports": { |
| 72 | "backend": system_settings["backend_port"], |
| 73 | "frontend": system_settings["frontend_port"], |
| 74 | }, |
| 75 | "llm": llm_info, |
nothing calls this directly
no test coverage detected