修复pdf翻译的问题

这个提交包含在:
505030475
2023-05-23 00:05:00 +08:00
父节点 6d557b3c34
当前提交 db16e85d8c
共有 2 个文件被更改,包括 101 次插入13 次删除

查看文件

@@ -168,14 +168,17 @@ def write_results_to_file(history, file_name=None):
with open(f'./gpt_log/{file_name}', 'w', encoding='utf8') as f:
f.write('# chatGPT 分析报告\n')
for i, content in enumerate(history):
try: # 这个bug没找到触发条件,暂时先这样顶一下
if type(content) != str:
content = str(content)
try:
if type(content) != str: content = str(content)
except:
continue
if i % 2 == 0:
f.write('## ')
f.write(content)
try:
f.write(content)
except:
# remove everything that cannot be handled by utf8
f.write(content.encode('utf-8', 'ignore').decode())
f.write('\n\n')
res = '以上材料已经被写入' + os.path.abspath(f'./gpt_log/{file_name}')
print(res)