fix: Inline Prompts - UX-Verbesserungen
Problem 1: Selbst-Referenzierung verhindern - PlaceholderPicker erhält currentNodeId prop - Node kann sich nicht mehr selbst in Placeholders sehen - extractWorkflowPlaceholders() filtert aktuellen Node aus Problem 2: Radio-Button State-Management - IIFE mit Helper-Funktion für Mode-Bestimmung - isInlineMode/isReferenceMode basierend auf data.inline_template - Korrekte Conditional Rendering Logic - Beim Wechsel Reference→Inline bleibt prompt_slug erhalten - Beim Wechsel Inline→Reference bleibt inline_template erhalten Problem 3: Layout-Breite optimiert - Sidebar: 250px → 220px (schmaler) - Config Panel: 400px → 520px (breiter für bessere Lesbarkeit) - Responsive: Config Panel bei <1200px: 450px statt 350px Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
65500c899b
commit
8f6d60681e
3 files changed
+111
-95
No files matched your search
@@ -6,17 +6,19 @@ import { api } from '../../../utils/api'
|
||||
*
|
||||
* Props:
|
||||
* - nodes: Array of workflow nodes (to extract workflow-specific placeholders)
|
||||
* - currentNodeId: ID des aktuellen Nodes (wird aus Placeholders ausgeschlossen)
|
||||
* - onSelect: (placeholderString) => void - Callback when placeholder is selected
|
||||
* - onClose: () => void
|
||||
*
|
||||
* Features:
|
||||
* - Lädt registrierte Platzhalter vom Backend (~120+)
|
||||
* - Extrahiert Workflow-spezifische Node-Outputs
|
||||
* - Filtert Selbst-Referenzierung (Node kann sich nicht selbst referenzieren)
|
||||
* - Zeigt Node-Namen (nicht nur IDs)
|
||||
* - Kategorisiert: System + Workflow
|
||||
* - Suchfunktion über alle Kategorien
|
||||
*/
|
||||
export function PlaceholderPicker({ nodes, onSelect, onClose }) {
|
||||
export function PlaceholderPicker({ nodes, currentNodeId, onSelect, onClose }) {
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
const [systemPlaceholders, setSystemPlaceholders] = useState([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -61,8 +63,8 @@ export function PlaceholderPicker({ nodes, onSelect, onClose }) {
|
||||
loadPlaceholders()
|
||||
}, [])
|
||||
|
||||
// Extrahiere Workflow-spezifische Platzhalter
|
||||
const workflowPlaceholders = extractWorkflowPlaceholders(nodes)
|
||||
// Extrahiere Workflow-spezifische Platzhalter (ohne aktuellen Node)
|
||||
const workflowPlaceholders = extractWorkflowPlaceholders(nodes, currentNodeId)
|
||||
|
||||
// Kombiniere beide Listen
|
||||
const allPlaceholders = [
|
||||
@@ -341,14 +343,19 @@ export function PlaceholderPicker({ nodes, onSelect, onClose }) {
|
||||
|
||||
/**
|
||||
* Extrahiert Workflow-spezifische Platzhalter aus Nodes
|
||||
*
|
||||
* @param {Array} nodes - Alle Workflow-Nodes
|
||||
* @param {string} currentNodeId - ID des aktuellen Nodes (wird ausgeschlossen)
|
||||
*/
|
||||
function extractWorkflowPlaceholders(nodes) {
|
||||
function extractWorkflowPlaceholders(nodes, currentNodeId) {
|
||||
const placeholders = []
|
||||
|
||||
console.log('🔍 Extracting workflow placeholders from nodes:', nodes)
|
||||
console.log('🚫 Excluding current node:', currentNodeId)
|
||||
|
||||
nodes.forEach(node => {
|
||||
if (node.type === 'end') return // End Node hat keine Outputs
|
||||
if (node.id === currentNodeId) return // Selbst-Referenzierung verhindern
|
||||
|
||||
const nodeId = node.id
|
||||
const nodeLabel = node.data?.label || nodeId
|
||||
|
||||
Reference in new issue
Block a user