MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / load_excluded_models

Function load_excluded_models

browser_utils/models/switcher.py:213–240  ·  view source on GitHub ↗

Load excluded model list

(filename: str)

Source from the content-addressed store, hash-verified

211
212
213def load_excluded_models(filename: str):
214 """Load excluded model list"""
215 from api_utils.server_state import state
216
217 excluded_model_ids = getattr(state, "excluded_model_ids", set())
218 excluded_file_path = os.path.join(os.path.dirname(__file__), "..", "..", filename)
219 try:
220 if os.path.exists(excluded_file_path):
221 with open(excluded_file_path, "r", encoding="utf-8") as f:
222 loaded_ids = {line.strip() for line in f if line.strip()}
223 if loaded_ids:
224 excluded_model_ids.update(loaded_ids)
225 state.excluded_model_ids = excluded_model_ids
226 logger.debug(
227 f"Loaded {len(loaded_ids)} models from '{filename}' into exclusion list"
228 )
229 else:
230 logger.debug(
231 f"'{filename}' file is empty or contains no valid model IDs, exclusion list unchanged."
232 )
233 else:
234 logger.debug(
235 f"Model exclusion list file '{filename}' not found, list is empty."
236 )
237 except Exception as e:
238 logger.error(
239 f"Error loading excluded models from '{filename}': {e}", exc_info=True
240 )

Calls 3

updateMethod · 0.80
debugMethod · 0.80
errorMethod · 0.80