mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-12 23:02:35 +00:00
refac
This commit is contained in:
parent
de1203f9b5
commit
649c012ecf
1 changed files with 8 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue