11.4
This commit is contained in:
parent
5f040b8725
commit
21351ddbe3
@ -241,7 +241,8 @@ def llm_call(question, knowledge_name,file_id, result_queue, ans_index, llm_type
|
|||||||
# assistant=create_assistant(knowledge_name)
|
# assistant=create_assistant(knowledge_name)
|
||||||
elif llm_type==2:
|
elif llm_type==2:
|
||||||
print(f"qianwen_long! question:{question}")
|
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)))
|
result_queue.put((ans_index,(question,qianwen_res)))
|
||||||
return
|
return
|
||||||
else :
|
else :
|
||||||
|
@ -44,6 +44,7 @@ def qianwen_long(file_id, user_query):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Return the response content
|
# Return the response content
|
||||||
|
# return completion.choices[0].message.content,completion.usage
|
||||||
return completion.choices[0].message.content
|
return completion.choices[0].message.content
|
||||||
|
|
||||||
def qianwen_long_text(file_id, user_query):
|
def qianwen_long_text(file_id, user_query):
|
||||||
|
@ -105,7 +105,7 @@ def get_technical_requirements(file_id):
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
res = qianwen_long(file_id, user_query1)
|
res = qianwen_long(file_id, user_query1)
|
||||||
print(res)
|
# print(res)
|
||||||
cleaned_res = clean_json_string(res) #转字典
|
cleaned_res = clean_json_string(res) #转字典
|
||||||
# print(res)
|
# print(res)
|
||||||
keys_list,good_list,no_keys_added= generate_key_paths(cleaned_res['采购需求']) # 提取需要采购的货物清单
|
keys_list,good_list,no_keys_added= generate_key_paths(cleaned_res['采购需求']) # 提取需要采购的货物清单
|
||||||
@ -116,7 +116,7 @@ def get_technical_requirements(file_id):
|
|||||||
else:
|
else:
|
||||||
# user_query_template = "请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,外层键名为\"{}\", 键值对中的键是你对该要求的总结,而值需要完全与原文保持一致,不可擅自总结删减。"
|
# user_query_template = "请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,外层键名为\"{}\", 键值对中的键是你对该要求的总结,而值需要完全与原文保持一致,不可擅自总结删减。"
|
||||||
user_query_template = """
|
user_query_template = """
|
||||||
请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,键名为\"{}\", 键值为一个列表,列表中包含若干描述\"{}\"的技术参数(或采购要求)的字符串。示例格式如下:
|
请你根据该货物标中采购要求部分的内容,请你给出\"{}\"的技术参数(或采购要求),请以json格式返回结果,键名为\"{}\", 键值为一个列表,列表中包含若干描述\"{}\"的技术参数(或采购要求)的字符串。示例输出格式如下:
|
||||||
{{
|
{{
|
||||||
"摄像机控制键盘": [
|
"摄像机控制键盘": [
|
||||||
"支持串行 RS232/RS422 和 IP 混合控制,允许在一个控制器上使用 RS232/RS422/IP 控制单个系统中的摄像机;",
|
"支持串行 RS232/RS422 和 IP 混合控制,允许在一个控制器上使用 RS232/RS422/IP 控制单个系统中的摄像机;",
|
||||||
@ -174,7 +174,7 @@ def test_all_files_in_folder(input_folder, output_folder):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# truncate_file="D:\\flask_project\\flask_app\\static\\output\\output1\\bf225a5e-16d0-45c8-8c19-54a1a94cf3e2\\ztbfile_procurement.docx"
|
# 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\\货物标\\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"
|
output_folder="C:\\Users\\Administrator\\Desktop\\货物标\\output1\\tmp"
|
||||||
file_id = upload_file(truncate_file)
|
file_id = upload_file(truncate_file)
|
||||||
res=get_technical_requirements(file_id)
|
res=get_technical_requirements(file_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user