diff --git a/web/app/(commonLayout)/workflow/nodes/page.tsx b/web/app/(commonLayout)/workflow/nodes/page.tsx deleted file mode 100644 index 88296aac13..0000000000 --- a/web/app/(commonLayout)/workflow/nodes/page.tsx +++ /dev/null @@ -1,85 +0,0 @@ -'use client' - -import type { FC } from 'react' -import { memo } from 'react' -import Workflow from '@/app/components/workflow' -import { BlockEnum } from '@/app/components/workflow/types' -import { mockData as StartNodeMock } from '@/app/components/workflow/nodes/start/mock' -import { mockData as DirectAnswerNodeMock } from '@/app/components/workflow/nodes/direct-answer/mock' -import { mockData as LLMNodeMock } from '@/app/components/workflow/nodes/llm/mock' -import { mockData as KnowledgeRetrievalNodeMock } from '@/app/components/workflow/nodes/knowledge-retrieval/mock' -import { mockData as QuestionClassifierNodeMock } from '@/app/components/workflow/nodes/question-classifier/mock' -import { mockData as IfElseNodeMock } from '@/app/components/workflow/nodes/if-else/mock' -import { mockData as CodeNodeMock } from '@/app/components/workflow/nodes/code/mock' -import { mockData as TemplateTransformNodeMock } from '@/app/components/workflow/nodes/template-transform/mock' -import { mockData as HttpRequestNodeMock } from '@/app/components/workflow/nodes/http/mock' -import { mockData as ToolNodeMock } from '@/app/components/workflow/nodes/tool/mock' -import { mockData as VariableAssignerNodeMock } from '@/app/components/workflow/nodes/variable-assigner/mock' -import { mockData as EndNodeMock } from '@/app/components/workflow/nodes/end/mock' - -const allMockData = { - [BlockEnum.Start]: StartNodeMock, - [BlockEnum.DirectAnswer]: DirectAnswerNodeMock, - [BlockEnum.LLM]: LLMNodeMock, - [BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalNodeMock, - [BlockEnum.QuestionClassifier]: QuestionClassifierNodeMock, - [BlockEnum.IfElse]: IfElseNodeMock, - [BlockEnum.Code]: CodeNodeMock, - [BlockEnum.TemplateTransform]: TemplateTransformNodeMock, - [BlockEnum.HttpRequest]: HttpRequestNodeMock, - [BlockEnum.Tool]: ToolNodeMock, - [BlockEnum.VariableAssigner]: VariableAssignerNodeMock, - [BlockEnum.End]: EndNodeMock, -} -const nodes = [ - BlockEnum.Code/* 7 */, BlockEnum.KnowledgeRetrieval/* 4 */, BlockEnum.Start/* 1 */, BlockEnum.DirectAnswer/* 2 */, BlockEnum.LLM/* 3 */, BlockEnum.QuestionClassifier/* 5 */, - BlockEnum.IfElse/* 6 */, BlockEnum.TemplateTransform/* 8 */, BlockEnum.HttpRequest/* 9 */, BlockEnum.Tool/* 10 */, - BlockEnum.VariableAssigner/* 11 */, BlockEnum.End/* 12 */, -].map((item, i) => { - const payload = allMockData[item] - return ({ - id: `${i + 1}`, - type: 'custom', - position: { x: 330, y: 30 + i * 300 }, - data: { - selected: i === 0, // for test: always select the first node - name: item, - ...payload, - }, - }) -}) - -const initialNodes = nodes - -const initialEdges = [ - { - id: '1', - source: '1', - target: '2', - type: 'custom', - }, - { - id: '2', - source: '2', - target: '3', - type: 'custom', - }, - { - id: '3', - source: '2', - target: '4', - type: 'custom', - }, -] - -const Page: FC = () => { - return ( -
- -
- ) -} -export default memo(Page) diff --git a/web/app/components/workflow/nodes/code/mock.ts b/web/app/components/workflow/nodes/code/mock.ts deleted file mode 100644 index a7a1a44c06..0000000000 --- a/web/app/components/workflow/nodes/code/mock.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BlockEnum } from '../../types' -import { CodeLanguage } from './types' -import type { CodeNodeType } from './types' - -export const mockData: CodeNodeType = { - title: 'Code', - desc: '', - type: BlockEnum.Code, - variables: [ - { - variable: 'name', - value_selector: ['aaa', 'name'], - }, - { - variable: 'age', - value_selector: ['bbb', 'b', 'c'], - }, - ], - code_language: CodeLanguage.python3, - code: 'print("hello world")', - outputs: [ - { - variable: 'output', - variable_type: 'string', - }, - ], -} diff --git a/web/app/components/workflow/nodes/direct-answer/mock.ts b/web/app/components/workflow/nodes/direct-answer/mock.ts deleted file mode 100644 index 48e2a715c6..0000000000 --- a/web/app/components/workflow/nodes/direct-answer/mock.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BlockEnum } from '../../types' -import type { DirectAnswerNodeType } from './types' - -export const mockData: DirectAnswerNodeType = { - title: 'Direct answer', - desc: 'Test', - type: BlockEnum.DirectAnswer, - variables: [ - { - variable: 'age', - value_selector: ['bbb', 'b', 'c'], - }, - ], - answer: 'Sorry, I cannot answer this question.', -} diff --git a/web/app/components/workflow/nodes/end/mock.ts b/web/app/components/workflow/nodes/end/mock.ts deleted file mode 100644 index f66e8cf2b3..0000000000 --- a/web/app/components/workflow/nodes/end/mock.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { BlockEnum } from '../../types' -import { EndVarType } from './types' -import type { EndNodeType } from './types' - -export const mockData: EndNodeType = { - title: 'End', - desc: 'Test', - type: BlockEnum.End, - outputs: { - type: EndVarType.structured, - plain_text_selector: ['aaa', 'name'], - structured_variables: [ - { - variable: 'test', - value_selector: ['aaa', 'name'], - }, - ], - }, -} diff --git a/web/app/components/workflow/nodes/http/mock.ts b/web/app/components/workflow/nodes/http/mock.ts deleted file mode 100644 index 2a48ac369c..0000000000 --- a/web/app/components/workflow/nodes/http/mock.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { BlockEnum } from '../../types' -import { APIType, AuthorizationType, BodyType, Method } from './types' -import type { HttpNodeType } from './types' - -export const mockData: HttpNodeType = { - title: 'HTTP Request', - desc: 'Test', - type: BlockEnum.HttpRequest, - variables: [ - { - variable: 'name', - value_selector: ['aaa', 'name'], - }, - { - variable: 'age', - value_selector: ['bbb', 'b', 'c'], - }, - ], - method: Method.get, - url: 'https://api.dify.com/xx', - headers: 'Content-Type: application/json\nAccept: */*', - params: '', - body: { - type: BodyType.none, - data: '', - }, - authorization: { - type: AuthorizationType.apiKey, - config: { - type: APIType.custom, - api_key: 'abc', - header: 'x-Authorization', - }, - }, -} diff --git a/web/app/components/workflow/nodes/if-else/mock.ts b/web/app/components/workflow/nodes/if-else/mock.ts deleted file mode 100644 index bbf97a7627..0000000000 --- a/web/app/components/workflow/nodes/if-else/mock.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { BlockEnum } from '../../types' -import type { IfElseNodeType } from './types' -import { ComparisonOperator, LogicalOperator } from './types' - -export const mockData: IfElseNodeType = { - title: 'If Else', - desc: 'Test', - type: BlockEnum.IfElse, - logical_operator: LogicalOperator.and, - conditions: [ - { - id: '1', - variable_selector: ['aaa', 'name'], - comparison_operator: ComparisonOperator.contains, - value: '22', - }, - { - id: '2', - variable_selector: ['bbb', 'b', 'c'], - comparison_operator: ComparisonOperator.equal, - value: 'b', - }, - ], -} diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/mock.ts b/web/app/components/workflow/nodes/knowledge-retrieval/mock.ts deleted file mode 100644 index d821c98182..0000000000 --- a/web/app/components/workflow/nodes/knowledge-retrieval/mock.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BlockEnum } from '../../types' -import type { KnowledgeRetrievalNodeType } from './types' -import { RETRIEVE_TYPE } from '@/types/app' - -export const mockData: KnowledgeRetrievalNodeType = { - type: BlockEnum.KnowledgeRetrieval, - desc: 'xxx', - title: 'Knowledge Retrieval', - query_variable_selector: ['aaa', 'name'], - dataset_ids: ['744a0635-2496-4a87-8e6d-fae410f610be'], - retrieval_mode: RETRIEVE_TYPE.oneWay, - multiple_retrieval_config: { - top_k: 10, - score_threshold: null, - reranking_model: { - provider: '', - model: '', - }, - }, -} diff --git a/web/app/components/workflow/nodes/llm/mock.ts b/web/app/components/workflow/nodes/llm/mock.ts deleted file mode 100644 index 6687184490..0000000000 --- a/web/app/components/workflow/nodes/llm/mock.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { BlockEnum, PromptRole } from '../../types' -import type { LLMNodeType } from './types' -import { Resolution } from '@/types/app' - -export const mockData: LLMNodeType = { - title: 'LLM', - desc: 'Test', - type: BlockEnum.LLM, - model: { - provider: 'openai', - name: 'gpt-4', - mode: 'chat', - completion_params: { - temperature: 0.7, - }, - }, - variables: [ - { - variable: 'name', - value_selector: ['aaa', 'name'], - }, - { - variable: 'age', - value_selector: ['bbb', 'b', 'c'], - }, - { - variable: 'a1', - value_selector: ['aaa', 'name'], - }, - { - variable: 'a2', - value_selector: ['aaa', 'name'], - }, - ], - prompt: [ - { - role: PromptRole.system, - text: '', - }, - ], - memory: { - role_prefix: { - user: 'user: ', - assistant: 'assistant: ', - }, - window: { - enabled: false, - size: 0, - }, - }, - context: { - enabled: false, - variable_selector: ['aaa', 'name'], - }, - vision: { - enabled: true, - configs: { - detail: Resolution.low, - }, - }, -} diff --git a/web/app/components/workflow/nodes/question-classifier/mock.ts b/web/app/components/workflow/nodes/question-classifier/mock.ts deleted file mode 100644 index a90e25377a..0000000000 --- a/web/app/components/workflow/nodes/question-classifier/mock.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { BlockEnum } from '../../types' -import type { QuestionClassifierNodeType } from './types' - -export const mockData: QuestionClassifierNodeType = { - title: 'Question Classifier', - desc: 'Test', - type: BlockEnum.QuestionClassifier, - query_variable_selector: ['aaa', 'name'], - model: { - provider: 'openai', - name: 'gpt-4', - mode: 'chat', - completion_params: { - temperature: 0.7, - }, - }, - classes: [ - { - id: '1', - name: 'topic 1', - }, - { - id: '2', - name: 'topic 2', - }, - ], - instruction: 'You are an entity extraction model that accepts an input', - memory: { - window: { - enabled: false, - size: 0, - }, - }, -} diff --git a/web/app/components/workflow/nodes/start/mock.ts b/web/app/components/workflow/nodes/start/mock.ts deleted file mode 100644 index e7b27d6b9d..0000000000 --- a/web/app/components/workflow/nodes/start/mock.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { StartNodeType } from './types' -import { BlockEnum, InputVarType } from '@/app/components/workflow/types' - -export const mockData: StartNodeType = { - title: 'Start', - desc: 'Test', - type: BlockEnum.Start, - variables: [ - { - type: InputVarType.textInput, - label: 'Test', - variable: 'a', - max_length: 10, - default: 'test', - required: true, - hint: 'Test', - }, - { - type: InputVarType.paragraph, - label: 'Test', - variable: 'para', - default: 'test', - required: true, - hint: 'Test', - }, - { - type: InputVarType.select, - label: 'Test', - variable: 'sel', - default: 'test', - required: false, - hint: 'Test', - options: ['op1', 'op2'], - }, - { - type: InputVarType.number, - label: 'Test', - variable: 'num', - default: '1', - required: true, - hint: 'Test', - }, - ], -} diff --git a/web/app/components/workflow/nodes/template-transform/mock.ts b/web/app/components/workflow/nodes/template-transform/mock.ts deleted file mode 100644 index 1f50c8ae4d..0000000000 --- a/web/app/components/workflow/nodes/template-transform/mock.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { BlockEnum } from '../../types' -import type { TemplateTransformNodeType } from './types' - -export const mockData: TemplateTransformNodeType = { - title: 'Template Transform', - desc: 'Test', - type: BlockEnum.TemplateTransform, - variables: [ - { - variable: 'name', - value_selector: ['aaa', 'name'], - }, - { - variable: 'age', - value_selector: ['bbb', 'b', 'c'], - }, - ], - template: 'print("hello world")', -} diff --git a/web/app/components/workflow/nodes/tool/mock.ts b/web/app/components/workflow/nodes/tool/mock.ts deleted file mode 100644 index 3827ec22ec..0000000000 --- a/web/app/components/workflow/nodes/tool/mock.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BlockEnum } from '../../types' -import type { ToolNodeType } from './types' -import { VarType } from './types' - -export const mockData: ToolNodeType = { - title: 'Tool', - desc: 'Test', - type: BlockEnum.Tool, - provider_id: 'test', - provider_type: 'builtin', - provider_name: 'test', - tool_name: 'test', - tool_label: 'test', - tool_inputs: [ - { - variable: 'size', - variable_type: VarType.selector, - value_selector: ['aaa', 'name'], - }, - { - variable: 'quality', - variable_type: VarType.static, - value: 'HD', - }, - ], - tool_parameters: {}, -} diff --git a/web/app/components/workflow/nodes/variable-assigner/mock.ts b/web/app/components/workflow/nodes/variable-assigner/mock.ts deleted file mode 100644 index 8171ce0792..0000000000 --- a/web/app/components/workflow/nodes/variable-assigner/mock.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BlockEnum } from '../../types' -import type { VariableAssignerNodeType } from './types' - -export const mockData: VariableAssignerNodeType = { - title: 'Variable Assigner', - desc: 'Test', - type: BlockEnum.VariableAssigner, - output_type: 'string', - variables: [ - ['aaa', 'name'], - ['bbb', 'b', 'c'], - ], -}