diff --git a/core_functional.py b/core_functional.py index c1cd854..536ccb6 100644 --- a/core_functional.py +++ b/core_functional.py @@ -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? " + diff --git a/crazy_functional.py b/crazy_functional.py index b3ef685..d89679b 100644 --- a/crazy_functional.py +++ b/crazy_functional.py @@ -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项目) diff --git a/crazy_functions/三千问.py b/crazy_functions/三千问.py new file mode 100644 index 0000000..bbe548a --- /dev/null +++ b/crazy_functions/三千问.py @@ -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) # 刷新界面 \ No newline at end of file diff --git a/promptgenerator.py b/prompt_generator.py similarity index 100% rename from promptgenerator.py rename to prompt_generator.py