diff --git a/server.py b/server.py index 37994b1..0363573 100644 --- a/server.py +++ b/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") - # 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 = "" - 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) - if has_input or has_output: - media_html = '
' - if has_input: - input_hash = run.inputs[0] + if available_inputs or has_output: + # Flexible grid - more columns for more items + num_items = len(available_inputs) + (1 if has_output else 0) + grid_cols = min(num_items, 3) # Max 3 columns + media_html = f'
' + + for idx, input_hash in enumerate(available_inputs): input_media_type = detect_media_type(get_cache_path(input_hash)) input_video_src = video_src_for_request(input_hash, request) if input_media_type == "video": @@ -1062,9 +1082,11 @@ async def run_detail(run_id: str, request: Request): input_elem = f'input' else: input_elem = '

Unknown format

' + # Get input name or fall back to "Input N" + input_name = input_names.get(input_hash, f"Input {idx + 1}") media_html += f'''
-
Input
+
{input_name}
{input_hash[:24]}...
{input_elem}
@@ -1088,8 +1110,11 @@ async def run_detail(run_id: str, request: Request): ''' media_html += '
' - # Build inputs list - inputs_html = ''.join([f'{inp}' for inp in run.inputs]) + # Build inputs list with names + inputs_html = ''.join([ + f'
{input_names.get(inp, f"Input {i+1}")}: {inp}
' + for i, inp in enumerate(run.inputs) + ]) # Infrastructure section infra_html = ""