yangtb24 commited on
Commit
f69e815
·
verified ·
1 Parent(s): 11af0e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -787,7 +787,7 @@ def handsome_chat_completions():
787
  data = request.get_json()
788
  if not data or 'model' not in data:
789
  return jsonify({"error": "Invalid request data"}), 400
790
-
791
  model_name = data['model']
792
 
793
  if model_name not in models["text"] and model_name not in models["image"]:
@@ -1040,15 +1040,8 @@ def handsome_chat_completions():
1040
  "usage"
1041
  ]["prompt_tokens"]
1042
 
1043
- except (
1044
- KeyError,
1045
- ValueError,
1046
- IndexError
1047
- ) as e:
1048
- logging.error(
1049
- f"解析流式响应单行 JSON 失败: {e}, "
1050
- f"行内容: {line}"
1051
- )
1052
 
1053
  user_content = ""
1054
  messages = data.get("messages", [])
 
787
  data = request.get_json()
788
  if not data or 'model' not in data:
789
  return jsonify({"error": "Invalid request data"}), 400
790
+
791
  model_name = data['model']
792
 
793
  if model_name not in models["text"] and model_name not in models["image"]:
 
1040
  "usage"
1041
  ]["prompt_tokens"]
1042
 
1043
+ except (KeyError,ValueError,IndexError) as e:
1044
+ pass
 
 
 
 
 
 
 
1045
 
1046
  user_content = ""
1047
  messages = data.get("messages", [])