/api/endpoint retunerar lista över endpoints och deras respektive llm:er

This commit is contained in:
2024-08-06 00:47:28 +02:00
parent 7f557fadd6
commit c26dbc5612
+14 -7
View File
@@ -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)