ui layout improve

This commit is contained in:
qingxu fu 2023-09-03 14:47:22 +08:00
parent e666b5269e
commit 1dd165a3cd
3 changed files with 55 additions and 50 deletions

View File

@ -34,9 +34,16 @@ def get_crazy_functions():
from crazy_functions.Latex全文翻译 import Latex中译英 from crazy_functions.Latex全文翻译 import Latex中译英
from crazy_functions.Latex全文翻译 import Latex英译中 from crazy_functions.Latex全文翻译 import Latex英译中
from crazy_functions.批量Markdown翻译 import Markdown中译英 from crazy_functions.批量Markdown翻译 import Markdown中译英
from crazy_functions.虚空终端 import 虚空终端
function_plugins = { function_plugins = {
"虚空终端": {
"Group": "对话|编程|学术",
"Color": "stop",
"AsButton": True,
"Function": HotReload(虚空终端)
},
"解析整个Python项目": { "解析整个Python项目": {
"Group": "编程", "Group": "编程",
"Color": "stop", "Color": "stop",
@ -139,7 +146,7 @@ def get_crazy_functions():
"读Tex论文写摘要": { "读Tex论文写摘要": {
"Group": "学术", "Group": "学术",
"Color": "stop", "Color": "stop",
"AsButton": True, "AsButton": False,
"Info": "读取Tex论文并写摘要 | 输入参数为路径", "Info": "读取Tex论文并写摘要 | 输入参数为路径",
"Function": HotReload(读文章写摘要) "Function": HotReload(读文章写摘要)
}, },
@ -494,18 +501,6 @@ def get_crazy_functions():
except: except:
print('Load function plugin failed') print('Load function plugin failed')
try:
from crazy_functions.虚空终端 import 虚空终端
function_plugins.update({
"虚空终端": {
"Group": "对话",
"Color": "stop",
"AsButton": True,
"Function": HotReload(虚空终端)
}
})
except:
print('Load function plugin failed')
# try: # try:
# from crazy_functions.chatglm微调工具 import 微调数据集生成 # from crazy_functions.chatglm微调工具 import 微调数据集生成

View File

@ -1,3 +1,48 @@
"""
Explanation of the Void Terminal Plugin:
Please describe in natural language what you want to do.
1. You can open the plugin's dropdown menu to explore various capabilities of this project, and then describe your needs in natural language, for example:
- "Please call the plugin to translate a PDF paper for me. I just uploaded the paper to the upload area."
- "Please use the plugin to translate a PDF paper, with the address being https://www.nature.com/articles/s41586-019-1724-z.pdf."
- "Generate an image with blooming flowers and lush green grass using the plugin."
- "Translate the README using the plugin. The GitHub URL is https://github.com/facebookresearch/co-tracker."
- "Translate an Arxiv paper for me. The Arxiv ID is 1812.10695. Remember to use the plugin and don't do it manually!"
- "I don't like the current interface color. Modify the configuration and change the theme to THEME="High-Contrast"."
- "Could you please explain the structure of the Transformer network?"
2. If you use keywords like "call the plugin xxx", "modify the configuration xxx", "please", etc., your intention can be recognized more accurately.
3. Your intention can be recognized more accurately when using powerful models like GPT4. This plugin is relatively new, so please feel free to provide feedback on GitHub.
4. Now, if you need to process a file, please upload the file (drag the file to the file upload area) or describe the path to the file.
5. If you don't need to upload a file, you can simply repeat your command again.
"""
explain_msg = """
## 虚空终端插件说明:
请用**自然语言**描述您需要做什么
1. 您可以打开插件下拉菜单以了解本项目的各种能力然后用自然语言描述您的需要例如
- 请调用插件为我翻译PDF论文论文我刚刚放到上传区了
- 请调用插件翻译PDF论文地址为https://www.nature.com/articles/s41586-019-1724-z.pdf
- 生成一张图片图中鲜花怒放绿草如茵用插件实现
- 用插件翻译READMEGithub网址是https://github.com/facebookresearch/co-tracker
- 给爷翻译Arxiv论文arxiv论文的ID是1812.10695记得用插件不要自己瞎搞
- 我不喜欢当前的界面颜色修改配置把主题THEME更换为THEME="High-Contrast"
- 请问Transformer网络的结构是怎样的
2. 如果您使用调用插件xxx修改配置xxx请问等关键词您的意图可以被识别的更准确
3. 使用GPT4等强力模型时您的意图可以被识别的更准确该插件诞生时间不长欢迎您前往Github反馈问题
4. 现在如果需要处理文件请您上传文件将文件拖动到文件上传区或者描述文件所在的路径
5. 如果不需要上传文件现在您只需要再次重复一次您的指令即可
"""
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from typing import List from typing import List
from toolbox import CatchException, update_ui, gen_time_str from toolbox import CatchException, update_ui, gen_time_str
@ -10,10 +55,6 @@ from crazy_functions.vt_fns.vt_state import VoidTerminalState
from crazy_functions.vt_fns.vt_modify_config import modify_configuration_hot from crazy_functions.vt_fns.vt_modify_config import modify_configuration_hot
from crazy_functions.vt_fns.vt_modify_config import modify_configuration_reboot from crazy_functions.vt_fns.vt_modify_config import modify_configuration_reboot
from crazy_functions.vt_fns.vt_call_plugin import execute_plugin from crazy_functions.vt_fns.vt_call_plugin import execute_plugin
from enum import Enum
import copy, json, pickle, os, sys
class UserIntention(BaseModel): class UserIntention(BaseModel):
user_prompt: str = Field(description="the content of user input", default="") user_prompt: str = Field(description="the content of user input", default="")
@ -61,37 +102,6 @@ def analyze_intention_with_simple_rules(txt):
return is_certain, user_intention return is_certain, user_intention
explain_msg = """
## 虚空终端插件说明:
请用**自然语言**描述您需要做什么
1. 您可以打开插件下拉菜单以了解本项目的各种能力然后用自然语言描述您的需要例如
- 请调用插件为我翻译PDF论文论文我刚刚放到上传区了
- 请调用插件翻译PDF论文地址为https://www.nature.com/articles/s41586-019-1724-z.pdf
- 生成一张图片图中鲜花怒放绿草如茵用插件实现
- 用插件翻译READMEGithub网址是https://github.com/facebookresearch/co-tracker
- 给爷翻译Arxiv论文arxiv论文的ID是1812.10695记得用插件不要自己瞎搞
- 我不喜欢当前的界面颜色修改配置把主题THEME更换为THEME="High-Contrast"
- 请问Transformer网络的结构是怎样的
2. 如果您使用调用插件xxx修改配置xxx请问等关键词您的意图可以被识别的更准确
3. 使用GPT4等强模型时您的意图可以被识别的更准确
4. 现在如果需要处理文件请您上传文件将文件拖动到文件上传区或者描述文件所在的路径
5. 如果不需要上传文件现在您只需要再次重复一次您的指令即可
"""
@CatchException @CatchException
def 虚空终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port): def 虚空终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
# 获取当前虚空终端状态 # 获取当前虚空终端状态
@ -162,4 +172,3 @@ def 虚空终端主路由(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst
return return

View File

@ -492,7 +492,8 @@ def find_recent_files(directory):
current_time = time.time() current_time = time.time()
one_minute_ago = current_time - 60 one_minute_ago = current_time - 60
recent_files = [] recent_files = []
if not os.path.exists(directory):
os.makedirs(directory, exist_ok=True)
for filename in os.listdir(directory): for filename in os.listdir(directory):
file_path = os.path.join(directory, filename) file_path = os.path.join(directory, filename)
if file_path.endswith('.log'): if file_path.endswith('.log'):