fix: CRITICAL - Use question ID in placeholders, not type
Root Cause:
- Multiple questions with same type (e.g. "unsicherheit") created duplicate placeholders
- {{ node_4.signal_unsicherheit }} could refer to q21 OR q22
- Later signal overwrote earlier one in template context
Solution:
- Placeholders now use question ID: {{ node_4.signal_q21 }}
- Unique even with multiple questions of same type
Frontend PlaceholderPicker.jsx:
- Changed placeholder: signal_${questionType} → signal_${questionId}
- Changed placeholder: question_${questionType} → question_${questionId}
- Description shows both: "q21 (unsicherheit): Question text"
Backend workflow_executor.py:
- Build question_type → question_id mapping from graph
- Map normalized_signals (by type) to question IDs
- Handles duplicate types with index tracking
- Creates signal_${id} and question_${id} in template context
Example:
Questions configured:
- q21: type="unsicherheit", question="Ist Protein unsicher?"
- q22: type="unsicherheit", question="Ist Energie unsicher?"
Placeholders generated:
- {{ node_4.signal_q21 }} → "nein"
- {{ node_4.signal_q22 }} → "ja"
- {{ node_4.question_q21 }} → "Ist Protein unsicher?"
- {{ node_4.question_q22 }} → "Ist Energie unsicher?"
Issue: Duplicate question types cause placeholder conflicts
Version: 0.9p (workflow module)
Part 3: End Node Template Engine - CRITICAL FIX
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
f9c244bf48
commit
3b4902dc11
2 files changed
+51
-17
No files matched your search
@@ -376,21 +376,21 @@ function extractWorkflowPlaceholders(nodes) {
|
||||
if (node.type === 'analysis' && node.data.questions && node.data.questions.length > 0) {
|
||||
node.data.questions.forEach((q, qIdx) => {
|
||||
const questionId = q.id || `q${qIdx + 1}`
|
||||
const questionType = q.type || `q${qIdx + 1}`
|
||||
const questionType = q.type || 'unknown'
|
||||
const questionText = q.question || `Frage ${qIdx + 1}`
|
||||
|
||||
// Signal-Platzhalter (Antwort)
|
||||
// Signal-Platzhalter (Antwort) - VERWENDET ID für Eindeutigkeit!
|
||||
placeholders.push({
|
||||
placeholder: `{{ ${nodeId}.signal_${questionType} }}`,
|
||||
description: `${nodeLabel} (${questionId}) - Signal ${questionType}: ${questionText.substring(0, 40)}${questionText.length > 40 ? '...' : ''}`,
|
||||
placeholder: `{{ ${nodeId}.signal_${questionId} }}`,
|
||||
description: `${nodeLabel} - ${questionId} (${questionType}): ${questionText.substring(0, 45)}${questionText.length > 45 ? '...' : ''}`,
|
||||
icon: '📊',
|
||||
category: 'Workflow - Signals'
|
||||
})
|
||||
|
||||
// Frage-Text-Platzhalter
|
||||
placeholders.push({
|
||||
placeholder: `{{ ${nodeId}.question_${questionType} }}`,
|
||||
description: `${nodeLabel} (${questionId}) - Frage ${questionType}: ${questionText.substring(0, 40)}${questionText.length > 40 ? '...' : ''}`,
|
||||
placeholder: `{{ ${nodeId}.question_${questionId} }}`,
|
||||
description: `${nodeLabel} - ${questionId} (${questionType}): ${questionText.substring(0, 45)}${questionText.length > 45 ? '...' : ''}`,
|
||||
icon: '❓',
|
||||
category: 'Workflow - Questions'
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user