Auto-detect output types (INT, FLOAT, STRING) on dynamic node refresh

API route now returns types alongside keys. JS sets output slot type
accordingly, giving correct colored dots and type-safe connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 16:11:30 +01:00
parent dfab5e12ab
commit f5e242950d
2 changed files with 22 additions and 6 deletions

View File

@@ -76,8 +76,20 @@ if PromptServer is not None:
seq = 1
data = read_json_data(json_path)
target = get_batch_item(data, seq)
keys = list(target.keys()) if isinstance(target, dict) else []
return web.json_response({"keys": keys})
keys = []
types = []
if isinstance(target, dict):
for k, v in target.items():
keys.append(k)
if isinstance(v, bool):
types.append("STRING")
elif isinstance(v, int):
types.append("INT")
elif isinstance(v, float):
types.append("FLOAT")
else:
types.append("STRING")
return web.json_response({"keys": keys, "types": types})
# ==========================================