prompt cache prevent clear on task change

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-09-15 12:29:14 +02:00
parent c038e2b21c
commit b7aa4b895a
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -1553,7 +1553,7 @@ def check_ui(ver):
return
t_start = time.time()
if not same(ver):
log.debug(f'Branch mismatch: {ver}')
log.debug(f'Branch mismatch: module=ModernUI {ver}')
try:
if 'dev' in ver['branch']:
target = 'dev'
@@ -1580,7 +1580,7 @@ def check_kanvas(ver):
return
t_start = time.time()
if not same(ver):
log.debug(f'Branch mismatch: {ver}')
log.debug(f'Branch mismatch: module=Kanvas {ver}')
try:
if 'dev' in ver['branch']:
target = 'dev'
+3 -2
View File
@@ -18,9 +18,10 @@ class PromptCache:
return val
def get(self, prompt, negative_prompt=None, cfg_enabled=None):
if self.id != id(shared.sd_model):
current_id = id(shared.sd_model.sd_checkpoint_info) if hasattr(shared.sd_model, 'sd_checkpoint_info') else id(shared.sd_model)
if self.id != current_id:
self.cache.clear()
self.id = id(shared.sd_model)
self.id = current_id
log.debug(f'Encode: prompt cache activate id={self.id} depth={len(self.cache)}')
negative_prompt = self._hashable(negative_prompt)
if (isinstance(prompt, list) and len(prompt) == 1 and isinstance(prompt[0], str)):