瀏覽代碼

update gemini model

master
6vision 5 月之前
父節點
當前提交
bb2880191a
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. +2
    -2
      bot/gemini/google_gemini_bot.py
  2. +1
    -1
      bridge/bridge.py

+ 2
- 2
bot/gemini/google_gemini_bot.py 查看文件

@@ -24,7 +24,7 @@ class GoogleGeminiBot(Bot):
self.api_key = conf().get("gemini_api_key")
# 复用文心的token计算方式
self.sessions = SessionManager(BaiduWenxinSession, model=conf().get("model") or "gpt-3.5-turbo")
self.model = conf().get("model") or "gemini-pro"
def reply(self, query, context: Context = None) -> Reply:
try:
if context.type != ContextType.TEXT:
@@ -35,7 +35,7 @@ class GoogleGeminiBot(Bot):
session = self.sessions.session_query(query, session_id)
gemini_messages = self._convert_to_gemini_messages(self.filter_messages(session.messages))
genai.configure(api_key=self.api_key)
model = genai.GenerativeModel('gemini-pro')
model = genai.GenerativeModel(self.model)
response = model.generate_content(gemini_messages)
reply_text = response.text
self.sessions.session_reply(reply_text, session_id)


+ 1
- 1
bridge/bridge.py 查看文件

@@ -36,7 +36,7 @@ class Bridge(object):
self.btype["chat"] = const.QWEN
if model_type in [const.QWEN_TURBO, const.QWEN_PLUS, const.QWEN_MAX]:
self.btype["chat"] = const.QWEN_DASHSCOPE
if model_type in [const.GEMINI]:
if model_type and model_type.startswith("gemini"):
self.btype["chat"] = const.GEMINI
if model_type in [const.ZHIPU_AI]:
self.btype["chat"] = const.ZHIPU_AI


Loading…
取消
儲存