From 649c012ecf308a994ea180127f7f8f94d0aec311 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 6 Sep 2026 17:53:02 -0400 Subject: [PATCH] refac --- backend/open_webui/utils/models.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/models.py b/backend/open_webui/utils/models.py index 4e1559200a..1022fccffa 100644 --- a/backend/open_webui/utils/models.py +++ b/backend/open_webui/utils/models.py @@ -438,7 +438,14 @@ async def get_all_models(request, refresh: bool = False, user: UserModel = None) log.debug('get_all_models() returned %s models', len(models)) - models_dict = {model['id']: model for model in models} + models_dict = {} + for model in models: + model = model.copy() + if model.get('ollama'): + # Keep the moving expiry in the API response, outside the registry signature. + model['ollama'] = model['ollama'].copy() + model['ollama'].pop('expires_at', None) + models_dict[model['id']] = model if isinstance(request.app.state.MODELS, RedisDict): try: request.app.state.MODELS.set(models_dict)