Refactor suggestion handling: move datalist creation into each input field for dynamic suggestion display, update metadata with expanded suggestions.

This commit is contained in:
2026-01-09 14:43:53 +00:00
parent 72b9df3a26
commit 149319a30a
2 changed files with 23 additions and 19 deletions

View File

@@ -32,7 +32,9 @@
"type": "text",
"default": "sdlc_context",
"suggestions": [
"sdlc_context"
"sdlc_context",
"project_info",
"full_context"
]
},
"output_key": {
@@ -40,7 +42,8 @@
"type": "text",
"default": "messages",
"suggestions": [
"messages"
"messages",
"prompt_history"
]
}
}
@@ -53,7 +56,8 @@
"type": "text",
"default": "messages",
"suggestions": [
"messages"
"messages",
"chat_history"
]
},
"output_key": {
@@ -61,7 +65,8 @@
"type": "text",
"default": "llm_response",
"suggestions": [
"llm_response"
"llm_response",
"ai_output"
]
}
}
@@ -74,7 +79,8 @@
"type": "text",
"default": "llm_response",
"suggestions": [
"llm_response"
"llm_response",
"ai_output"
]
},
"output_key": {
@@ -82,7 +88,8 @@
"type": "text",
"default": "tool_results",
"suggestions": [
"tool_results"
"tool_results",
"execution_output"
]
},
"stop_if_no_tools": {
@@ -100,7 +107,8 @@
"type": "text",
"default": "tool_results",
"suggestions": [
"tool_results"
"tool_results",
"execution_output"
]
},
"target_messages": {
@@ -108,7 +116,8 @@
"type": "text",
"default": "messages",
"suggestions": [
"messages"
"messages",
"chat_history"
]
}
}

View File

@@ -127,16 +127,6 @@
const container = document.getElementById('workflow-builder');
container.innerHTML = '';
// Create datalist for suggestions
const datalist = document.createElement('datalist');
datalist.id = 'workflow-suggestions';
allSuggestions.forEach(s => {
const opt = document.createElement('option');
opt.value = s;
datalist.appendChild(opt);
});
container.appendChild(datalist);
workflow.forEach((task, taskIdx) => {
const taskCard = document.createElement('div');
taskCard.className = 'card mb-4 border-primary';
@@ -187,7 +177,12 @@
<label class="small fw-bold">${fieldDef.label}</label>
${isCheckbox
? `<div class="form-check mt-1"><input type="checkbox" class="form-check-input" ${step[field] ? 'checked' : ''} onchange="updateStepField(${taskIdx}, ${stepIdx}, '${field}', this.checked)"></div>`
: `<input type="text" class="form-control form-control-sm" value="${val}" list="workflow-suggestions" onchange="updateStepField(${taskIdx}, ${stepIdx}, '${field}', this.value)" placeholder="${fieldDef.default || ''}">`
: `
<input type="text" class="form-control form-control-sm" value="${val}" list="suggestions-${taskIdx}-${stepIdx}-${field}" onchange="updateStepField(${taskIdx}, ${stepIdx}, '${field}', this.value)" placeholder="${fieldDef.default || ''}">
<datalist id="suggestions-${taskIdx}-${stepIdx}-${field}">
${(fieldDef.suggestions || Array.from(allSuggestions)).map(s => `<option value="${s}">`).join('')}
</datalist>
`
}
</div>
`;