优化界面显示|将say也转换为markdwon 格式,并且不做多处理|增强user 和 bot 的对比

This commit is contained in:
w_xiaolizu
2023-05-23 18:32:23 +08:00
parent 065257b6d8
commit c250b6d789
8 changed files with 73 additions and 25 deletions

View File

@ -0,0 +1,30 @@
#! .\venv\
# encoding: utf-8
# @Time : 2023/5/23
# @Author : Spike
# @Descr :
import json
from toolbox import CatchException, update_ui
from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive, input_clipping
import func_box
class ParseNoteBook:
def __init__(self, file):
self.file = file
def load_dict(self):
with open(self.file, 'r', encoding='utf-8', errors='replace') as f:
return json.load(f)
@CatchException
def 翻译理解jupyter(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port):
pass
if __name__ == '__main__':
obj = ParseNoteBook('/Users/kilig/Desktop/jupy/NotarizedUpload.ipynb').load_dict()
print(obj['cells'])

View File

@ -144,3 +144,13 @@ def 解析ipynb文件(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_p
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
return
yield from ipynb解释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, )
if __name__ == '__main__':
import json
filename = ''
code = parseNotebook(filename)
print(code)
with open(filename, 'r', encoding='utf-8', errors='replace') as f:
notebook = f.read()
print(notebook)