试用插件完成预测输入

This commit is contained in:
w_xiaolizu
2023-04-19 23:01:22 +08:00
parent c6942060e4
commit 8764ae3cb8
4 changed files with 37 additions and 4 deletions

View File

@ -16,9 +16,10 @@ def get_core_functions():
"Suffix": r"",
"Color": r"secondary", # 按钮颜色
},
"预测输入": {
"Prefix": r"",
"Suffix": "\nAfter answering the questions, list three more questions that users may ask",
"中文学术润色": {
"Prefix": r"作为一名中文学术论文写作改进助理,你的任务是改进所提供文本的拼写、语法、清晰、简洁和整体可读性," +
r"同时分解长句,减少重复,并提供改进建议。请只提供文本的更正版本,避免包括解释。请编辑以下文本" + "\n\n",
"Suffix": r"",
},
"查找语法错误": {
"Prefix": r"Can you help me ensure that the grammar and the spelling is correct? " +

View File

@ -19,8 +19,11 @@ def get_crazy_functions():
from crazy_functions.解析项目源代码 import 解析一个Lua项目
from crazy_functions.解析项目源代码 import 解析一个CSharp项目
from crazy_functions.总结word文档 import 总结word文档
from crazy_functions.三千问 import 猜你想问
function_plugins = {
"三千问:猜你想问": {
"Function": HotReload(猜你想问)
},
"解析整个Python项目": {
"Color": "stop", # 按钮颜色
"Function": HotReload(解析一个Python项目)

View File

@ -0,0 +1,29 @@
#! .\venv\
# encoding: utf-8
# @Time : 2023/4/19
# @Author : Spike
# @Descr :
from toolbox import update_ui
from toolbox import CatchException, report_execption, write_results_to_file
from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
@CatchException
def 猜你想问(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
if txt:
show_say = txt
prompt = txt+'\nAfter answering the questions, list three more questions that users may ask.'
else:
prompt = history[-1]+"\nAnalyze the above answers and list three more questions that users may ask."
show_say = 'Analyze the above answers and list three more questions that users may ask.'
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
inputs=prompt,
inputs_show_user=show_say,
llm_kwargs=llm_kwargs,
chatbot=chatbot,
history=history,
sys_prompt=system_prompt
)
chatbot[-1] = (show_say, gpt_say)
history.extend([show_say, gpt_say])
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面