perf: reduce prompt relay and audio ui overhead

This commit is contained in:
OpenClaw Agent
2026-07-09 19:48:24 +00:00
parent ab7d14bd89
commit b9c935466f
2 changed files with 62 additions and 53 deletions

View File

@@ -1,9 +1,12 @@
import logging
import types
import comfy.ldm.modules.attention
log = logging.getLogger(__name__)
import logging
import os
import types
import comfy.ldm.modules.attention
log = logging.getLogger(__name__)
_DEBUG_PROMPT_RELAY = os.environ.get("PROMPT_RELAY_DEBUG", "").strip().lower() in {"1", "true", "yes", "on"}
_DEBUG_LOG_PATH = os.path.join(os.path.dirname(__file__), "debug_prompt_relay.log")
def _masked_attention(q, k, v, heads, mask, transformer_options={}, **kwargs):
@@ -72,14 +75,14 @@ def _make_masked_override(prev_override):
return override
def debug_log(msg):
try:
import os
log_path = os.path.join(os.path.dirname(__file__), "debug_prompt_relay.log")
with open(log_path, "a", encoding="utf-8") as f:
f.write(msg + "\n")
except Exception:
pass
def debug_log(msg):
if not _DEBUG_PROMPT_RELAY:
return
try:
with open(_DEBUG_LOG_PATH, "a", encoding="utf-8") as f:
f.write(msg + "\n")
except Exception:
pass
def _make_ltx_mask_wrapper(underlying, mask_fn, attr):