fix openai models response

This commit is contained in:
Cyberes 2023-10-01 23:07:49 -06:00
parent 21da2f6373
commit d1c4e68f8b
1 changed files with 26 additions and 27 deletions

View File

@ -25,38 +25,37 @@ def openai_list_models():
else:
running_model = redis.get('running_model', 'ERROR', dtype=str)
oai = fetch_openai_models()
r = []
r = {
"object": "list",
"data": oai
}
# TODO: verify this works
if opts.openai_expose_our_model:
r = [{
"object": "list",
"data": [
r["data"].insert(0, {
"id": running_model,
"object": "model",
"created": int(server_start_time.timestamp()),
"owned_by": opts.llm_middleware_name,
"permission": [
{
"id": running_model,
"object": "model",
"object": "model_permission",
"created": int(server_start_time.timestamp()),
"owned_by": opts.llm_middleware_name,
"permission": [
{
"id": running_model,
"object": "model_permission",
"created": int(server_start_time.timestamp()),
"allow_create_engine": False,
"allow_sampling": False,
"allow_logprobs": False,
"allow_search_indices": False,
"allow_view": True,
"allow_fine_tuning": False,
"organization": "*",
"group": None,
"is_blocking": False
}
],
"root": None,
"parent": None
"allow_create_engine": False,
"allow_sampling": False,
"allow_logprobs": False,
"allow_search_indices": False,
"allow_view": True,
"allow_fine_tuning": False,
"organization": "*",
"group": None,
"is_blocking": False
}
]
}]
response = jsonify_pretty(r + oai), 200
],
"root": None,
"parent": None
})
response = jsonify_pretty(r), 200
return response