diff --git a/crazy_functions/crazy_functions_test.py b/crazy_functions/crazy_functions_test.py index 3fd648a..da4c510 100644 --- a/crazy_functions/crazy_functions_test.py +++ b/crazy_functions/crazy_functions_test.py @@ -186,6 +186,7 @@ def test_Latex(): txt = "C:/Users/fuqingxu/Desktop/旧文件/gpt/papery" txt = r"C:\Users\fuqingxu\Desktop\旧文件\gpt\latex2pdf\2023-06-03-14-57-06" txt = r"C:\Users\fuqingxu\Desktop\旧文件\gpt\latex2pdf\2023-06-03-15-40-20" + txt = r"C:\Users\fuqingxu\Desktop\旧文件\gpt\latex2pdf\2023-06-03-17-14-40" for cookies, cb, hist, msg in (Latex翻译中文并重新编译PDF)(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port): cli_printer.print(cb) # print(cb) diff --git a/crazy_functions/latex_utils.py b/crazy_functions/latex_utils.py index 573f8bd..3fbbf9b 100644 --- a/crazy_functions/latex_utils.py +++ b/crazy_functions/latex_utils.py @@ -62,7 +62,7 @@ def mod_inbraket(match): # return the modified string as the replacement return "\\" + cmd + "{" + str_to_modify + "}" -def fix_content(final_tex): +def fix_content(final_tex, node_string): """ fix common GPT errors to increase success rate """ @@ -85,7 +85,7 @@ class LatexPaperSplit(): if node.preserve: result_string += node.string else: - result_string += fix_content(arr[p]) + result_string += fix_content(arr[p], node.string) p += 1 node = node.next if node is None: break @@ -141,7 +141,7 @@ class LatexPaperSplit(): lt = aft lt = lt.next cnt += 1 - print(cnt) + # print(cnt) if lt is None: break # root 是链表的头 @@ -184,7 +184,7 @@ class LatexPaperSplit(): while True: if not node.preserve: res_to_t.append(node.string) - f.write(node.string + '\n ========================= \n') + f.write(node.string) node = node.next if node is None: break @@ -313,7 +313,7 @@ def Latex精细分解与转化(file_manifest, project_folder, llm_kwargs, plugin # <-------- 写出文件 ----------> msg = f"当前大语言模型: {llm_kwargs['llm_model']},当前语言模型温度设定: {llm_kwargs['temperature']}。" - final_tex = lps.merge_result(pfg.sp_file_result, mode, msg) + final_tex = lps.merge_result(pfg.file_result, mode, msg) with open(project_folder + f'/merge_{mode}.tex', 'w', encoding='utf-8', errors='replace') as f: f.write(final_tex)