Show all inputs with names on run detail page
Previously only displayed the first input. Now shows all inputs with their names from the recipe (variable_inputs and fixed_inputs). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
43
server.py
43
server.py
@@ -1045,15 +1045,35 @@ async def run_detail(run_id: str, request: Request):
|
|||||||
}
|
}
|
||||||
status_badge = status_colors.get(run.status, "bg-gray-600 text-white")
|
status_badge = status_colors.get(run.status, "bg-gray-600 text-white")
|
||||||
|
|
||||||
# Build media HTML for input/output
|
# Try to get input names from recipe
|
||||||
|
input_names = {}
|
||||||
|
recipe_name = run.recipe.replace("recipe:", "") if run.recipe.startswith("recipe:") else run.recipe
|
||||||
|
for recipe in list_all_recipes():
|
||||||
|
if recipe.name == recipe_name:
|
||||||
|
# Match variable inputs first, then fixed inputs
|
||||||
|
for i, var_input in enumerate(recipe.variable_inputs):
|
||||||
|
if i < len(run.inputs):
|
||||||
|
input_names[run.inputs[i]] = var_input.name
|
||||||
|
# Fixed inputs follow variable inputs
|
||||||
|
offset = len(recipe.variable_inputs)
|
||||||
|
for i, fixed_input in enumerate(recipe.fixed_inputs):
|
||||||
|
idx = offset + i
|
||||||
|
if idx < len(run.inputs):
|
||||||
|
input_names[run.inputs[idx]] = fixed_input.asset
|
||||||
|
break
|
||||||
|
|
||||||
|
# Build media HTML for inputs and output
|
||||||
media_html = ""
|
media_html = ""
|
||||||
has_input = run.inputs and cache_manager.has_content(run.inputs[0])
|
available_inputs = [inp for inp in run.inputs if cache_manager.has_content(inp)]
|
||||||
has_output = run.status == "completed" and run.output_hash and cache_manager.has_content(run.output_hash)
|
has_output = run.status == "completed" and run.output_hash and cache_manager.has_content(run.output_hash)
|
||||||
|
|
||||||
if has_input or has_output:
|
if available_inputs or has_output:
|
||||||
media_html = '<div class="grid gap-6 md:grid-cols-2 mb-8">'
|
# Flexible grid - more columns for more items
|
||||||
if has_input:
|
num_items = len(available_inputs) + (1 if has_output else 0)
|
||||||
input_hash = run.inputs[0]
|
grid_cols = min(num_items, 3) # Max 3 columns
|
||||||
|
media_html = f'<div class="grid gap-6 md:grid-cols-{grid_cols} mb-8">'
|
||||||
|
|
||||||
|
for idx, input_hash in enumerate(available_inputs):
|
||||||
input_media_type = detect_media_type(get_cache_path(input_hash))
|
input_media_type = detect_media_type(get_cache_path(input_hash))
|
||||||
input_video_src = video_src_for_request(input_hash, request)
|
input_video_src = video_src_for_request(input_hash, request)
|
||||||
if input_media_type == "video":
|
if input_media_type == "video":
|
||||||
@@ -1062,9 +1082,11 @@ async def run_detail(run_id: str, request: Request):
|
|||||||
input_elem = f'<img src="/cache/{input_hash}/raw" alt="input" class="max-w-full max-h-64 rounded-lg">'
|
input_elem = f'<img src="/cache/{input_hash}/raw" alt="input" class="max-w-full max-h-64 rounded-lg">'
|
||||||
else:
|
else:
|
||||||
input_elem = '<p class="text-gray-400">Unknown format</p>'
|
input_elem = '<p class="text-gray-400">Unknown format</p>'
|
||||||
|
# Get input name or fall back to "Input N"
|
||||||
|
input_name = input_names.get(input_hash, f"Input {idx + 1}")
|
||||||
media_html += f'''
|
media_html += f'''
|
||||||
<div class="bg-dark-600 rounded-lg p-4">
|
<div class="bg-dark-600 rounded-lg p-4">
|
||||||
<div class="text-sm text-gray-400 mb-2">Input</div>
|
<div class="text-sm text-gray-400 mb-2">{input_name}</div>
|
||||||
<a href="/cache/{input_hash}" class="text-blue-400 hover:text-blue-300 font-mono text-xs">{input_hash[:24]}...</a>
|
<a href="/cache/{input_hash}" class="text-blue-400 hover:text-blue-300 font-mono text-xs">{input_hash[:24]}...</a>
|
||||||
<div class="mt-3 flex justify-center">{input_elem}</div>
|
<div class="mt-3 flex justify-center">{input_elem}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1088,8 +1110,11 @@ async def run_detail(run_id: str, request: Request):
|
|||||||
'''
|
'''
|
||||||
media_html += '</div>'
|
media_html += '</div>'
|
||||||
|
|
||||||
# Build inputs list
|
# Build inputs list with names
|
||||||
inputs_html = ''.join([f'<a href="/cache/{inp}" class="text-blue-400 hover:text-blue-300 font-mono text-xs block">{inp}</a>' for inp in run.inputs])
|
inputs_html = ''.join([
|
||||||
|
f'<div class="flex gap-2 items-baseline"><span class="text-gray-400 text-xs">{input_names.get(inp, f"Input {i+1}")}:</span> <a href="/cache/{inp}" class="text-blue-400 hover:text-blue-300 font-mono text-xs">{inp}</a></div>'
|
||||||
|
for i, inp in enumerate(run.inputs)
|
||||||
|
])
|
||||||
|
|
||||||
# Infrastructure section
|
# Infrastructure section
|
||||||
infra_html = ""
|
infra_html = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user