fix missing empty strings logged when errors

This commit is contained in:
Cyberes 2023-08-25 13:44:41 -06:00
parent 2543db87e8
commit 0e6aadf5e1
1 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ def generate():
else: else:
raise Exception raise Exception
log_prompt(client_ip, token, request_json_body['prompt'], backend_response, None, parameters, dict(request.headers), response if response else 0) log_prompt(client_ip, token, request_json_body['prompt'], '', None, parameters, dict(request.headers), response if response else 0)
return jsonify({ return jsonify({
'code': 500, 'code': 500,
'error': 'failed to reach backend', 'error': 'failed to reach backend',
@ -112,7 +112,7 @@ def generate():
} }
else: else:
raise Exception raise Exception
log_prompt(client_ip, token, request_json_body['prompt'], backend_response, elapsed_time, parameters, dict(request.headers), response.status_code) log_prompt(client_ip, token, request_json_body['prompt'], '', elapsed_time, parameters, dict(request.headers), response.status_code)
return jsonify({ return jsonify({
'code': 500, 'code': 500,
'error': 'the backend did not return valid JSON', 'error': 'the backend did not return valid JSON',