feat: Workflow Engine Part 3 - Inline Prompts (v0.9q)
Ermöglicht Analysis Nodes zwischen zwei Prompt-Modi zu wählen: - Reference Mode: Basis-Prompt aus DB referenzieren (bestehend) - Inline Mode: Template direkt im Node editieren (NEU) Frontend: - InlineTemplateEditor Component (~80 Zeilen) - Radio Buttons in WorkflowEditorPage für Mode-Auswahl - Placeholder Picker für beide Modi (End Node + Inline Template) - Cursor-Position Tracking mit textareaRef - Conditional Rendering basierend auf promptSource - Validation: Entweder prompt_slug ODER inline_template Backend: - load_prompt_template() akzeptiert ganzen WorkflowNode (statt nur slug) - Unterstützt inline_template (Mode 1) und prompt_slug (Mode 2) - WorkflowNode.inline_template Feld hinzugefügt - Validation: HTTPException wenn weder slug noch template Serialization: - inline_template in graph_data speichern/laden - Backward-compatible mit bestehenden Workflows Version: 0.9q Module: workflow 0.7.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b453ce63c6
commit
a1723db387
7 files changed
+295
-79
No files matched your search
@@ -22,6 +22,7 @@ export function serializeToWorkflowGraph(nodes, edges, metadata = {}) {
|
||||
// Type-spezifische Felder
|
||||
...(node.type === 'analysis' && {
|
||||
prompt_slug: node.data.prompt_slug || null,
|
||||
inline_template: node.data.inline_template || null, // Part 3: Inline Prompts
|
||||
prompt_name: node.data.prompt_name || null,
|
||||
question_augmentations: node.data.questions || [], // Backend erwartet question_augmentations
|
||||
fallback_strategy: node.data.fallback_strategy || 'conservative_skip'
|
||||
@@ -84,6 +85,7 @@ export function deserializeFromWorkflowGraph(jsonbData) {
|
||||
|
||||
...(node.type === 'analysis' && {
|
||||
prompt_slug: node.prompt_slug || node.prompt_id || null, // Fallback für alte Workflows mit prompt_id
|
||||
inline_template: node.inline_template || null, // Part 3: Inline Prompts
|
||||
prompt_name: node.prompt_name || null, // Falls vom Backend mitgeliefert
|
||||
questions: node.question_augmentations || node.questions || [], // Backend sendet question_augmentations
|
||||
fallback_strategy: node.fallback_strategy || 'conservative_skip'
|
||||
|
||||
@@ -86,17 +86,29 @@ function validateLogic(nodes, edges, errors, warnings) {
|
||||
// Analysis Nodes
|
||||
if (node.type === 'analysis') {
|
||||
const questions = node.data.questions || []
|
||||
const hasPromptSlug = node.data.prompt_slug != null && node.data.prompt_slug !== ''
|
||||
const hasInlineTemplate = node.data.inline_template != null && node.data.inline_template.trim() !== ''
|
||||
|
||||
// Prompt ausgewählt?
|
||||
if (!node.data.prompt_slug) {
|
||||
// Part 3: Validation - Entweder prompt_slug ODER inline_template
|
||||
if (!hasPromptSlug && !hasInlineTemplate) {
|
||||
errors.push({
|
||||
type: 'config',
|
||||
message: `Analysis-Node "${node.data.label}" hat keinen Prompt`,
|
||||
message: `Analysis-Node "${node.data.label}" benötigt entweder Basis-Prompt oder Inline-Template`,
|
||||
nodeId: node.id,
|
||||
severity: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
// Warning wenn beide gesetzt (sollte nicht passieren, aber zur Sicherheit)
|
||||
if (hasPromptSlug && hasInlineTemplate) {
|
||||
warnings.push({
|
||||
type: 'config',
|
||||
message: `Analysis-Node "${node.data.label}" hat sowohl Basis-Prompt als auch Inline-Template - Inline hat Vorrang`,
|
||||
nodeId: node.id,
|
||||
severity: 'warning'
|
||||
})
|
||||
}
|
||||
|
||||
// Fragen validieren
|
||||
questions.forEach((q, idx) => {
|
||||
if (!q.question?.trim()) {
|
||||
|
||||
Reference in new issue
Block a user