model info timeout and additional info

This commit is contained in:
Cyberes 2023-08-23 16:07:43 -06:00
parent 1f5e2da637
commit 508089ce11
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ from llm_server import opts
def get_running_model(): def get_running_model():
if opts.mode == 'oobabooga': if opts.mode == 'oobabooga':
try: try:
backend_response = requests.get(f'{opts.backend_url}/api/v1/model') backend_response = requests.get(f'{opts.backend_url}/api/v1/model', timeout=3)
except Exception as e: except Exception as e:
return False, e return False, e
try: try:

View File

@ -25,10 +25,10 @@ def get_model():
model, error = get_running_model() model, error = get_running_model()
if not model: if not model:
return jsonify({ return jsonify({
'code': 500, 'code': 502,
'error': 'failed to reach backend', 'error': 'failed to reach backend',
'msg': error 'type': error.__class__.__name__
}), 500 }), 502
else: else:
return jsonify({ return jsonify({
'result': model, 'result': model,