refac
This commit is contained in:
@@ -283,11 +283,15 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None)
|
||||
# Pre-warm the function module cache once per unique function ID.
|
||||
# This ensures each function's DB freshness check runs exactly once,
|
||||
# not once per (model × function) pair.
|
||||
for function_id in all_function_ids:
|
||||
# Only attempt to load functions that actually exist in the local DB;
|
||||
# imported/custom model configs may reference tools or filters the user
|
||||
# hasn't installed, and trying to load those would cause persistent
|
||||
# "Failed to load function module" log spam on every model refresh.
|
||||
for function_id in functions_by_id:
|
||||
try:
|
||||
await get_function_module_from_cache(request, function_id)
|
||||
except Exception as e:
|
||||
log.info(f'Failed to load function module for {function_id}: {e}')
|
||||
log.debug(f'Failed to load function module for {function_id}: {e}')
|
||||
|
||||
# Apply global model defaults to all models
|
||||
# Per-model overrides take precedence over global defaults
|
||||
|
||||
Reference in New Issue
Block a user