diff --git a/frontend/src/pages/Analysis.jsx b/frontend/src/pages/Analysis.jsx index 10c0f07..38e3896 100644 --- a/frontend/src/pages/Analysis.jsx +++ b/frontend/src/pages/Analysis.jsx @@ -153,7 +153,37 @@ export default function Analysis() { content = typeof result.output === 'string' ? result.output : JSON.stringify(result.output, null, 2) } - setNewResult({ scope: slug, content }) + // Build metadata from debug info (same logic as backend) + let metadata = null + if (result.debug && result.debug.resolved_placeholders) { + const placeholders = {} + const resolved = result.debug.resolved_placeholders + + // For pipeline, collect from all stages + if (result.type === 'pipeline' && result.debug.stages) { + for (const stage of result.debug.stages) { + for (const promptDebug of (stage.prompts || [])) { + const stageResolved = promptDebug.resolved_placeholders || promptDebug.ref_debug?.resolved_placeholders || {} + for (const [key, value] of Object.entries(stageResolved)) { + if (!placeholders[key]) { + placeholders[key] = { value, description: '' } + } + } + } + } + } else { + // For base prompts + for (const [key, value] of Object.entries(resolved)) { + placeholders[key] = { value, description: '' } + } + } + + if (Object.keys(placeholders).length > 0) { + metadata = { prompt_type: result.type, placeholders } + } + } + + setNewResult({ scope: slug, content, metadata }) await loadAll() setTab('run') } catch(e) {