Moonfanz commited on
Commit
9e8c82f
·
verified ·
1 Parent(s): c48b645

Upload 4 files

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -375,7 +375,7 @@ def chat_completions():
375
  "temperature": temperature,
376
  "maxOutputTokens": max_tokens,
377
  },
378
- "safetySettings": safety_settings_g2 if model == 'gemini-2.0-flash-exp' else safety_settings,
379
  }
380
  if system_instruction:
381
  data["system_instruction"] = system_instruction
@@ -485,7 +485,7 @@ def chat_completions():
485
  else:
486
  try:
487
  text_content = response.text
488
- logger.info(f"AI响应: {text_content}")
489
  except (AttributeError, IndexError, TypeError, ValueError) as e:
490
  if "response.candidates" in str(e) or "response.text" in str(e):
491
  logger.error(f"用户输入被AI安全过滤器阻止")
 
375
  "temperature": temperature,
376
  "maxOutputTokens": max_tokens,
377
  },
378
+ "safetySettings": safety_settings_g2 if 'gemini-2.0-flash-exp' in model else safety_settings,
379
  }
380
  if system_instruction:
381
  data["system_instruction"] = system_instruction
 
485
  else:
486
  try:
487
  text_content = response.text
488
+ logger.info(response.json())
489
  except (AttributeError, IndexError, TypeError, ValueError) as e:
490
  if "response.candidates" in str(e) or "response.text" in str(e):
491
  logger.error(f"用户输入被AI安全过滤器阻止")