From c26dbc5612b6e41839a2115d9fe0f87f64138656 Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Tue, 6 Aug 2024 00:47:28 +0200 Subject: [PATCH] =?UTF-8?q?/api/endpoint=20retunerar=20lista=20=C3=B6ver?= =?UTF-8?q?=20endpoints=20och=20deras=20respektive=20llm:er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smartassist/src/backend.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/smartassist/src/backend.py b/smartassist/src/backend.py index 9a217f8..8ab7b6b 100644 --- a/smartassist/src/backend.py +++ b/smartassist/src/backend.py @@ -181,13 +181,20 @@ def chat(): @app.route('/api/endpoints', methods=['GET']) def get_endpoints(): # Replace this with your actual logic to fetch endpoint data - endpoints = [ - {'endpoint': 'endpoint1', 'llm': 'llm1'}, - {'endpoint': 'endpoint2', 'llm': 'llm2'}, - {'endpoint': 'endpoint3', 'llm': 'llm3'}, - {'endpoint': 'endpoint4', 'llm': 'llm4'}, - ] - + # endpoints = [ + # {'endpoint': 'endpoint1', 'llm': 'llm1'}, + # {'endpoint': 'endpoint1', 'llm': 'llm2'}, + # {'endpoint': 'endpoint2', 'llm': 'llm1'}, + # {'endpoint': 'endpoint2', 'llm': 'llm3'}, + # {'endpoint': 'endpoint2', 'llm': 'llm4'}, + # {'endpoint': 'endpoint3', 'llm': 'llm4'}, + # ] + endpoints = [] # List of dictionaries, each of which contains {'endpoint': 'endpoint1', 'llm': 'llm1'} + eps = global_state.get_endpoints() + for ep in eps: + llms = global_state.get_list_of_available_llms(ep) + for llm in llms: + endpoints.append({'endpoint': ep.get('title'), 'llm': llm}) return jsonify(endpoints)