From fefe96144f5fd8c3654bc66c0181d7631dbf9bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E7=8E=AE=E6=9D=B0?= Date: Fri, 31 Mar 2023 10:03:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(fix=20"gbk"=20encode=20error=20in=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=80=BB=E7=BB=93PDF=E6=96=87=E6=A1=A3=20lin?= =?UTF-8?q?e14):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于不可编码字符,导致报错,添加软解码,处理原始文本。 --- crazy_functions/批量总结PDF文档.py | 1 + 1 file changed, 1 insertion(+) diff --git a/crazy_functions/批量总结PDF文档.py b/crazy_functions/批量总结PDF文档.py index 102bc9e..bf7fe6f 100644 --- a/crazy_functions/批量总结PDF文档.py +++ b/crazy_functions/批量总结PDF文档.py @@ -11,6 +11,7 @@ def 解析PDF(file_manifest, project_folder, top_p, temperature, chatbot, histor file_content = "" for page in doc: file_content += page.get_text() + file_content = file_content.encode('gbk', 'ignore').decode('gbk') print(file_content) prefix = "接下来请你逐文件分析下面的论文文件,概括其内容" if index==0 else ""