feat: debug system for prompt execution (Issue #28)
- Backend: debug mode in prompt_executor with placeholder tracking - Backend: show resolved/unresolved placeholders, final prompts, AI responses - Frontend: test button in UnifiedPromptModal for saved prompts - Frontend: debug output viewer with JSON preview - Frontend: wider placeholder example fields in PlaceholderPicker Resolves pipeline execution debugging issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ba03c2a94
commit
7f2ba4fbad
4 files changed
+211
-33
No files matched your search
@@ -40,6 +40,11 @@ export default function UnifiedPromptModal({ prompt, onSave, onClose }) {
|
||||
const [showPlaceholderPicker, setShowPlaceholderPicker] = useState(false)
|
||||
const [pickerTarget, setPickerTarget] = useState(null) // 'base' or {stage, promptIdx}
|
||||
|
||||
// Test functionality
|
||||
const [testing, setTesting] = useState(false)
|
||||
const [testResult, setTestResult] = useState(null)
|
||||
const [showDebug, setShowDebug] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
loadAvailablePrompts()
|
||||
|
||||
@@ -231,6 +236,28 @@ export default function UnifiedPromptModal({ prompt, onSave, onClose }) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleTest = async () => {
|
||||
// Can only test existing prompts (need slug in database)
|
||||
if (!prompt?.slug) {
|
||||
setError('Bitte erst speichern, dann testen')
|
||||
return
|
||||
}
|
||||
|
||||
setTesting(true)
|
||||
setError(null)
|
||||
setTestResult(null)
|
||||
|
||||
try {
|
||||
const result = await api.executeUnifiedPrompt(prompt.slug, null, null, true)
|
||||
setTestResult(result)
|
||||
setShowDebug(true)
|
||||
} catch (e) {
|
||||
setError('Test-Fehler: ' + e.message)
|
||||
} finally {
|
||||
setTesting(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)',
|
||||
@@ -567,21 +594,79 @@ export default function UnifiedPromptModal({ prompt, onSave, onClose }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Debug Output */}
|
||||
{showDebug && testResult && (
|
||||
<div style={{
|
||||
marginTop: 16,
|
||||
padding: 16,
|
||||
background: 'var(--surface2)',
|
||||
borderRadius: 8,
|
||||
border: '1px solid var(--border)'
|
||||
}}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
marginBottom: 12
|
||||
}}>
|
||||
<h3 style={{ margin: 0, fontSize: 14, fontWeight: 600 }}>
|
||||
🔬 Debug-Info
|
||||
</h3>
|
||||
<button
|
||||
onClick={() => setShowDebug(false)}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 4 }}
|
||||
>
|
||||
<X size={16} color="var(--text3)" />
|
||||
</button>
|
||||
</div>
|
||||
<pre style={{
|
||||
fontSize: 11,
|
||||
fontFamily: 'monospace',
|
||||
background: 'var(--bg)',
|
||||
padding: 12,
|
||||
borderRadius: 6,
|
||||
overflow: 'auto',
|
||||
maxHeight: 400,
|
||||
lineHeight: 1.5,
|
||||
color: 'var(--text2)'
|
||||
}}>
|
||||
{JSON.stringify(testResult.debug || testResult, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Actions */}
|
||||
<div style={{
|
||||
display: 'flex', gap: 12, justifyContent: 'flex-end',
|
||||
display: 'flex', gap: 12, justifyContent: 'space-between',
|
||||
paddingTop: 16, borderTop: '1px solid var(--border)'
|
||||
}}>
|
||||
<button className="btn" onClick={onClose}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleSave}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? 'Speichern...' : 'Speichern'}
|
||||
</button>
|
||||
<div>
|
||||
{prompt?.slug && (
|
||||
<button
|
||||
className="btn"
|
||||
onClick={handleTest}
|
||||
disabled={testing || loading}
|
||||
style={{
|
||||
background: testing ? 'var(--surface)' : 'var(--accent)',
|
||||
color: testing ? 'var(--text3)' : 'white'
|
||||
}}
|
||||
>
|
||||
{testing ? '🔬 Teste...' : '🔬 Test ausführen'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 12 }}>
|
||||
<button className="btn" onClick={onClose}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={handleSave}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? 'Speichern...' : 'Speichern'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user