Spaces:
Running
Running
Upload 4 files
Browse files
app.py
CHANGED
@@ -375,7 +375,7 @@ def chat_completions():
|
|
375 |
"temperature": temperature,
|
376 |
"maxOutputTokens": max_tokens,
|
377 |
},
|
378 |
-
"safetySettings": safety_settings_g2 if
|
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(
|
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安全过滤器阻止")
|