初始化

This commit is contained in:
2026-02-22 18:56:10 +08:00
commit 26677972a6
3112 changed files with 255972 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export default {
[nodeNames.documentNode]: {
title: $t('aiWorkflow.fileContentExtraction'),
group: 'base',
description: $t('aiWorkflow.descriptions.fileContentExtraction'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M21 4V18.7215C21 18.9193 20.8833 19.0986 20.7024 19.1787L12 23.0313L3.29759 19.1787C3.11667 19.0986 3 18.9193 3 18.7215V4H1V2H23V4H21ZM5 4V17.7451L12 20.8441L19 17.7451V4H5ZM8 8H16V10H8V8ZM8 12H16V14H8V12Z"></path></svg>',
sortNo: 801,
parametersAddEnable: false,
outputDefsAddEnable: false,
parameters: [
{
name: 'fileUrl',
nameDisabled: true,
title: $t('aiWorkflow.documentAddress'),
dataType: 'File',
required: true,
description: $t('aiWorkflow.descriptions.documentAddress'),
},
],
outputDefs: [
{
name: 'content',
title: $t('aiWorkflow.parsedText'),
dataType: 'String',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.descriptions.parsedText'),
deleteDisabled: true,
},
],
},
};

View File

@@ -0,0 +1,90 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export default {
[nodeNames.downloadNode]: {
title: $t('aiWorkflow.resourceSync'),
group: 'base',
description: $t('aiWorkflow.descriptions.resourceSync'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 12H16L12 16L8 12H11V8H13V12ZM15 4H5V20H19V8H15V4ZM3 2.9918C3 2.44405 3.44749 2 3.9985 2H16L20.9997 7L21 20.9925C21 21.5489 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5447 3 21.0082V2.9918Z"></path></svg>',
sortNo: 811,
parametersAddEnable: false,
outputDefsAddEnable: false,
parameters: [
{
name: 'originUrl',
nameDisabled: true,
title: $t('aiWorkflow.originUrl'),
dataType: 'String',
required: true,
description: $t('aiWorkflow.descriptions.originUrl'),
},
],
outputDefs: [
{
name: 'resourceUrl',
title: $t('aiWorkflow.savedUrl'),
dataType: 'String',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.savedUrl'),
deleteDisabled: true,
},
],
forms: [
// 节点表单
{
// 'input' | 'textarea' | 'select' | 'slider' | 'heading' | 'chosen'
type: 'heading',
label: $t('aiWorkflow.saveOptions'),
},
{
type: 'select',
label: $t('aiResource.resourceType'),
description: $t('aiWorkflow.descriptions.resourceType'),
name: 'resourceType', // 属性名称
defaultValue: '99',
options: [
{
label: $t('aiWorkflow.image'),
value: '0',
},
{
label: $t('aiWorkflow.video'),
value: '1',
},
{
label: $t('aiWorkflow.audio'),
value: '2',
},
{
label: $t('aiWorkflow.document'),
value: '3',
},
{
label: $t('aiWorkflow.other'),
value: '99',
},
],
},
// {
// // 用法可参考插件节点的代码
// type: 'chosen',
// label: '插件选择',
// chosen: {
// // 节点自定义属性
// labelDataKey: 'pluginName',
// valueDataKey: 'pluginId',
// // updateNodeData 可动态更新节点属性
// // value 为选中的 value
// // label 为选中的 label
// onChosen: ((updateNodeData: (data: Record<string, any>) => void, value?: string, label?: string, event?: Event) => {
// console.warn('No onChosen handler provided for plugin-node');
// })
// }
// }
],
},
};

View File

@@ -0,0 +1,29 @@
import docNode from './documentNode';
import downloadNode from './downloadNode';
import makeFileNode from './makeFileNode';
import nodeNames from './nodeNames';
import { PluginNode } from './pluginNode';
import { SaveToDatacenterNode } from './saveToDatacenter';
import { SearchDatacenterNode } from './searchDatacenter';
import sqlNode from './sqlNode';
import { WorkflowNode } from './workflowNode';
export interface CustomNodeOptions {
handleChosen?: (nodeType: string, updateNodeData: any, value: string) => void;
}
export const getCustomNode = async (options: CustomNodeOptions) => {
const pluginNode = PluginNode({ onChosen: options.handleChosen });
const workflowNode = WorkflowNode({ onChosen: options.handleChosen });
const searchDatacenterNode = await SearchDatacenterNode();
const saveToDatacenterNode = await SaveToDatacenterNode();
return {
...docNode,
...makeFileNode,
...downloadNode,
...sqlNode,
[nodeNames.pluginNode]: pluginNode,
[nodeNames.workflowNode]: workflowNode,
[nodeNames.searchDatacenterNode]: searchDatacenterNode,
[nodeNames.saveToDatacenterNode]: saveToDatacenterNode,
};
};

View File

@@ -0,0 +1,58 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export default {
[nodeNames.makeFileNode]: {
title: $t('aiWorkflow.fileGeneration'),
group: 'base',
description: $t('aiWorkflow.descriptions.fileGeneration'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 13.5V8C14 5.79086 12.2091 4 10 4C7.79086 4 6 5.79086 6 8V13.5C6 17.0899 8.91015 20 12.5 20C16.0899 20 19 17.0899 19 13.5V4H21V13.5C21 18.1944 17.1944 22 12.5 22C7.80558 22 4 18.1944 4 13.5V8C4 4.68629 6.68629 2 10 2C13.3137 2 16 4.68629 16 8V13.5C16 15.433 14.433 17 12.5 17C10.567 17 9 15.433 9 13.5V8H11V13.5C11 14.3284 11.6716 15 12.5 15C13.3284 15 14 14.3284 14 13.5Z"></path></svg>',
sortNo: 802,
parametersAddEnable: true,
outputDefsAddEnable: true,
forms: [
{
type: 'heading',
label: $t('aiWorkflow.fileSettings'),
},
{
type: 'select',
label: $t('documentCollection.splitterDoc.fileType'),
description: $t('aiWorkflow.descriptions.fileType'),
name: 'suffix',
defaultValue: 'docx',
options: [
{
label: 'docx',
value: 'docx',
},
],
},
],
parameters: [
{
name: 'content',
nameDisabled: true,
title: $t('preferences.content'),
dataType: 'String',
required: true,
description: $t('preferences.content'),
deleteDisabled: true,
},
],
outputDefs: [
{
name: 'url',
nameDisabled: true,
title: $t('aiWorkflow.fileDownloadURL'),
dataType: 'String',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.descriptions.fileDownloadURL'),
deleteDisabled: true,
},
],
},
};

View File

@@ -0,0 +1,10 @@
export default {
documentNode: 'document-node',
makeFileNode: 'make-file',
downloadNode: 'download-node',
sqlNode: 'sql-node',
pluginNode: 'plugin-node',
workflowNode: 'workflow-node',
searchDatacenterNode: 'search-datacenter-node',
saveToDatacenterNode: 'save-to-datacenter-node',
};

View File

@@ -0,0 +1,30 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export interface PluginNodeOptions {
onChosen?: (nodeType: string, updateNodeData: any, value: string) => void;
}
export const PluginNode = (options: PluginNodeOptions = {}) => ({
title: $t('menus.ai.plugin'),
group: 'base',
description: $t('aiWorkflow.descriptions.plugin'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 18V20H19V22H13C11.8954 22 11 21.1046 11 20V18H8C5.79086 18 4 16.2091 4 14V7C4 6.44772 4.44772 6 5 6H8V2H10V6H14V2H16V6H19C19.5523 6 20 6.44772 20 7V14C20 16.2091 18.2091 18 16 18H13ZM8 16H16C17.1046 16 18 15.1046 18 14V11H6V14C6 15.1046 6.89543 16 8 16ZM18 8H6V9H18V8ZM12 14.5C11.4477 14.5 11 14.0523 11 13.5C11 12.9477 11.4477 12.5 12 12.5C12.5523 12.5 13 12.9477 13 13.5C13 14.0523 12.5523 14.5 12 14.5Z"></path></svg>',
sortNo: 810,
parametersAddEnable: false,
outputDefsAddEnable: false,
forms: [
{
type: 'chosen',
label: $t('aiWorkflow.pluginSelect'),
chosen: {
labelDataKey: 'pluginName',
valueDataKey: 'pluginId',
onChosen: (updateNodeData: any, value: any) => {
options.onChosen?.(nodeNames.pluginNode, updateNodeData, value);
},
},
},
],
});

View File

@@ -0,0 +1,58 @@
import { getOptions } from '@easyflow/utils';
import { api } from '#/api/request';
import { $t } from '#/locales';
export const SaveToDatacenterNode = async () => {
const res = await api.get('/api/v1/datacenterTable/list');
return {
title: $t('aiWorkflow.saveData'),
group: 'base',
description: $t('aiWorkflow.descriptions.saveData'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M11 19V9H4V19H11ZM11 7V4C11 3.44772 11.4477 3 12 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V8C2 7.44772 2.44772 7 3 7H11ZM13 5V19H20V5H13ZM5 16H10V18H5V16ZM14 16H19V18H14V16ZM14 13H19V15H14V13ZM14 10H19V12H14V10ZM5 13H10V15H5V13Z"></path></svg>',
sortNo: 812,
parametersAddEnable: false,
outputDefsAddEnable: false,
parameters: [
{
name: 'saveList',
title: $t('aiWorkflow.dataToBeSaved'),
dataType: 'Array',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.descriptions.dataToBeSaved'),
deleteDisabled: true,
nameDisabled: true,
},
],
outputDefs: [
{
name: 'successRows',
title: $t('aiWorkflow.successInsertedRecords'),
dataType: 'Number',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.successInsertedRecords'),
deleteDisabled: true,
nameDisabled: true,
},
],
forms: [
{
type: 'heading',
label: $t('aiWorkflow.dataTable'),
},
{
type: 'select',
label: '',
description: $t('aiWorkflow.descriptions.dataTable'),
name: 'tableId',
defaultValue: '',
options: getOptions('tableName', 'id', res.data),
},
],
};
};

View File

@@ -0,0 +1,68 @@
import { getOptions } from '@easyflow/utils';
import { api } from '#/api/request';
import { $t } from '#/locales';
export const SearchDatacenterNode = async () => {
const res = await api.get('/api/v1/datacenterTable/list');
return {
title: $t('aiWorkflow.queryData'),
group: 'base',
description: $t('aiWorkflow.descriptions.queryData'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M11 2C15.968 2 20 6.032 20 11C20 15.968 15.968 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2ZM11 18C14.8675 18 18 14.8675 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18ZM19.4853 18.0711L22.3137 20.8995L20.8995 22.3137L18.0711 19.4853L19.4853 18.0711Z"></path></svg>',
sortNo: 813,
parametersAddEnable: true,
outputDefsAddEnable: false,
parameters: [],
outputDefs: [
{
name: 'rows',
title: $t('aiWorkflow.queryResult'),
dataType: 'Array',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.queryResult'),
deleteDisabled: true,
nameDisabled: false,
},
],
forms: [
{
type: 'heading',
label: $t('aiWorkflow.dataTable'),
},
{
type: 'select',
label: '',
description: $t('aiWorkflow.descriptions.dataTable'),
name: 'tableId',
defaultValue: '',
options: getOptions('tableName', 'id', res.data),
},
{
type: 'heading',
label: $t('aiWorkflow.filterConditions'),
},
{
type: 'textarea',
label: "如name='张三' and age=21 or field = {{流程变量}}",
description: '',
name: 'where',
defaultValue: '',
},
{
type: 'heading',
label: $t('aiWorkflow.limit'),
},
{
type: 'input',
label: '',
description: '',
name: 'limit',
defaultValue: '10',
},
],
};
};

View File

@@ -0,0 +1,37 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export default {
[nodeNames.sqlNode]: {
title: $t('aiWorkflow.sqlQuery'),
group: 'base',
description: $t('aiWorkflow.descriptions.sqlQuery'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgba(37,99,235,1)"><path d="M5 12.5C5 12.8134 5.46101 13.3584 6.53047 13.8931C7.91405 14.5849 9.87677 15 12 15C14.1232 15 16.0859 14.5849 17.4695 13.8931C18.539 13.3584 19 12.8134 19 12.5V10.3287C17.35 11.3482 14.8273 12 12 12C9.17273 12 6.64996 11.3482 5 10.3287V12.5ZM19 15.3287C17.35 16.3482 14.8273 17 12 17C9.17273 17 6.64996 16.3482 5 15.3287V17.5C5 17.8134 5.46101 18.3584 6.53047 18.8931C7.91405 19.5849 9.87677 20 12 20C14.1232 20 16.0859 19.5849 17.4695 18.8931C18.539 18.3584 19 17.8134 19 17.5V15.3287ZM3 17.5V7.5C3 5.01472 7.02944 3 12 3C16.9706 3 21 5.01472 21 7.5V17.5C21 19.9853 16.9706 22 12 22C7.02944 22 3 19.9853 3 17.5ZM12 10C14.1232 10 16.0859 9.58492 17.4695 8.89313C18.539 8.3584 19 7.81342 19 7.5C19 7.18658 18.539 6.6416 17.4695 6.10687C16.0859 5.41508 14.1232 5 12 5C9.87677 5 7.91405 5.41508 6.53047 6.10687C5.46101 6.6416 5 7.18658 5 7.5C5 7.81342 5.46101 8.3584 6.53047 8.89313C7.91405 9.58492 9.87677 10 12 10Z"></path></svg>',
sortNo: 803,
parametersAddEnable: true,
outputDefsAddEnable: true,
parameters: [],
forms: [
{
name: 'sql',
type: 'textarea',
label: 'SQL',
placeholder: $t('aiWorkflow.descriptions.enterSQL'),
},
],
outputDefs: [
{
name: 'queryData',
title: $t('aiWorkflow.queryResult'),
dataType: 'Array',
dataTypeDisabled: true,
required: true,
parametersAddEnable: false,
description: $t('aiWorkflow.descriptions.queryResultJson'),
deleteDisabled: true,
nameDisabled: true,
},
],
},
};

View File

@@ -0,0 +1,30 @@
import { $t } from '#/locales';
import nodeNames from './nodeNames';
export interface WorkflowNodeOptions {
onChosen?: (nodeType: string, updateNodeData: any, value: string) => void;
}
export const WorkflowNode = (options: WorkflowNodeOptions = {}) => ({
title: $t('aiWorkflow.subProcess'),
group: 'base',
description: $t('aiWorkflow.descriptions.subProcess'),
icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M6 21.5C4.067 21.5 2.5 19.933 2.5 18C2.5 16.067 4.067 14.5 6 14.5C7.5852 14.5 8.92427 15.5539 9.35481 16.9992L15 16.9994V15L17 14.9994V9.24339L14.757 6.99938H9V9.00003H3V3.00003H9V4.99939H14.757L18 1.75739L22.2426 6.00003L19 9.24139V14.9994L21 15V21H15V18.9994L9.35499 19.0003C8.92464 20.4459 7.58543 21.5 6 21.5ZM6 16.5C5.17157 16.5 4.5 17.1716 4.5 18C4.5 18.8285 5.17157 19.5 6 19.5C6.82843 19.5 7.5 18.8285 7.5 18C7.5 17.1716 6.82843 16.5 6 16.5ZM19 17H17V19H19V17ZM18 4.58581L16.5858 6.00003L18 7.41424L19.4142 6.00003L18 4.58581ZM7 5.00003H5V7.00003H7V5.00003Z"></path></svg>',
sortNo: 815,
parametersAddEnable: false,
outputDefsAddEnable: false,
forms: [
{
type: 'chosen',
label: $t('aiWorkflow.workflowSelect'),
chosen: {
labelDataKey: 'workflowName',
valueDataKey: 'workflowId',
onChosen: (updateNodeData: any, value: any) => {
options.onChosen?.(nodeNames.workflowNode, updateNodeData, value);
},
},
},
],
});