镜像自地址
https://github.com/binary-husky/gpt_academic.git
已同步 2025-12-06 06:26:47 +00:00
处理模型兼容的一些细节
这个提交包含在:
@@ -29,6 +29,7 @@ def gpt_academic_generate_oai_reply(
|
||||
sys_prompt=self._oai_system_message[0]['content'],
|
||||
console_slience=True
|
||||
)
|
||||
assumed_done = reply.endswith('\nTERMINATE')
|
||||
return True, reply
|
||||
|
||||
class AutoGenGeneral(PluginMultiprocessManager):
|
||||
|
||||
@@ -21,7 +21,7 @@ class PluginMultiprocessManager:
|
||||
# self.web_port = web_port
|
||||
self.alive = True
|
||||
self.use_docker = get_conf("AUTOGEN_USE_DOCKER")
|
||||
|
||||
self.last_user_input = ""
|
||||
# create a thread to monitor self.heartbeat, terminate the instance if no heartbeat for a long time
|
||||
timeout_seconds = 5 * 60
|
||||
self.heartbeat_watchdog = WatchDog(timeout=timeout_seconds, bark_fn=self.terminate, interval=5)
|
||||
@@ -55,6 +55,11 @@ class PluginMultiprocessManager:
|
||||
|
||||
def send_command(self, cmd):
|
||||
# ⭐ run in main process
|
||||
if cmd == self.last_user_input:
|
||||
print('repeated input detected, ignore')
|
||||
cmd = ""
|
||||
else:
|
||||
self.last_user_input = cmd
|
||||
self.parent_conn.send(PipeCom("user_input", cmd))
|
||||
|
||||
def immediate_showoff_when_possible(self, fp):
|
||||
|
||||
@@ -48,11 +48,13 @@ def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_
|
||||
"azure-gpt-4",
|
||||
"azure-gpt-4-32k",
|
||||
]
|
||||
if llm_kwargs['llm_model'] not in supported_llms:
|
||||
chatbot.append([f"处理任务: {txt}", f"当前插件只支持{str(supported_llms)}, 当前模型{llm_kwargs['llm_model']}."])
|
||||
from request_llms.bridge_all import model_info
|
||||
if model_info[llm_kwargs['llm_model']]["max_token"] < 8000: # 至少是8k上下文的模型
|
||||
chatbot.append([f"处理任务: {txt}", f"当前插件只支持{str(supported_llms)}, 当前模型{llm_kwargs['llm_model']}的最大上下文长度太短, 不能支撑AutoGen运行。"])
|
||||
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
||||
return
|
||||
llm_kwargs['api_key'] = select_api_key(llm_kwargs['api_key'], llm_kwargs['llm_model'])
|
||||
if model_info[llm_kwargs['llm_model']]["endpoint"] is not None: # 如果不是本地模型,加载API_KEY
|
||||
llm_kwargs['api_key'] = select_api_key(llm_kwargs['api_key'], llm_kwargs['llm_model'])
|
||||
|
||||
# 检查当前的模型是否符合要求
|
||||
API_URL_REDIRECT = get_conf('API_URL_REDIRECT')
|
||||
|
||||
在新工单中引用
屏蔽一个用户