mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-08 09:26:36 +08:00
refactor: 修改模型检查逻辑以提高代码可读性
This commit is contained in:
@@ -63,6 +63,7 @@ class OpenAIChatService:
|
||||
while retries < max_retries:
|
||||
try:
|
||||
async for line in self.api_client.stream_generate_content(payload, model, api_key):
|
||||
# print(line)
|
||||
if line.startswith("data:"):
|
||||
chunk = json.loads(line[6:])
|
||||
openai_chunk = self.response_handler.handle_response(
|
||||
@@ -127,7 +128,7 @@ class OpenAIChatService:
|
||||
|
||||
def _get_safety_settings(self, model: str) -> List[Dict[str, str]]:
|
||||
"""获取安全设置"""
|
||||
if "2.0" in model and model != "gemini-2.0-flash-thinking-exp":
|
||||
if "2.0" in model and "gemini-2.0-flash-thinking-exp" not in model:
|
||||
return [
|
||||
{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "OFF"},
|
||||
{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "OFF"},
|
||||
|
||||
Reference in New Issue
Block a user