|
@@ -345,6 +345,7 @@ def update_chat_history_simple(user_message):
|
|
|
|
|
|
@app.route('/closeMsg', methods=['DELETE'])
|
|
|
def delMsg():
|
|
|
+ global chat_history
|
|
|
chat_history = ""
|
|
|
return jsonify({"msg": "清除成功",
|
|
|
"code": 200,
|
|
@@ -495,14 +496,21 @@ def jsonResToDict(json_res):
|
|
|
}
|
|
|
input_factors[factor_info["id"]] = factor_info
|
|
|
# 循环遍历模板
|
|
|
+ # 记录已经添加的因子 ID
|
|
|
+ added_factor_ids = set()
|
|
|
+
|
|
|
+ # 首先处理模板
|
|
|
for factorTemplate in factorTemplates:
|
|
|
factorId = factorTemplate["id"]
|
|
|
- if factorId in input_factors:
|
|
|
- res["yxyz"].append(input_factors[factorId])
|
|
|
- else:
|
|
|
- factorTemplate["conditionInfo"] = json.loads(
|
|
|
- factorTemplate["conditionInfo"])
|
|
|
- res["yxyz"].append(factorTemplate)
|
|
|
+ factorTemplate["conditionInfo"] = json.loads(factorTemplate["conditionInfo"])
|
|
|
+ res["yxyz"].append(factorTemplate)
|
|
|
+ added_factor_ids.add(factorId) # 记录已添加的因子 ID
|
|
|
+
|
|
|
+ # 然后检查 input_factors 并添加未在模板中的因子
|
|
|
+ for factor_id, factor_info in input_factors.items():
|
|
|
+ if factor_id not in added_factor_ids:
|
|
|
+ res["yxyz"].append(factor_info)
|
|
|
+
|
|
|
resObj = {}
|
|
|
resObj["data"] = res
|
|
|
resObj["code"] = 200
|