From b8ebefa42785dfb05690f7ad680894cecca2e434 Mon Sep 17 00:00:00 2001 From: XIao <46100050+Kilig947@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:06:07 +0800 Subject: [PATCH] Google gemini fix (#1473) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 适配 google gemini 优化为从用户input中提取文件 * Update README.md (#1477) * Update README.md * Update README.md * Update requirements.txt (#1480) * welcome glm4 from 智谱! * Update README.md (#1484) * Update README.md (#1485) * update zhipu * Fix translation task name in core_functional.py * zhipuai version problem --------- Co-authored-by: binary-husky <96192199+binary-husky@users.noreply.github.com> Co-authored-by: binary-husky --- request_llms/bridge_google_gemini.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/request_llms/bridge_google_gemini.py b/request_llms/bridge_google_gemini.py index 49d82119..48e54190 100644 --- a/request_llms/bridge_google_gemini.py +++ b/request_llms/bridge_google_gemini.py @@ -19,7 +19,7 @@ def predict_no_ui_long_connection(inputs, llm_kwargs, history=[], sys_prompt="", # 检查API_KEY if get_conf("GEMINI_API_KEY") == "": raise ValueError(f"请配置 GEMINI_API_KEY。") - + genai = GoogleChatInit() watch_dog_patience = 5 # 看门狗的耐心, 设置5秒即可 gpt_replying_buffer = '' @@ -50,6 +50,11 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp yield from update_ui_lastest_msg(f"请配置 GEMINI_API_KEY。", chatbot=chatbot, history=history, delay=0) return + # 适配润色区域 + if additional_fn is not None: + from core_functional import handle_core_functionality + inputs, history = handle_core_functionality(additional_fn, inputs, history, chatbot) + if "vision" in llm_kwargs["llm_model"]: have_recent_file, image_paths = have_any_recent_upload_image_files(chatbot) def make_media_input(inputs, image_paths):