Update tab_timeline_wip.py
This commit is contained in:
@@ -12,7 +12,7 @@ def render_timeline_wip(data, file_path):
|
|||||||
|
|
||||||
htree = HistoryTree(tree_data)
|
htree = HistoryTree(tree_data)
|
||||||
|
|
||||||
# --- 1. BUILD GRAPH DATA ---
|
# --- 1. BUILD GRAPH ---
|
||||||
nodes = []
|
nodes = []
|
||||||
edges = []
|
edges = []
|
||||||
|
|
||||||
@@ -21,18 +21,15 @@ def render_timeline_wip(data, file_path):
|
|||||||
for n in sorted_nodes:
|
for n in sorted_nodes:
|
||||||
nid = n["id"]
|
nid = n["id"]
|
||||||
note = n.get('note', 'Step')
|
note = n.get('note', 'Step')
|
||||||
# Visual styling
|
|
||||||
short_note = (note[:15] + '..') if len(note) > 15 else note
|
short_note = (note[:15] + '..') if len(note) > 15 else note
|
||||||
|
|
||||||
color = "#ffffff"
|
color = "#ffffff"
|
||||||
border = "#666666"
|
border = "#666666"
|
||||||
|
|
||||||
# Highlight Current Head
|
|
||||||
if nid == htree.head_id:
|
if nid == htree.head_id:
|
||||||
color = "#fff6cd"
|
color = "#fff6cd"
|
||||||
border = "#eebb00"
|
border = "#eebb00"
|
||||||
|
|
||||||
# Highlight Branch Tips
|
|
||||||
if nid in htree.branches.values():
|
if nid in htree.branches.values():
|
||||||
if color == "#ffffff":
|
if color == "#ffffff":
|
||||||
color = "#e6ffe6"
|
color = "#e6ffe6"
|
||||||
@@ -57,12 +54,11 @@ def render_timeline_wip(data, file_path):
|
|||||||
type="STRAIGHT"
|
type="STRAIGHT"
|
||||||
))
|
))
|
||||||
|
|
||||||
# --- 2. CONFIGURATION ---
|
|
||||||
config = Config(
|
config = Config(
|
||||||
width="100%",
|
width="100%",
|
||||||
height="400px",
|
height="400px",
|
||||||
directed=True,
|
directed=True,
|
||||||
physics=False, # Keep false for stability
|
physics=False,
|
||||||
hierarchical=True,
|
hierarchical=True,
|
||||||
layout={
|
layout={
|
||||||
"hierarchical": {
|
"hierarchical": {
|
||||||
@@ -79,14 +75,13 @@ def render_timeline_wip(data, file_path):
|
|||||||
st.subheader("✨ Interactive Timeline")
|
st.subheader("✨ Interactive Timeline")
|
||||||
st.caption("Click a node to view its settings below.")
|
st.caption("Click a node to view its settings below.")
|
||||||
|
|
||||||
# --- 3. RENDER GRAPH ---
|
# Render Graph
|
||||||
# KEY FIX: Adding a unique key ensures Streamlit tracks clicks correctly
|
|
||||||
selected_id = agraph(nodes=nodes, edges=edges, config=config)
|
selected_id = agraph(nodes=nodes, edges=edges, config=config)
|
||||||
|
|
||||||
st.markdown("---")
|
st.markdown("---")
|
||||||
|
|
||||||
# --- 4. DETERMINE TARGET NODE ---
|
# --- 2. DETERMINE TARGET ---
|
||||||
# If nothing is clicked, default to the current HEAD
|
# Default to HEAD if nothing clicked
|
||||||
target_node_id = selected_id if selected_id else htree.head_id
|
target_node_id = selected_id if selected_id else htree.head_id
|
||||||
|
|
||||||
if target_node_id and target_node_id in htree.nodes:
|
if target_node_id and target_node_id in htree.nodes:
|
||||||
@@ -100,8 +95,8 @@ def render_timeline_wip(data, file_path):
|
|||||||
|
|
||||||
# Restore Button
|
# Restore Button
|
||||||
with c_h2:
|
with c_h2:
|
||||||
st.write("")
|
st.write(""); st.write("")
|
||||||
if st.button("⏪ Restore This Version", type="primary", use_container_width=True):
|
if st.button("⏪ Restore This Version", type="primary", use_container_width=True, key=f"rst_{target_node_id}"):
|
||||||
data.update(node_data)
|
data.update(node_data)
|
||||||
htree.head_id = target_node_id
|
htree.head_id = target_node_id
|
||||||
|
|
||||||
@@ -115,52 +110,52 @@ def render_timeline_wip(data, file_path):
|
|||||||
st.toast(f"Restored {target_node_id}!", icon="🔄")
|
st.toast(f"Restored {target_node_id}!", icon="🔄")
|
||||||
st.rerun()
|
st.rerun()
|
||||||
|
|
||||||
# --- 5. PREVIEW PANELS (READ ONLY) ---
|
# --- 3. PREVIEW PANELS (DYNAMIC KEYS FIX) ---
|
||||||
|
# We append target_node_id to every key to force a hard refresh
|
||||||
|
|
||||||
# A. Prompts
|
# A. Prompts
|
||||||
p_col1, p_col2 = st.columns(2)
|
p_col1, p_col2 = st.columns(2)
|
||||||
with p_col1:
|
with p_col1:
|
||||||
val_gp = node_data.get("general_prompt", "")
|
val_gp = node_data.get("general_prompt", "")
|
||||||
st.text_area("General Positive", value=val_gp, height=80, disabled=True, key="p_gp")
|
st.text_area("General Positive", value=val_gp, height=80, disabled=True, key=f"p_gp_{target_node_id}")
|
||||||
|
|
||||||
val_sp = node_data.get("current_prompt", "") or node_data.get("prompt", "")
|
val_sp = node_data.get("current_prompt", "") or node_data.get("prompt", "")
|
||||||
st.text_area("Specific Positive", value=val_sp, height=80, disabled=True, key="p_sp")
|
st.text_area("Specific Positive", value=val_sp, height=80, disabled=True, key=f"p_sp_{target_node_id}")
|
||||||
|
|
||||||
with p_col2:
|
with p_col2:
|
||||||
val_gn = node_data.get("general_negative", "")
|
val_gn = node_data.get("general_negative", "")
|
||||||
st.text_area("General Negative", value=val_gn, height=80, disabled=True, key="p_gn")
|
st.text_area("General Negative", value=val_gn, height=80, disabled=True, key=f"p_gn_{target_node_id}")
|
||||||
|
|
||||||
val_sn = node_data.get("negative", "")
|
val_sn = node_data.get("negative", "")
|
||||||
st.text_area("Specific Negative", value=val_sn, height=80, disabled=True, key="p_sn")
|
st.text_area("Specific Negative", value=val_sn, height=80, disabled=True, key=f"p_sn_{target_node_id}")
|
||||||
|
|
||||||
# B. Key Settings
|
# B. Key Settings
|
||||||
st.caption("⚙️ Core Settings")
|
st.caption("⚙️ Core Settings")
|
||||||
s_col1, s_col2, s_col3 = st.columns(3)
|
s_col1, s_col2, s_col3 = st.columns(3)
|
||||||
s_col1.text_input("Camera", value=str(node_data.get("camera", "static")), disabled=True, key="p_cam")
|
s_col1.text_input("Camera", value=str(node_data.get("camera", "static")), disabled=True, key=f"p_cam_{target_node_id}")
|
||||||
s_col2.text_input("FLF", value=str(node_data.get("flf", "0.0")), disabled=True, key="p_flf")
|
s_col2.text_input("FLF", value=str(node_data.get("flf", "0.0")), disabled=True, key=f"p_flf_{target_node_id}")
|
||||||
s_col3.text_input("Seed", value=str(node_data.get("seed", "-1")), disabled=True, key="p_seed")
|
s_col3.text_input("Seed", value=str(node_data.get("seed", "-1")), disabled=True, key=f"p_seed_{target_node_id}")
|
||||||
|
|
||||||
# C. LoRAs
|
# C. LoRAs
|
||||||
with st.expander("💊 LoRA Configuration", expanded=False):
|
with st.expander("💊 LoRA Configuration", expanded=False):
|
||||||
l1, l2, l3 = st.columns(3)
|
l1, l2, l3 = st.columns(3)
|
||||||
with l1:
|
with l1:
|
||||||
st.text_input("LoRA 1 Name", value=node_data.get("lora 1 high", ""), disabled=True, key="p_l1h")
|
st.text_input("LoRA 1 Name", value=node_data.get("lora 1 high", ""), disabled=True, key=f"p_l1h_{target_node_id}")
|
||||||
st.text_input("LoRA 1 Str", value=str(node_data.get("lora 1 low", "")), disabled=True, key="p_l1l")
|
st.text_input("LoRA 1 Str", value=str(node_data.get("lora 1 low", "")), disabled=True, key=f"p_l1l_{target_node_id}")
|
||||||
with l2:
|
with l2:
|
||||||
st.text_input("LoRA 2 Name", value=node_data.get("lora 2 high", ""), disabled=True, key="p_l2h")
|
st.text_input("LoRA 2 Name", value=node_data.get("lora 2 high", ""), disabled=True, key=f"p_l2h_{target_node_id}")
|
||||||
st.text_input("LoRA 2 Str", value=str(node_data.get("lora 2 low", "")), disabled=True, key="p_l2l")
|
st.text_input("LoRA 2 Str", value=str(node_data.get("lora 2 low", "")), disabled=True, key=f"p_l2l_{target_node_id}")
|
||||||
with l3:
|
with l3:
|
||||||
st.text_input("LoRA 3 Name", value=node_data.get("lora 3 high", ""), disabled=True, key="p_l3h")
|
st.text_input("LoRA 3 Name", value=node_data.get("lora 3 high", ""), disabled=True, key=f"p_l3h_{target_node_id}")
|
||||||
st.text_input("LoRA 3 Str", value=str(node_data.get("lora 3 low", "")), disabled=True, key="p_l3l")
|
st.text_input("LoRA 3 Str", value=str(node_data.get("lora 3 low", "")), disabled=True, key=f"p_l3l_{target_node_id}")
|
||||||
|
|
||||||
# D. VACE / I2V Specifics
|
# D. VACE / I2V Specifics
|
||||||
# Check if any VACE keys exist in this history node
|
|
||||||
vace_keys = ["frame_to_skip", "vace schedule", "video file path"]
|
vace_keys = ["frame_to_skip", "vace schedule", "video file path"]
|
||||||
has_vace = any(k in node_data for k in vace_keys)
|
has_vace = any(k in node_data for k in vace_keys)
|
||||||
|
|
||||||
if has_vace:
|
if has_vace:
|
||||||
with st.expander("🎞️ VACE / I2V Settings", expanded=True):
|
with st.expander("🎞️ VACE / I2V Settings", expanded=True):
|
||||||
v1, v2, v3 = st.columns(3)
|
v1, v2, v3 = st.columns(3)
|
||||||
v1.text_input("Skip Frames", value=str(node_data.get("frame_to_skip", "")), disabled=True, key="p_fts")
|
v1.text_input("Skip Frames", value=str(node_data.get("frame_to_skip", "")), disabled=True, key=f"p_fts_{target_node_id}")
|
||||||
v2.text_input("Schedule", value=str(node_data.get("vace schedule", "")), disabled=True, key="p_vsc")
|
v2.text_input("Schedule", value=str(node_data.get("vace schedule", "")), disabled=True, key=f"p_vsc_{target_node_id}")
|
||||||
v3.text_input("Video Path", value=str(node_data.get("video file path", "")), disabled=True, key="p_vid")
|
v3.text_input("Video Path", value=str(node_data.get("video file path", "")), disabled=True, key=f"p_vid_{target_node_id}")
|
||||||
|
|||||||
Reference in New Issue
Block a user