/api/endpoint retunerar lista över endpoints och deras respektive llm:er
This commit is contained in:
@@ -181,13 +181,20 @@ def chat():
|
|||||||
@app.route('/api/endpoints', methods=['GET'])
|
@app.route('/api/endpoints', methods=['GET'])
|
||||||
def get_endpoints():
|
def get_endpoints():
|
||||||
# Replace this with your actual logic to fetch endpoint data
|
# Replace this with your actual logic to fetch endpoint data
|
||||||
endpoints = [
|
# endpoints = [
|
||||||
{'endpoint': 'endpoint1', 'llm': 'llm1'},
|
# {'endpoint': 'endpoint1', 'llm': 'llm1'},
|
||||||
{'endpoint': 'endpoint2', 'llm': 'llm2'},
|
# {'endpoint': 'endpoint1', 'llm': 'llm2'},
|
||||||
{'endpoint': 'endpoint3', 'llm': 'llm3'},
|
# {'endpoint': 'endpoint2', 'llm': 'llm1'},
|
||||||
{'endpoint': 'endpoint4', 'llm': 'llm4'},
|
# {'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)
|
return jsonify(endpoints)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user