feat(jupter): use args to disable Markdown parse

This commit is contained in:
saltfish 2023-04-22 21:11:24 +08:00
parent 95f8b2824a
commit 13342c2988
2 changed files with 9 additions and 2 deletions

View File

@ -30,6 +30,8 @@ def get_crazy_functions():
"Color": "stop", "Color": "stop",
"AsButton":False, "AsButton":False,
"Function": HotReload(解析ipynb文件), "Function": HotReload(解析ipynb文件),
"AdvancedArgs": True, # 调用时唤起高级参数输入区默认False
"ArgsReminder": "若输入0则不解析notebook中的Markdown块", # 高级参数输入区的显示提示
}, },
"批量总结Word文档": { "批量总结Word文档": {
"Color": "stop", "Color": "stop",

View File

@ -67,11 +67,16 @@ def parseNotebook(filename, enable_markdown=1):
def ipynb解释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt): def ipynb解释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):
from .crazy_utils import request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency from .crazy_utils import request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency
enable_markdown = plugin_kwargs.get("advanced_arg", "1")
try:
enable_markdown = int(enable_markdown)
except ValueError:
enable_markdown = 1
pfg = PaperFileGroup() pfg = PaperFileGroup()
print(file_manifest)
for fp in file_manifest: for fp in file_manifest:
file_content = parseNotebook(fp, enable_markdown=1) file_content = parseNotebook(fp, enable_markdown=enable_markdown)
pfg.file_paths.append(fp) pfg.file_paths.append(fp)
pfg.file_contents.append(file_content) pfg.file_contents.append(file_content)