Browse Source

修复比较类问题find_max_or_min_value传参需传布尔类型

dujunlong 2 months ago
parent
commit
7baee790b5

BIN
final/ByRules/__pycache__/app.cpython-38.pyc


BIN
final/ByRules/__pycache__/similarity_answer_json.cpython-38.pyc


BIN
final/ByRules/__pycache__/util.cpython-38.pyc


+ 4 - 3
final/ByRules/app.py

@@ -12,8 +12,8 @@ app = Flask(__name__)
 
 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 TEMPLATE_FOLDER = os.path.join(BASE_DIR, "templatesJson")
-DATA_FOLDER = os.path.join(BASE_DIR, ".", "Json", "json_data")
-MAPPING_FILE = os.path.join(BASE_DIR,".", "Json", "省间关系映射.json")
+DATA_FOLDER = os.path.join(BASE_DIR, "..", "Json", "json_data")
+MAPPING_FILE = os.path.join(BASE_DIR,"..", "Json", "省间关系映射.json")
 
 
 @app.route('/process_query', methods=['POST'])
@@ -53,12 +53,13 @@ def process_query_route():
             return jsonify(response)
         # 比较类问题
         elif result['type'] == 'compare_max_min':
+            find_max = str(result['find_max']).lower() == 'true'
             final_value = find_max_or_min_value(folder_path=DATA_FOLDER, file_name=result["dataJsonName"],
                                                 value_key=result['value_key'],
                                                 name_key=result['name_key'],
                                                 mapping_file=MAPPING_FILE,
                                                 conditions=result["conditions"],
-                                                find_max=result['find_max'])
+                                                find_max=find_max)
             keys = [result['name_key'], result['value_key']]
             final_content = fill_template_auto(result['content'], final_value, keys)
             response = {