mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-05 19:12:41 +08:00
feat: add optional ui field to CacheValue
- Add ui field to CacheValue dataclass (default None)
- Pass ui when creating CacheValue for external providers
- Use result.ui (or default {}) when returning from external cache lookup
This allows external cache implementations to store/retrieve UI data
if desired, while remaining optional for implementations that skip it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
4afa80dc07
commit
0440ebcf6e
@ -56,10 +56,11 @@ class CacheValue:
|
|||||||
"""
|
"""
|
||||||
Value stored/retrieved from external cache.
|
Value stored/retrieved from external cache.
|
||||||
|
|
||||||
Note: UI data is intentionally excluded - it contains pod-local
|
The ui field is optional - implementations may choose to skip it
|
||||||
file paths that aren't portable across instances.
|
(e.g., if it contains non-portable data like local file paths).
|
||||||
"""
|
"""
|
||||||
outputs: list # The tensor/value outputs
|
outputs: list # The tensor/value outputs
|
||||||
|
ui: dict = None # Optional UI data (may be skipped by implementations)
|
||||||
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|||||||
@ -250,7 +250,7 @@ class BasicCache:
|
|||||||
cache_key=cache_key,
|
cache_key=cache_key,
|
||||||
cache_key_bytes=serialize_cache_key(cache_key)
|
cache_key_bytes=serialize_cache_key(cache_key)
|
||||||
)
|
)
|
||||||
cache_value = CacheValue(outputs=value.outputs)
|
cache_value = CacheValue(outputs=value.outputs, ui=value.ui)
|
||||||
|
|
||||||
for provider in get_cache_providers():
|
for provider in get_cache_providers():
|
||||||
try:
|
try:
|
||||||
@ -296,7 +296,7 @@ class BasicCache:
|
|||||||
continue
|
continue
|
||||||
# Import CacheEntry here to avoid circular import at module level
|
# Import CacheEntry here to avoid circular import at module level
|
||||||
from execution import CacheEntry
|
from execution import CacheEntry
|
||||||
return CacheEntry(ui={}, outputs=list(result.outputs))
|
return CacheEntry(ui=result.ui or {}, outputs=list(result.outputs))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Cache provider {provider.__class__.__name__} error on lookup: {e}")
|
logger.warning(f"Cache provider {provider.__class__.__name__} error on lookup: {e}")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user