From a3a42d25d3c40f53a15cf788c50624b81b152312 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 7 Mar 2024 16:19:42 +1100 Subject: [PATCH] fix(mm): model images reload when changed When we change a model image, its URL remains the same. The browser will aggressively cache the image. The easiest way to fix this is to append a random query parameter to the URL whenever we build a model config in the API. --- .../app/services/model_images/model_images_default.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/invokeai/app/services/model_images/model_images_default.py b/invokeai/app/services/model_images/model_images_default.py index 1100e5ced8..7488398978 100644 --- a/invokeai/app/services/model_images/model_images_default.py +++ b/invokeai/app/services/model_images/model_images_default.py @@ -5,6 +5,7 @@ from PIL.Image import Image as PILImageType from send2trash import send2trash from invokeai.app.services.invoker import Invoker +from invokeai.app.util.misc import uuid_string from invokeai.app.util.thumbnails import make_thumbnail from .model_images_base import ModelImageFileStorageBase @@ -56,7 +57,12 @@ class ModelImageFileStorageDisk(ModelImageFileStorageBase): if not self._validate_path(path): return - return self._invoker.services.urls.get_model_image_url(model_key) + url = self._invoker.services.urls.get_model_image_url(model_key) + + # The image file + url += f"?{uuid_string()}" + + return url def delete(self, model_key: str) -> None: try: