mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-12 02:05:06 +08:00
@@ -44,6 +44,7 @@ class GoogleGeminiBot(Bot):
|
||||
except Exception as e:
|
||||
logger.error("[Gemini] fetch reply error, may contain unsafe content")
|
||||
logger.error(e)
|
||||
return Reply(ReplyType.ERROR, "invoke [Gemini] api failed!")
|
||||
|
||||
def _convert_to_gemini_messages(self, messages: list):
|
||||
res = []
|
||||
@@ -63,6 +64,8 @@ class GoogleGeminiBot(Bot):
|
||||
def _filter_messages(self, messages: list):
|
||||
res = []
|
||||
turn = "user"
|
||||
if not messages:
|
||||
return res
|
||||
for i in range(len(messages) - 1, -1, -1):
|
||||
message = messages[i]
|
||||
if message.get("role") != turn:
|
||||
|
||||
Reference in New Issue
Block a user