mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 07:26:39 +08:00
if role is tool then set to user
This commit is contained in:
@@ -36,10 +36,17 @@ class OpenAIMessageConverter(MessageConverter):
|
||||
converted_messages = []
|
||||
system_instruction = None
|
||||
|
||||
for msg in messages:
|
||||
for idx, msg in enumerate(messages):
|
||||
role = msg.get("role", "")
|
||||
if role not in SUPPORTED_ROLES:
|
||||
role = "model"
|
||||
if role == "tool":
|
||||
role = "user"
|
||||
else:
|
||||
# 如果是最后一条消息,则认为是用户消息
|
||||
if idx == len(messages) - 1:
|
||||
role = "user"
|
||||
else:
|
||||
role = "model"
|
||||
|
||||
parts = []
|
||||
if isinstance(msg["content"], str) and msg["content"]:
|
||||
|
||||
Reference in New Issue
Block a user