@@ -382,7 +382,7 @@ def detect_converted_mark(userinput): # deprecated
382382 return True
383383 else :
384384 return False
385- except :
385+ except Exception :
386386 return True
387387
388388
@@ -569,7 +569,7 @@ def filter_history(user_name, keyword):
569569 try :
570570 history_names = [name for name in history_names if re .search (keyword , name , timeout = 0.01 )]
571571 return gr .update (choices = history_names )
572- except :
572+ except Exception :
573573 return gr .update (choices = history_names )
574574
575575
@@ -615,7 +615,7 @@ def get_template_content(templates, selection, original_system_prompt):
615615 logging .debug (f"应用模板中,选择为{ selection } ,原始系统提示为{ original_system_prompt } " )
616616 try :
617617 return templates [selection ]
618- except :
618+ except Exception :
619619 return original_system_prompt
620620
621621
@@ -691,7 +691,7 @@ def fetch_ip():
691691 with retrieve_proxy ():
692692 response = requests .get ("https://ipapi.co/json/" , timeout = 5 )
693693 data = response .json ()
694- except :
694+ except Exception :
695695 data = {"error" : True , "reason" : "连接ipapi失败" }
696696 if "error" in data .keys ():
697697 # logging.warning(f"无法获取IP地址信息。\n{data}")
@@ -903,7 +903,7 @@ def beautify_err_msg(err_msg):
903903 return i18n ("请查看 config_example.json,配置 Azure OpenAI" )
904904 try :
905905 err_msg = json .loads (err_msg )["error" ]["message" ]
906- except :
906+ except Exception :
907907 pass
908908 return err_msg
909909
@@ -1069,7 +1069,7 @@ def set(self, config_items: List[ConfigItem], prompt: str):
10691069 print (generate_result_string (config_item , config_value ))
10701070 try :
10711071 self .config [config_item .key ] = int (config_value )
1072- except :
1072+ except Exception :
10731073 print ("输入的不是数字,将使用默认值。" )
10741074 elif config_item .type == ConfigType .ListOfStrings :
10751075 # read one string at a time
@@ -1511,42 +1511,42 @@ def setPlaceholder(model_name: str | None = "", model: BaseLLMModel | None = Non
15111511 if model is None :
15121512 try :
15131513 model_logo = MODEL_METADATA [model_name ]["placeholder" ]["logo" ]
1514- except :
1514+ except Exception :
15151515 logo_class = "hideK"
15161516 try :
15171517 model_logo_round = MODEL_METADATA [model_name ]["placeholder" ]["logo_rounded" ]
1518- except :
1518+ except Exception :
15191519 pass
15201520 try :
15211521 model_slogan = i18n (MODEL_METADATA [model_name ]["placeholder" ]["slogan" ])
1522- except :
1522+ except Exception :
15231523 slogan_class = "hideK"
15241524 try :
15251525 model_question_1 = i18n (MODEL_METADATA [model_name ]["placeholder" ]["question_1" ])
15261526 model_question_2 = i18n (MODEL_METADATA [model_name ]["placeholder" ]["question_2" ])
15271527 model_question_3 = i18n (MODEL_METADATA [model_name ]["placeholder" ]["question_3" ])
15281528 model_question_4 = i18n (MODEL_METADATA [model_name ]["placeholder" ]["question_4" ])
1529- except :
1529+ except Exception :
15301530 question_class = "hideK"
15311531 else :
15321532 try :
15331533 model_logo = model .placeholder ["logo" ]
1534- except :
1534+ except Exception :
15351535 logo_class = "hideK"
15361536 try :
15371537 model_logo_round = model .placeholder ["logo_rounded" ]
1538- except :
1538+ except Exception :
15391539 pass
15401540 try :
15411541 model_slogan = i18n (model .placeholder ["slogan" ])
1542- except :
1542+ except Exception :
15431543 slogan_class = "hideK"
15441544 try :
15451545 model_question_1 = i18n (model .placeholder ["question_1" ])
15461546 model_question_2 = i18n (model .placeholder ["question_2" ])
15471547 model_question_3 = i18n (model .placeholder ["question_3" ])
15481548 model_question_4 = i18n (model .placeholder ["question_4" ])
1549- except :
1549+ except Exception :
15501550 question_class = "hideK"
15511551
15521552 if logo_class == "hideK" and slogan_class == "hideK" and question_class == "hideK" :
0 commit comments