Merge branch 'master' of github.com:binary-husky/chatgpt_academic
This commit is contained in:
		
						commit
						34ca9f138f
					
				@ -63,6 +63,7 @@ def get_core_functions():
 | 
			
		||||
            "Prefix":   r"我需要你找一张网络图片。使用Unsplash API(https://source.unsplash.com/960x640/?<英语关键词>)获取图片URL," +
 | 
			
		||||
                        r"然后请使用Markdown格式封装,并且不要有反斜线,不要用代码块。现在,请按以下描述给我发送图片:" + "\n\n",
 | 
			
		||||
            "Suffix":   r"",
 | 
			
		||||
            "Visible": False,
 | 
			
		||||
        },
 | 
			
		||||
        "解释代码": {
 | 
			
		||||
            "Prefix":   r"请解释以下代码:" + "\n```\n",
 | 
			
		||||
@ -73,6 +74,5 @@ def get_core_functions():
 | 
			
		||||
                        r"Note that, reference styles maybe more than one kind, you should transform each item correctly." +
 | 
			
		||||
                        r"Items need to be transformed:",
 | 
			
		||||
            "Suffix":   r"",
 | 
			
		||||
            "Visible": False,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
from toolbox import CatchException, report_execption, write_results_to_file
 | 
			
		||||
from toolbox import update_ui
 | 
			
		||||
from toolbox import update_ui, promote_file_to_downloadzone
 | 
			
		||||
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
 | 
			
		||||
from .crazy_utils import request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency
 | 
			
		||||
from .crazy_utils import read_and_clean_pdf_text
 | 
			
		||||
@ -147,23 +147,14 @@ def 解析PDF(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot,
 | 
			
		||||
            print('writing html result failed:', trimmed_format_exc())
 | 
			
		||||
 | 
			
		||||
    # 准备文件的下载
 | 
			
		||||
    import shutil
 | 
			
		||||
    for pdf_path in generated_conclusion_files:
 | 
			
		||||
        # 重命名文件
 | 
			
		||||
        rename_file = f'./gpt_log/翻译-{os.path.basename(pdf_path)}'
 | 
			
		||||
        if os.path.exists(rename_file):
 | 
			
		||||
            os.remove(rename_file)
 | 
			
		||||
        shutil.copyfile(pdf_path, rename_file)
 | 
			
		||||
        if os.path.exists(pdf_path):
 | 
			
		||||
            os.remove(pdf_path)
 | 
			
		||||
        rename_file = f'翻译-{os.path.basename(pdf_path)}'
 | 
			
		||||
        promote_file_to_downloadzone(pdf_path, rename_file=rename_file, chatbot=chatbot)
 | 
			
		||||
    for html_path in generated_html_files:
 | 
			
		||||
        # 重命名文件
 | 
			
		||||
        rename_file = f'./gpt_log/翻译-{os.path.basename(html_path)}'
 | 
			
		||||
        if os.path.exists(rename_file):
 | 
			
		||||
            os.remove(rename_file)
 | 
			
		||||
        shutil.copyfile(html_path, rename_file)
 | 
			
		||||
        if os.path.exists(html_path):
 | 
			
		||||
            os.remove(html_path)
 | 
			
		||||
        rename_file = f'翻译-{os.path.basename(html_path)}'
 | 
			
		||||
        promote_file_to_downloadzone(html_path, rename_file=rename_file, chatbot=chatbot)
 | 
			
		||||
    chatbot.append(("给出输出文件清单", str(generated_conclusion_files + generated_html_files)))
 | 
			
		||||
    yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user