From 21351ddbe36baf5e3ef381a3743c1685c50813a4 Mon Sep 17 00:00:00 2001 From: zy123 <646228430@qq.com> Date: Mon, 4 Nov 2024 11:22:01 +0800 Subject: [PATCH] 11.4 --- flask_app/general/多线程提问.py | 3 ++- flask_app/general/通义千问long.py | 1 + flask_app/货物标/技术参数要求提取.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/flask_app/general/多线程提问.py b/flask_app/general/多线程提问.py index 4ee6a38..17a958d 100644 --- a/flask_app/general/多线程提问.py +++ b/flask_app/general/多线程提问.py @@ -241,7 +241,8 @@ def llm_call(question, knowledge_name,file_id, result_queue, ans_index, llm_type # assistant=create_assistant(knowledge_name) elif llm_type==2: print(f"qianwen_long! question:{question}") - qianwen_res,usage = qianwen_long(file_id,question) + # qianwen_res,usage = qianwen_long(file_id,question) #有bug + qianwen_res = qianwen_long(file_id, question) result_queue.put((ans_index,(question,qianwen_res))) return else : diff --git a/flask_app/general/通义千问long.py b/flask_app/general/通义千问long.py index f9a86fa..bff54e5 100644 --- a/flask_app/general/通义千问long.py +++ b/flask_app/general/通义千问long.py @@ -44,6 +44,7 @@ def qianwen_long(file_id, user_query): ) # Return the response content + # return completion.choices[0].message.content,completion.usage return completion.choices[0].message.content def qianwen_long_text(file_id, user_query): diff --git a/flask_app/货物标/技术参数要求提取.py b/flask_app/货物标/技术参数要求提取.py index 03d47a4..ffee0da 100644 --- a/flask_app/货物标/技术参数要求提取.py +++ b/flask_app/货物标/技术参数要求提取.py @@ -105,7 +105,7 @@ def get_technical_requirements(file_id): } """ res = qianwen_long(file_id, user_query1) - print(res) + # print(res) cleaned_res = clean_json_string(res) #转字典 # print(res) keys_list,good_list,no_keys_added= generate_key_paths(cleaned_res['采购需求']) # 提取需要采购的货物清单 @@ -116,7 +116,7 @@ def get_technical_requirements(file_id): else: # user_query_template = "请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,外层键名为\"{}\", 键值对中的键是你对该要求的总结,而值需要完全与原文保持一致,不可擅自总结删减。" user_query_template = """ -请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,键名为\"{}\", 键值为一个列表,列表中包含若干描述\"{}\"的技术参数(或采购要求)的字符串。示例格式如下: +请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,键名为\"{}\", 键值为一个列表,列表中包含若干描述\"{}\"的技术参数(或采购要求)的字符串。示例输出格式如下: {{ "摄像机控制键盘": [ "支持串行 RS232/RS422 和 IP 混合控制,允许在一个控制器上使用 RS232/RS422/IP 控制单个系统中的摄像机;", @@ -174,7 +174,7 @@ def test_all_files_in_folder(input_folder, output_folder): if __name__ == "__main__": # truncate_file="D:\\flask_project\\flask_app\\static\\output\\output1\\bf225a5e-16d0-45c8-8c19-54a1a94cf3e2\\ztbfile_procurement.docx" # truncate_file="C:\\Users\\Administrator\\Desktop\\货物标\\zbfilesdocx\\招标文件(107国道).docx" - truncate_file="C:\\Users\\Administrator\\Desktop\\货物标\\output1\\招标文件(107国道)_procurement.docx" + 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) res=get_technical_requirements(file_id)