Update workflow feature with codex
This commit is contained in:
@@ -107,10 +107,19 @@ const mapTool = (raw: AnyRecord): Tool => ({
|
||||
});
|
||||
|
||||
const mapWorkflowNode = (raw: AnyRecord): WorkflowNode => ({
|
||||
name: readField(raw, ['name'], ''),
|
||||
type: readField(raw, ['type'], 'conversation') as 'conversation' | 'tool' | 'human' | 'end',
|
||||
id: readField(raw, ['id'], ''),
|
||||
name: readField(raw, ['name'], String(readField(raw, ['id'], ''))),
|
||||
type: readField(raw, ['type'], 'assistant') as WorkflowNode['type'],
|
||||
isStart: readField(raw, ['isStart', 'is_start'], undefined),
|
||||
metadata: readField(raw, ['metadata'], { position: { x: 200, y: 200 } }),
|
||||
metadata: (() => {
|
||||
const metadata = readField(raw, ['metadata'], null);
|
||||
if (metadata && typeof metadata === 'object') return metadata;
|
||||
const position = readField(raw, ['position'], null);
|
||||
if (position && typeof position === 'object') return { position };
|
||||
return { position: { x: 200, y: 200 } };
|
||||
})(),
|
||||
assistantId: readField(raw, ['assistantId', 'assistant_id'], undefined),
|
||||
assistant: readField(raw, ['assistant'], undefined),
|
||||
prompt: readField(raw, ['prompt'], ''),
|
||||
messagePlan: readField(raw, ['messagePlan', 'message_plan'], undefined),
|
||||
variableExtractionPlan: readField(raw, ['variableExtractionPlan', 'variable_extraction_plan'], undefined),
|
||||
@@ -119,9 +128,14 @@ const mapWorkflowNode = (raw: AnyRecord): WorkflowNode => ({
|
||||
});
|
||||
|
||||
const mapWorkflowEdge = (raw: AnyRecord): WorkflowEdge => ({
|
||||
from: readField(raw, ['from', 'from_'], ''),
|
||||
to: readField(raw, ['to'], ''),
|
||||
id: readField(raw, ['id'], undefined),
|
||||
fromNodeId: readField(raw, ['fromNodeId', 'from', 'from_', 'source'], ''),
|
||||
toNodeId: readField(raw, ['toNodeId', 'to', 'target'], ''),
|
||||
from: readField(raw, ['fromNodeId', 'from', 'from_', 'source'], ''),
|
||||
to: readField(raw, ['toNodeId', 'to', 'target'], ''),
|
||||
label: readField(raw, ['label'], undefined),
|
||||
condition: readField(raw, ['condition'], undefined),
|
||||
priority: Number(readField(raw, ['priority'], 100)),
|
||||
});
|
||||
|
||||
const mapWorkflow = (raw: AnyRecord): Workflow => ({
|
||||
|
||||
Reference in New Issue
Block a user