试用插件完成预测输入
This commit is contained in:
@ -16,9 +16,10 @@ def get_core_functions():
|
|||||||
"Suffix": r"",
|
"Suffix": r"",
|
||||||
"Color": r"secondary", # 按钮颜色
|
"Color": r"secondary", # 按钮颜色
|
||||||
},
|
},
|
||||||
"预测输入": {
|
"中文学术润色": {
|
||||||
"Prefix": r"",
|
"Prefix": r"作为一名中文学术论文写作改进助理,你的任务是改进所提供文本的拼写、语法、清晰、简洁和整体可读性," +
|
||||||
"Suffix": "\nAfter answering the questions, list three more questions that users may ask",
|
r"同时分解长句,减少重复,并提供改进建议。请只提供文本的更正版本,避免包括解释。请编辑以下文本" + "\n\n",
|
||||||
|
"Suffix": r"",
|
||||||
},
|
},
|
||||||
"查找语法错误": {
|
"查找语法错误": {
|
||||||
"Prefix": r"Can you help me ensure that the grammar and the spelling is correct? " +
|
"Prefix": r"Can you help me ensure that the grammar and the spelling is correct? " +
|
||||||
|
|||||||
@ -19,8 +19,11 @@ def get_crazy_functions():
|
|||||||
from crazy_functions.解析项目源代码 import 解析一个Lua项目
|
from crazy_functions.解析项目源代码 import 解析一个Lua项目
|
||||||
from crazy_functions.解析项目源代码 import 解析一个CSharp项目
|
from crazy_functions.解析项目源代码 import 解析一个CSharp项目
|
||||||
from crazy_functions.总结word文档 import 总结word文档
|
from crazy_functions.总结word文档 import 总结word文档
|
||||||
|
from crazy_functions.三千问 import 猜你想问
|
||||||
function_plugins = {
|
function_plugins = {
|
||||||
|
"三千问:猜你想问": {
|
||||||
|
"Function": HotReload(猜你想问)
|
||||||
|
},
|
||||||
"解析整个Python项目": {
|
"解析整个Python项目": {
|
||||||
"Color": "stop", # 按钮颜色
|
"Color": "stop", # 按钮颜色
|
||||||
"Function": HotReload(解析一个Python项目)
|
"Function": HotReload(解析一个Python项目)
|
||||||
|
|||||||
29
crazy_functions/三千问.py
Normal file
29
crazy_functions/三千问.py
Normal 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) # 刷新界面
|
||||||
Reference in New Issue
Block a user