diff --git a/backend/app/api/simulation.py b/backend/app/api/simulation.py index aae76788..0f215f1e 100644 --- a/backend/app/api/simulation.py +++ b/backend/app/api/simulation.py @@ -1002,7 +1002,7 @@ def get_simulation_history(): try: created_date = sim_dict.get("created_at", "")[:10] sim_dict["created_date"] = created_date - except: + except Exception: sim_dict["created_date"] = "" enriched_simulations.append(sim_dict) diff --git a/backend/app/services/oasis_profile_generator.py b/backend/app/services/oasis_profile_generator.py index de6ce6e3..405513a4 100644 --- a/backend/app/services/oasis_profile_generator.py +++ b/backend/app/services/oasis_profile_generator.py @@ -687,7 +687,7 @@ class OasisProfileGenerator: result = json.loads(json_str) result["_fixed"] = True return result - except: + except Exception: pass # 6. 尝试从内容中提取部分信息 diff --git a/backend/app/services/simulation_config_generator.py b/backend/app/services/simulation_config_generator.py index 2c6fbbf1..c1800bef 100644 --- a/backend/app/services/simulation_config_generator.py +++ b/backend/app/services/simulation_config_generator.py @@ -523,13 +523,13 @@ class SimulationConfigGenerator: try: return json.loads(json_str) - except: + except Exception: # 尝试移除所有控制字符 json_str = re.sub(r'[\x00-\x1f\x7f-\x9f]', ' ', json_str) json_str = re.sub(r'\s+', ' ', json_str) try: return json.loads(json_str) - except: + except Exception: pass return None