10.14货物标解析
This commit is contained in:
parent
93751f7e74
commit
9a2141c3a9
@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
import requests
|
||||
import mimetypes
|
||||
|
||||
|
@ -119,6 +119,10 @@ def validate_request(default_zb_type=1):
|
||||
zb_type = request.json.get('zb_type', default_zb_type)
|
||||
if not file_url:
|
||||
return jsonify({'error': 'No file URL provided'}), 400
|
||||
try:
|
||||
zb_type = int(zb_type)
|
||||
except (ValueError, TypeError):
|
||||
return jsonify({'error': 'Invalid zb_type provided'}), 400
|
||||
return file_url, zb_type
|
||||
|
||||
# 流式
|
||||
|
@ -1,2 +1,30 @@
|
||||
def combine_basic_info():
|
||||
return True
|
||||
def combine_basic_info(knowledge_name,output_folder,clause_path):
|
||||
baseinfo_combined_res={
|
||||
"招标人/代理信息": {
|
||||
"招标人": "黄石临空建设管理有限公司",
|
||||
"招标人联系方式": {
|
||||
"名称": "黄石临空建设管理有限公司",
|
||||
"地址": "大冶市还地桥镇",
|
||||
"联系人": "王先生",
|
||||
"电话": "13545510946",
|
||||
"传真": "未知",
|
||||
"电子邮件": "未知",
|
||||
"网址": "未知",
|
||||
"开户银行": "未知",
|
||||
"账号": "未知"
|
||||
},
|
||||
"招标代理机构": "湖北民成工程项目管理有限公司",
|
||||
"招标代理机构联系方式": {
|
||||
"名称": "湖北民成工程项目管理有限公司",
|
||||
"地址": "大冶市港湖还建楼 20栋二单元 102室",
|
||||
"联系人": "尹工",
|
||||
"电话": "18327823905",
|
||||
"传真": "未知",
|
||||
"电子邮件": "未知",
|
||||
"网址": "未知",
|
||||
"开户银行": "未知",
|
||||
"账号": "未知"
|
||||
}
|
||||
}
|
||||
}
|
||||
return {"基础信息":baseinfo_combined_res}
|
@ -356,14 +356,14 @@ def handle_query(file_path, user_query, output_file, result_key, keywords):
|
||||
with open(output_file, 'w', encoding='utf-8') as file:
|
||||
counter = 1
|
||||
for content in qianwen_txt:
|
||||
file.write("..............." + '\n')
|
||||
file.write(f"{counter}. {content}\n")
|
||||
file.write("..............." + '\n')
|
||||
counter += 1
|
||||
|
||||
file_id = upload_file(output_file)
|
||||
qianwen_ans = qianwen_long(file_id, user_query)
|
||||
num_list = process_string_list(qianwen_ans)
|
||||
print(num_list)
|
||||
print(result_key+"选中的序号:"+str(num_list))
|
||||
|
||||
for index in num_list:
|
||||
if index - 1 < len(qianwen_txt):
|
||||
@ -423,10 +423,10 @@ if __name__ == '__main__':
|
||||
start_time = time.time()
|
||||
# truncate_json_path = "C:\\Users\\Administrator\\Desktop\\货物标\\output4\\tmp2\\竞争性谈判文件(3)_tobidders_notice_part1\\truncate_output.json"
|
||||
# truncate_file="C:\\Users\\Administrator\\Desktop\\货物标\\output4\\招标文件(实高电子显示屏)_tobidders_notice_part1.docx"
|
||||
clause_path="C:\\Users\\Administrator\\Desktop\\货物标\\output4\\tmp1\\clause招标文件(广水市教育局封闭管理项目二次)_tobidders_notice_part2.json"
|
||||
output_dir = "C:\\Users\\Administrator\\Desktop\\货物标\\output4\\invalid"
|
||||
clause_path="D:\\flask_project\\flask_app\\static\\output\\015d997e-c32c-49d1-a611-a2e817ace6a1\\clause1.json"
|
||||
output_dir = "D:\\flask_project\\flask_app\\static\\output\\015d997e-c32c-49d1-a611-a2e817ace6a1"
|
||||
# doc_path = 'C:\\Users\\Administrator\\Desktop\\fsdownload\\temp7\\3abb6e16-19db-42ad-9504-53bf1072dfe7\\ztbfile_invalid.docx'
|
||||
doc_path = 'C:\\Users\\Administrator\\Desktop\\货物标\\zbfilesdocx\\招标文件(广水市教育局封闭管理项目二次).docx'
|
||||
doc_path = 'D:\\flask_project\\flask_app\\static\\output\\015d997e-c32c-49d1-a611-a2e817ace6a1\\ztbfile.docx'
|
||||
results = combine_find_invalid(doc_path, output_dir)
|
||||
end_time = time.time()
|
||||
print("Elapsed time:", str(end_time - start_time))
|
@ -26,9 +26,9 @@ def combine_technical_and_business(data, target_values):
|
||||
# 默认其他所有内容都归为商务标
|
||||
else:
|
||||
if not is_business:
|
||||
if '商务标' not in extracted_data:
|
||||
extracted_data['商务标'] = {}
|
||||
extracted_data['商务标'][key] = value
|
||||
if '商务评分' not in extracted_data:
|
||||
extracted_data['商务评分'] = {}
|
||||
extracted_data['商务评分'][key] = value
|
||||
business_found = True
|
||||
continue
|
||||
|
||||
@ -42,9 +42,9 @@ def combine_technical_and_business(data, target_values):
|
||||
extract_nested(data)
|
||||
|
||||
if not technical_found:
|
||||
extracted_data['技术标'] = ''
|
||||
extracted_data['技术评分'] = ''
|
||||
if not business_found:
|
||||
extracted_data['商务标'] = ''
|
||||
extracted_data['商务评分'] = ''
|
||||
|
||||
return extracted_data
|
||||
|
||||
@ -165,7 +165,8 @@ def combine_evaluation_standards(truncate_file):
|
||||
"主要监理岗位的职责": {
|
||||
"评分": "4分",
|
||||
"要求": "1、总监理工程师的职责全面、清晰、合理得 1.2-2分;一般的1.2分。2、其他主要监理人员及岗位的职责全面、清晰、合理得 1.2-2分;一般的 1.2分。"
|
||||
}
|
||||
},
|
||||
"备注": "注:若不满足“与公安部、省公安厅、随州市公安局高清视频会议系统无缝对接互联互通”的要求,则本项技术部分(50分)不得分。"
|
||||
},
|
||||
"商务评分": {
|
||||
"控制系统内主板": {
|
||||
@ -215,8 +216,8 @@ def combine_evaluation_standards(truncate_file):
|
||||
else:
|
||||
# 如果 judge 是 False,直接返回默认的技术标和商务标的结构
|
||||
result_data = {}
|
||||
result_data['技术标'] = ''
|
||||
result_data['商务标'] = ''
|
||||
result_data['技术评分'] = ''
|
||||
result_data['商务评分'] = ''
|
||||
return result_data
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#竞磋 竞谈 磋商 询价 邀请 单一来源
|
||||
import json
|
||||
import time
|
||||
|
||||
from flask_app.main.format_change import docx2pdf, pdf2docx
|
||||
from flask_app.main.json_utils import transform_json_values
|
||||
@ -10,7 +11,7 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
import concurrent.futures
|
||||
from flask_app.main.知识库操作 import addfileToKnowledge, deleteKnowledge
|
||||
from flask_app.货物标.投标人须知正文条款提取成json文件货物标版 import convert_clause_to_json
|
||||
from flask_app.货物标.无效标和废标和禁止投标整合货物标版 import combine_find_invalid
|
||||
from flask_app.货物标.无效标和废标和禁止投标整合main import combine_find_invalid
|
||||
from flask_app.货物标.资格审查main import combine_qualification_review
|
||||
from flask_app.货物标.评分标准提取main import combine_evaluation_standards
|
||||
import logging
|
||||
@ -67,9 +68,9 @@ def preprocess_files(output_folder, file_path, file_type, unique_id):
|
||||
'clause_path': clause_path,
|
||||
'invalid_docpath': invalid_docpath
|
||||
}
|
||||
def fetch_project_basic_info(knowledge_name, truncate0, output_folder, clause_path): # 投标人须知前附表
|
||||
def fetch_project_basic_info(knowledge_name, output_folder, clause_path): # 投标人须知前附表
|
||||
logger.info("starting基础信息...")
|
||||
basic_res = combine_basic_info()
|
||||
basic_res = combine_basic_info(knowledge_name,output_folder,clause_path)
|
||||
logger.info("基础信息done")
|
||||
return basic_res
|
||||
|
||||
@ -160,7 +161,7 @@ def goods_bid_main(output_folder,file_path, file_type, unique_id):
|
||||
|
||||
# 提交依赖 knowledge_name 和 index 的任务
|
||||
future_dependencies = {
|
||||
'base_info': executor.submit(fetch_project_basic_info, knowledge_name, processed_data['truncate0'],
|
||||
'base_info': executor.submit(fetch_project_basic_info, knowledge_name,
|
||||
output_folder, processed_data['clause_path']),
|
||||
'qualification_review': executor.submit(fetch_qualification_review,output_folder, processed_data['qualification_path'],processed_data['notice_path'],knowledge_name),
|
||||
}
|
||||
@ -180,3 +181,14 @@ def goods_bid_main(output_folder,file_path, file_type, unique_id):
|
||||
|
||||
# 删除知识索引
|
||||
deleteKnowledge(index)
|
||||
|
||||
if __name__ == "__main__":
|
||||
output_folder = "flask_app/static/output/zytest1"
|
||||
|
||||
start_time = time.time()
|
||||
file_type = 1 #1:docx 2:pdf 3:其他
|
||||
input_file = "C:\\Users\\Administrator\\Desktop\\货物标\\zbfiles\\6.2定版视频会议磋商文件.pdf"
|
||||
goods_bid_main(output_folder, input_file, file_type, "uuidzyzy11")
|
||||
end_time = time.time()
|
||||
elapsed_time = end_time - start_time # 计算耗时
|
||||
print(f"Function execution took {elapsed_time} seconds.")
|
@ -326,20 +326,20 @@ def process_additional_queries(combined_res, match_keys,output_folder, notice_pa
|
||||
Args:
|
||||
combined_res: 初始的组合结果。
|
||||
match_keys: 匹配的章节或条款引用。 [{'资格性审查.资格要求': '符合本采购文件第一章第二款要求,并提供合格有效的证明材料。'}]
|
||||
output_folder: 输出文件夹路径。
|
||||
notice_path: 通知文件路径。
|
||||
knowledge_name: 知识库的名称。
|
||||
|
||||
Returns:
|
||||
dict: 更新后的最终结果。
|
||||
"""
|
||||
clause2_path = convert_clause_to_json(notice_path, output_folder, 2)
|
||||
# 处理match_keys,匹配并附加条款内容
|
||||
original_keys = copy.deepcopy(match_keys)
|
||||
updated_match_keys = process_match_keys(match_keys, clause2_path)
|
||||
#正则匹配到指定内容后就直接返回
|
||||
if updated_match_keys != original_keys:
|
||||
return update_json_data(combined_res, updated_match_keys)
|
||||
# 生成进一步的问题
|
||||
ques = generate_questions(original_keys)
|
||||
|
||||
if updated_match_keys != match_keys:
|
||||
form_response_dict = update_json_data(combined_res, updated_match_keys)
|
||||
else:
|
||||
ques = generate_questions(match_keys)
|
||||
results = multi_threading(ques, knowledge_name)
|
||||
|
||||
for _, response in results:
|
||||
@ -352,7 +352,11 @@ def process_additional_queries(combined_res, match_keys,output_folder, notice_pa
|
||||
else:
|
||||
print(f"形式响应评审:Warning: Missing or incomplete response data.")
|
||||
|
||||
return update_json_data(combined_res, updated_match_keys)
|
||||
form_response_dict = update_json_data(combined_res, updated_match_keys)
|
||||
|
||||
# 添加额外的处理步骤
|
||||
final_result = {"资格审查": form_response_dict}
|
||||
return final_result
|
||||
|
||||
|
||||
def combine_qualification_review(output_folder,qualification_path, notice_path,knowledge_name):
|
||||
@ -391,7 +395,7 @@ def combine_qualification_review(output_folder,qualification_path, notice_path,k
|
||||
|
||||
# 如果没有匹配的章节或条款,直接返回 combined_res
|
||||
if not match_keys:
|
||||
return combined_res
|
||||
return {"资格审查":combined_res}
|
||||
# 调用新的函数处理后续逻辑
|
||||
return process_additional_queries(combined_res, match_keys, output_folder,notice_path,knowledge_name)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user