Spaces:
Paused
Paused
版本3.2
Browse files- crazy_functional.py +10 -1
- crazy_functions/询问多个大语言模型.py +29 -0
- version +2 -2
crazy_functional.py
CHANGED
|
@@ -207,6 +207,15 @@ def get_crazy_functions():
|
|
| 207 |
"Function": HotReload(解析任意code项目)
|
| 208 |
},
|
| 209 |
})
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
###################### 第n组插件 ###########################
|
| 212 |
return function_plugins
|
|
|
|
| 207 |
"Function": HotReload(解析任意code项目)
|
| 208 |
},
|
| 209 |
})
|
| 210 |
+
from crazy_functions.询问多个大语言模型 import 同时问询_指定模型
|
| 211 |
+
function_plugins.update({
|
| 212 |
+
"询问多个GPT模型(手动指定询问哪些模型)": {
|
| 213 |
+
"Color": "stop",
|
| 214 |
+
"AsButton": False,
|
| 215 |
+
"AdvancedArgs": True, # 调用时,唤起高级参数输入区(默认False)
|
| 216 |
+
"ArgsReminder": "支持任意数量的llm接口,用&符号分隔。例如chatglm&gpt-3.5-turbo&api2d-gpt-4", # 高级参数输入区的显示提示
|
| 217 |
+
"Function": HotReload(同时问询_指定模型)
|
| 218 |
+
},
|
| 219 |
+
})
|
| 220 |
###################### 第n组插件 ###########################
|
| 221 |
return function_plugins
|
crazy_functions/询问多个大语言模型.py
CHANGED
|
@@ -25,6 +25,35 @@ def 同时问询(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
|
|
| 25 |
retry_times_at_unknown_error=0
|
| 26 |
)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
history.append(txt)
|
| 29 |
history.append(gpt_say)
|
| 30 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 界面更新
|
|
|
|
| 25 |
retry_times_at_unknown_error=0
|
| 26 |
)
|
| 27 |
|
| 28 |
+
history.append(txt)
|
| 29 |
+
history.append(gpt_say)
|
| 30 |
+
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 界面更新
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@CatchException
|
| 34 |
+
def 同时问询_指定模型(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
|
| 35 |
+
"""
|
| 36 |
+
txt 输入栏用户输入的文本,例如需要翻译的一段话,再例如一个包含了待处理文件的路径
|
| 37 |
+
llm_kwargs gpt模型参数,如温度和top_p等,一般原样传递下去就行
|
| 38 |
+
plugin_kwargs 插件模型的参数,如温度和top_p等,一般原样传递下去就行
|
| 39 |
+
chatbot 聊天显示框的句柄,用于显示给用户
|
| 40 |
+
history 聊天历史,前情提要
|
| 41 |
+
system_prompt 给gpt的静默提醒
|
| 42 |
+
web_port 当前软件运行的端口号
|
| 43 |
+
"""
|
| 44 |
+
history = [] # 清空历史,以免输入溢出
|
| 45 |
+
chatbot.append((txt, "正在同时咨询ChatGPT和ChatGLM……"))
|
| 46 |
+
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 由于请求gpt需要一段时间,我们先及时地做一次界面更新
|
| 47 |
+
|
| 48 |
+
# llm_kwargs['llm_model'] = 'chatglm&gpt-3.5-turbo&api2d-gpt-3.5-turbo' # 支持任意数量的llm接口,用&符号分隔
|
| 49 |
+
llm_kwargs['llm_model'] = plugin_kwargs.get("advanced_arg", 'chatglm&gpt-3.5-turbo') # 'chatglm&gpt-3.5-turbo' # 支持任意数量的llm接口,用&符号分隔
|
| 50 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 51 |
+
inputs=txt, inputs_show_user=txt,
|
| 52 |
+
llm_kwargs=llm_kwargs, chatbot=chatbot, history=history,
|
| 53 |
+
sys_prompt=system_prompt,
|
| 54 |
+
retry_times_at_unknown_error=0
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
history.append(txt)
|
| 58 |
history.append(gpt_say)
|
| 59 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 界面更新
|
version
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"version": 3.
|
| 3 |
"show_feature": true,
|
| 4 |
-
"new_feature": "添加联网(Google)回答问题插件 <-> 修复ChatGLM上下文BUG <-> 添加支持清华ChatGLM和GPT-4 <-> 改进架构,支持与多个LLM模型同时对话 <-> 添加支持API2D(国内,可支持gpt4)"
|
| 5 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"version": 3.2,
|
| 3 |
"show_feature": true,
|
| 4 |
+
"new_feature": "现函数插件可读取高级参数(解读任意语言代码+同时询问任意的LLM组合)<-> 添加联网(Google)回答问题插件 <-> 修复ChatGLM上下文BUG <-> 添加支持清华ChatGLM和GPT-4 <-> 改进架构,支持与多个LLM模型同时对话 <-> 添加支持API2D(国内,可支持gpt4)"
|
| 5 |
}
|