Initial commit

This commit is contained in:
libertyspy
2026-02-08 20:41:49 +08:00
parent b544391b5c
commit 58d36a3d6d
6 changed files with 17 additions and 98 deletions

View File

@@ -8,22 +8,22 @@
*/
import type { NodeTemplate } from '../types';
import type { GraphTaskElement, TaskNodeRect } from '../builder/element';
import type { GraphTaskElement, GraphTaskRect } from '../builder/element';
import { generateKey } from '@/utils/strings';
export const createGraphTaskElementFromTemplate = (
template: NodeTemplate,
rect?: TaskNodeRect,
rect?: GraphTaskRect,
): GraphTaskElement => {
let realRect = { width: 200, height: 100, x: 0, y: 0, ...rect || {} }
console.info('rect',rect)
return {
id: 0,
key: generateKey(template.type),
status: null,
type: 'task',
template: template.id,
type: template.type,
name: template.name,
category: template.type,
description: template.description,
position: {
x: realRect.x ?? 0,
@@ -31,10 +31,9 @@ export const createGraphTaskElementFromTemplate = (
},
width: realRect.width,
height: realRect.height,
// settings: JSON.parse(JSON.stringify(template.parameter_defs ?? [])),
inputs: null,
outputs: null,
parameters: {},
parameters: [],
variables: [
{
key: generateKey('var_'),