refac
This commit is contained in:
1 parent
50363ba66b
commit
2c7acb9285
1 file changed
+6
-2
@@ -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.
|
# Pre-warm the function module cache once per unique function ID.
|
||||||
# This ensures each function's DB freshness check runs exactly once,
|
# This ensures each function's DB freshness check runs exactly once,
|
||||||
# not once per (model × function) pair.
|
# 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:
|
try:
|
||||||
await get_function_module_from_cache(request, function_id)
|
await get_function_module_from_cache(request, function_id)
|
||||||
except Exception as e:
|
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
|
# Apply global model defaults to all models
|
||||||
# Per-model overrides take precedence over global defaults
|
# Per-model overrides take precedence over global defaults
|
||||||
|
|||||||
Reference in new issue
Block a user