mirror of
https://github.com/lanqian528/chat2api.git
synced 2026-06-13 21:02:46 +08:00
Merge pull request #170 from YJL626/patch-2
Catch the file format error and add a default value.
This commit is contained in:
commit
ce85014a92
@ -71,7 +71,10 @@ else:
|
||||
|
||||
if os.path.exists(USER_AGENTS_FILE):
|
||||
with open(USER_AGENTS_FILE, "r", encoding="utf-8") as f:
|
||||
user_agent_map = json.load(f)
|
||||
try:
|
||||
user_agent_map = json.load(file)
|
||||
except json.JSONDecodeError:
|
||||
user_agent_map = {}
|
||||
# token数量变化时,更新ua
|
||||
if len(user_agent_map.keys()) != len(token_list):
|
||||
new_tokens = list(set(token_list) - user_agent_map.keys())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user