print fetch model error message
This commit is contained in:
parent
6589b8ac07
commit
1f5e2da637
|
@ -8,21 +8,21 @@ def get_running_model():
|
|||
try:
|
||||
backend_response = requests.get(f'{opts.backend_url}/api/v1/model')
|
||||
except Exception as e:
|
||||
return False
|
||||
return False, e
|
||||
try:
|
||||
r_json = backend_response.json()
|
||||
return r_json['result']
|
||||
except Exception as e:
|
||||
return False
|
||||
return False, e
|
||||
elif opts.mode == 'hf-textgen':
|
||||
try:
|
||||
backend_response = requests.get(f'{opts.backend_url}/info')
|
||||
except Exception as e:
|
||||
return False
|
||||
return False, e
|
||||
try:
|
||||
r_json = backend_response.json()
|
||||
return r_json['model_id'].replace('/', '_')
|
||||
except Exception as e:
|
||||
return False
|
||||
return False, e
|
||||
else:
|
||||
raise Exception
|
||||
|
|
|
@ -22,11 +22,12 @@ from ..cache import cache
|
|||
@bp.route('/model', methods=['GET'])
|
||||
@cache.cached(timeout=60, query_string=True)
|
||||
def get_model():
|
||||
model = get_running_model()
|
||||
model, error = get_running_model()
|
||||
if not model:
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'error': 'failed to reach backend'
|
||||
'error': 'failed to reach backend',
|
||||
'msg': error
|
||||
}), 500
|
||||
else:
|
||||
return jsonify({
|
||||
|
|
Reference in New Issue