fix(prompt): invalidate dynamic wildcard cache without seed (#895)

This commit is contained in:
Will Miao
2026-04-15 20:43:21 +08:00
parent b910388d54
commit 2640258902
5 changed files with 65 additions and 3 deletions

View File

@@ -3,7 +3,11 @@ from __future__ import annotations
from typing import Any
import inspect
from ..services.wildcard_service import get_wildcard_service, is_trigger_words_input
from ..services.wildcard_service import (
contains_dynamic_syntax,
get_wildcard_service,
is_trigger_words_input,
)
class _PromptOptionalInputs:
@@ -90,6 +94,19 @@ class PromptLM:
)
FUNCTION = "encode"
@classmethod
def IS_CHANGED(
cls,
text: str,
clip: Any | None = None,
seed: int | None = None,
**kwargs: Any,
):
del clip, kwargs
if contains_dynamic_syntax(text) and seed is None:
return float("NaN")
return False
def encode(
self,
text: str,

View File

@@ -1,6 +1,6 @@
from __future__ import annotations
from ..services.wildcard_service import get_wildcard_service
from ..services.wildcard_service import contains_dynamic_syntax, get_wildcard_service
class TextLM:
@@ -41,5 +41,11 @@ class TextLM:
OUTPUT_TOOLTIPS = ("The text output.",)
FUNCTION = "process"
@classmethod
def IS_CHANGED(cls, text: str, seed: int | None = None):
if contains_dynamic_syntax(text) and seed is None:
return float("NaN")
return False
def process(self, text: str, seed: int | None = None):
return (get_wildcard_service().expand_text(text, seed=seed),)