|
@@ -462,12 +462,13 @@ def find_key_recursively(data, target_key):
|
|
|
_search(data)
|
|
|
return results
|
|
|
# query = "当月省间交易完成的交易是多少?"
|
|
|
+query = "2023年累计省间交易电量是多少??"
|
|
|
# query = "2024年1月到2月累计交易电量是多少?"
|
|
|
-query = "2024年12月交易电量是多少?"
|
|
|
-# query = "但同样阿贾克斯大口径的话我可合金外壳设计文件突然发?"
|
|
|
+# query = "2024年12月交易电量是多少?"
|
|
|
+# # query = "但同样阿贾克斯大口径的话我可合金外壳设计文件突然发?"
|
|
|
json_folder = "templatesJson"
|
|
|
-
|
|
|
-
|
|
|
+#
|
|
|
+#
|
|
|
result = process_query(query, template_dict, json_folder)
|
|
|
|
|
|
print("匹配的模板 key:", result["matched_key"])
|
|
@@ -481,24 +482,24 @@ print("条件", result["conditions"])
|
|
|
print("返回的内容是:", result["content"])
|
|
|
print("问句是:", result["query"])
|
|
|
print("动作是:", result["play"])
|
|
|
-
|
|
|
-type = result["type"]
|
|
|
-content = result["content"]
|
|
|
-
|
|
|
-json_data_folder = "..\Json\json_data"
|
|
|
-if type == "query":
|
|
|
- fileName = result["dataJsonName"]
|
|
|
- result = smart_find_value(json_data_folder, fileName,result["conditions"],result["target"] )
|
|
|
- print(result)
|
|
|
-elif type == "calculate":
|
|
|
- conditions = result["conditions"]
|
|
|
- start_conditions = {('年' if 'year' in k else '月'): v for k, v in conditions.items() if k.startswith('start_')}
|
|
|
- end_conditions = {('年' if 'year' in k else '月'): v for k, v in conditions.items() if k.startswith('end_')}
|
|
|
- print(start_conditions)
|
|
|
- print(end_conditions)
|
|
|
- fileName = result["dataJsonName"] + ".json"
|
|
|
- result = calculate_sum_by_time_range(json_data_folder,fileName,result["target"],start_conditions, end_conditions)
|
|
|
- print(result)
|
|
|
+#
|
|
|
+# type = result["type"]
|
|
|
+# content = result["content"]
|
|
|
+#
|
|
|
+# json_data_folder = "..\Json\json_data"
|
|
|
+# if type == "query":
|
|
|
+# fileName = result["dataJsonName"]
|
|
|
+# result = smart_find_value(json_data_folder, fileName,result["conditions"],result["target"] )
|
|
|
+# print(result)
|
|
|
+# elif type == "calculate":
|
|
|
+# conditions = result["conditions"]
|
|
|
+# start_conditions = {('年' if 'year' in k else '月'): v for k, v in conditions.items() if k.startswith('start_')}
|
|
|
+# end_conditions = {('年' if 'year' in k else '月'): v for k, v in conditions.items() if k.startswith('end_')}
|
|
|
+# print(start_conditions)
|
|
|
+# print(end_conditions)
|
|
|
+# fileName = result["dataJsonName"] + ".json"
|
|
|
+# result = calculate_sum_by_time_range(json_data_folder,fileName,result["target"],start_conditions, end_conditions)
|
|
|
+# print(result)
|
|
|
#
|
|
|
# # 最终回答的文本
|
|
|
# final_content = content.replace("?", str(result))
|