mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 23:56:37 +08:00
Fix TTS payload - remove tools and safetySettings for TTS requests
This commit is contained in:
+2
-1
@@ -258,4 +258,5 @@ $RECYCLE.BIN/
|
|||||||
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
||||||
|
|
||||||
tests/
|
tests/
|
||||||
default_db
|
default_db
|
||||||
|
.augment-guidelines
|
||||||
@@ -66,20 +66,21 @@ class TTSGeminiChatService(GeminiChatService):
|
|||||||
status_code = None
|
status_code = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 构建TTS专用的payload
|
# 构建TTS专用的payload - 不包含tools和safetySettings
|
||||||
from app.service.chat.gemini_chat_service import _filter_empty_parts, _build_tools, _get_safety_settings
|
from app.service.chat.gemini_chat_service import _filter_empty_parts
|
||||||
|
|
||||||
request_dict = request.model_dump()
|
request_dict = request.model_dump()
|
||||||
|
|
||||||
# 构建基础payload
|
# 构建TTS专用的简化payload
|
||||||
payload = {
|
payload = {
|
||||||
"contents": _filter_empty_parts(request_dict.get("contents", [])),
|
"contents": _filter_empty_parts(request_dict.get("contents", [])),
|
||||||
"tools": _build_tools(model, request_dict),
|
|
||||||
"safetySettings": _get_safety_settings(model),
|
|
||||||
"generationConfig": request_dict.get("generationConfig", {}),
|
"generationConfig": request_dict.get("generationConfig", {}),
|
||||||
"systemInstruction": request_dict.get("systemInstruction"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 只在有systemInstruction时才添加
|
||||||
|
if request_dict.get("systemInstruction"):
|
||||||
|
payload["systemInstruction"] = request_dict.get("systemInstruction")
|
||||||
|
|
||||||
# 确保 generationConfig 不为 None
|
# 确保 generationConfig 不为 None
|
||||||
if payload["generationConfig"] is None:
|
if payload["generationConfig"] is None:
|
||||||
payload["generationConfig"] = {}
|
payload["generationConfig"] = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user