zbparse/flask_app/main/商务标技术标整合.py
2024-08-30 10:34:23 +08:00

43 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import json
from flask_app.main.json_utils import clean_json_string, combine_json_results
from flask_app.main.通义千问long import upload_file, qianwen_long
def combine_business_and_bidding(data):
# 提取并移除“商务标”
business_data = data.pop("商务标", {})
# 尝试提取不同命名的“投标报价”
bidding_data = data.pop("投标报价", None)
if bidding_data is None:
bidding_data = data.pop("投标报价评审标准", {})
# 将“商务标”和“投标报价”数据合并
business_data.update({
"投标报价": bidding_data
})
# 将修改后的商务标数据重新放入主数据结构
data["商务标"] = business_data
return data
def combine_evaluation_standards(truncate2):
# 商务标、技术标评分项:千问
print("starting商务标技术标...")
file_id = upload_file(truncate2)
user_query_2 = (
"根据该文档中的评标办法前附表,请你列出该文件的技术标,商务标,投标报价评审标准以及它们对应的具体评分要求,若对应内容中存在其他信息,在键名如'技术标'中新增子键名'备注'存放该信息。如果评分内容不是这3个则返回文档中给定的评分内容以及它的评分要求都以json的格式返回结果。请不要回答有关形式、资格、响应性评审标准的内容")
evaluation_res = qianwen_long(file_id, user_query_2)
update_json=combine_business_and_bidding(clean_json_string(evaluation_res))
update_json_str = json.dumps(update_json, ensure_ascii=False)
temp=combine_json_results([update_json_str])
evaluation_combined_res = json.dumps(temp,ensure_ascii=False,indent=4)
print("商务标技术标done")
return evaluation_combined_res
if __name__ == "__main__":
truncate2="C:\\Users\\Administrator\\Desktop\\招标文件\\output\\zbfile_evaluation_method.pdf"
res=combine_evaluation_standards(truncate2)
print(res)