Fetch available Docker Model Runner models.
()
| 698 | @blueprint.route("/models/docker", methods=["GET"], endpoint='models_docker') |
| 699 | @pga_login_required |
| 700 | def get_docker_models(): |
| 701 | """ |
| 702 | Fetch available Docker Model Runner models. |
| 703 | """ |
| 704 | from pgadmin.llm.utils import get_docker_api_url |
| 705 | |
| 706 | api_url = get_docker_api_url() |
| 707 | if not api_url: |
| 708 | return make_json_response( |
| 709 | data={'models': [], 'error': 'No API URL configured'}, |
| 710 | status=200 |
| 711 | ) |
| 712 | |
| 713 | try: |
| 714 | models = _fetch_docker_models(api_url) |
| 715 | return make_json_response(data={'models': models}, status=200) |
| 716 | except LLMApiError as e: |
| 717 | return make_json_response( |
| 718 | data={'models': [], 'error': str(e)}, |
| 719 | status=200 |
| 720 | ) |
| 721 | except Exception: |
| 722 | return make_json_response( |
| 723 | data={'models': [], |
| 724 | 'error': 'Failed to fetch Docker models. ' |
| 725 | 'Check the API URL configuration.'}, |
| 726 | status=200 |
| 727 | ) |
| 728 | |
| 729 | |
| 730 | @blueprint.route( |
nothing calls this directly
no test coverage detected