From 42a4473606cf37fbfc4fc5a2bda386cd03aa500c Mon Sep 17 00:00:00 2001 From: zy123 <646228430@qq.com> Date: Sat, 14 Dec 2024 12:12:06 +0800 Subject: [PATCH] =?UTF-8?q?12.14=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_app/货物标/技术参数要求提取.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/flask_app/货物标/技术参数要求提取.py b/flask_app/货物标/技术参数要求提取.py index d7ce702..ca33a4e 100644 --- a/flask_app/货物标/技术参数要求提取.py +++ b/flask_app/货物标/技术参数要求提取.py @@ -363,8 +363,12 @@ def generate_prompt(judge_res, full_text=None): def get_technical_requirements(invalid_path,processed_filepath): file_id = "" model_type = 1 # 默认使用豆包 - first_query_template="该文件是否说明了采购需求,即需要采购哪些货物?如果有,请回答'是',否则,回答'否'" #防止截取失败 + first_query_template="""该文件是否说明了采购需求,即需要采购哪些内容(包括货物、设备、系统、功能模块等)?如果有,请回答'是',否则,回答'否' +文件内容: +{full_text} + """ judge_query = generate_full_user_query(processed_filepath, first_query_template) + print(judge_query) judge_res = doubao_model(judge_query) if '否' in judge_res: model_type = 0 # 使用qianwen-long+invalid_path @@ -523,7 +527,7 @@ def test_all_files_in_folder(input_folder, output_folder): print(f"结果已保存到: {output_file_path}") except Exception as e: print(f"处理文件 {file_path} 时出错: {e}") - +# 如果采购需求为空 考虑再调用一次大模型 qianwen-stream if __name__ == "__main__": start_time=time.time() # truncate_file="C:\\Users\\Administrator\\Desktop\\fsdownload\\469d2aee-9024-4993-896e-2ac7322d41b7\\ztbfile_procurement.docx" @@ -533,11 +537,11 @@ if __name__ == "__main__": # truncate_file="D:\\flask_project\\flask_app\\static\\output\\output1\\e7dda5cb-10ba-47a8-b989-d2993d34bb89\\ztbfile_procurement.docx" # output_folder="C:\\Users\\Administrator\\Desktop\\货物标\\output1\\tmp" # file_id = upload_file(truncate_file) - invalid_path=r"C:\Users\Administrator\Desktop\fsdownload\a110ed59-00e8-47ec-873a-bd4579a6e628\ztbfile.pdf" + invalid_path=r"C:\Users\Administrator\Desktop\fsdownload\8c63f0c9-d642-4f0c-918c-33db5efd6cd0\extract1.txt" # file_id=upload_file(truncate_file) - processed_filepath = pdf2txt(truncate_file) - # processed_filepath=r"C:\Users\Administrator\Desktop\fsdownload\e702f1e6-095d-443d-bb7d-ef2e42037cb1\金水河沿线排涝泵站提档升级项目.txt" - res=get_technical_requirements(truncate_docfile,invalid_path,processed_filepath) + # processed_filepath = pdf2txt(truncate_file) + processed_filepath=r"C:\Users\Administrator\Desktop\fsdownload\8c63f0c9-d642-4f0c-918c-33db5efd6cd0\extract1.txt" + res=get_technical_requirements(invalid_path,processed_filepath) json_string = json.dumps(res, ensure_ascii=False, indent=4) print(json_string) # # input_folder = "C:\\Users\\Administrator\\Desktop\\货物标\\output1"