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.
This commit is contained in:
psychedelicious 2024-03-07 16:19:42 +11:00
parent 8959d1bf51
commit a3a42d25d3

View File

@ -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: