Flexibles KI Prompt System #48
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user