diff --git a/web/app/components/base/icons/assets/vender/workflow/direct-answer.svg b/web/app/components/base/icons/assets/vender/workflow/answer.svg
similarity index 97%
rename from web/app/components/base/icons/assets/vender/workflow/direct-answer.svg
rename to web/app/components/base/icons/assets/vender/workflow/answer.svg
index 81afd5f73a..7767ce1e08 100644
--- a/web/app/components/base/icons/assets/vender/workflow/direct-answer.svg
+++ b/web/app/components/base/icons/assets/vender/workflow/answer.svg
@@ -1,5 +1,5 @@
diff --git a/web/app/components/base/icons/src/vender/workflow/DirectAnswer.json b/web/app/components/base/icons/src/vender/workflow/Answer.json
similarity index 96%
rename from web/app/components/base/icons/src/vender/workflow/DirectAnswer.json
rename to web/app/components/base/icons/src/vender/workflow/Answer.json
index 2a86b0e27f..4f15b339bb 100644
--- a/web/app/components/base/icons/src/vender/workflow/DirectAnswer.json
+++ b/web/app/components/base/icons/src/vender/workflow/Answer.json
@@ -15,7 +15,7 @@
"type": "element",
"name": "g",
"attributes": {
- "id": "icons/direct-answer"
+ "id": "icons/answer"
},
"children": [
{
@@ -34,5 +34,5 @@
}
]
},
- "name": "DirectAnswer"
+ "name": "Answer"
}
\ No newline at end of file
diff --git a/web/app/components/base/icons/src/vender/workflow/DirectAnswer.tsx b/web/app/components/base/icons/src/vender/workflow/Answer.tsx
similarity index 85%
rename from web/app/components/base/icons/src/vender/workflow/DirectAnswer.tsx
rename to web/app/components/base/icons/src/vender/workflow/Answer.tsx
index 54ea792905..389717f5f0 100644
--- a/web/app/components/base/icons/src/vender/workflow/DirectAnswer.tsx
+++ b/web/app/components/base/icons/src/vender/workflow/Answer.tsx
@@ -2,7 +2,7 @@
// DON NOT EDIT IT MANUALLY
import * as React from 'react'
-import data from './DirectAnswer.json'
+import data from './Answer.json'
import IconBase from '@/app/components/base/icons/IconBase'
import type { IconBaseProps, IconData } from '@/app/components/base/icons/IconBase'
@@ -11,6 +11,6 @@ const Icon = React.forwardRef, Omit )
-Icon.displayName = 'DirectAnswer'
+Icon.displayName = 'Answer'
export default Icon
diff --git a/web/app/components/base/icons/src/vender/workflow/index.ts b/web/app/components/base/icons/src/vender/workflow/index.ts
index a55527c651..ec1f4e5c01 100644
--- a/web/app/components/base/icons/src/vender/workflow/index.ts
+++ b/web/app/components/base/icons/src/vender/workflow/index.ts
@@ -1,5 +1,5 @@
export { default as Code } from './Code'
-export { default as DirectAnswer } from './DirectAnswer'
+export { default as Answer } from './Answer'
export { default as End } from './End'
export { default as Home } from './Home'
export { default as Http } from './Http'
diff --git a/web/app/components/workflow/block-icon.tsx b/web/app/components/workflow/block-icon.tsx
index 6b99447996..6a5c664858 100644
--- a/web/app/components/workflow/block-icon.tsx
+++ b/web/app/components/workflow/block-icon.tsx
@@ -3,8 +3,8 @@ import { memo } from 'react'
import { BlockEnum } from './types'
import { useStore } from './store'
import {
+ Answer,
Code,
- DirectAnswer,
End,
Home,
Http,
@@ -35,7 +35,7 @@ const getIcon = (type: BlockEnum, className: string) => {
[BlockEnum.End]: ,
[BlockEnum.IfElse]: ,
[BlockEnum.HttpRequest]: ,
- [BlockEnum.DirectAnswer]: ,
+ [BlockEnum.Answer]: ,
[BlockEnum.KnowledgeRetrieval]: ,
[BlockEnum.QuestionClassifier]: ,
[BlockEnum.TemplateTransform]: ,
@@ -50,7 +50,7 @@ const ICON_CONTAINER_BG_COLOR_MAP: Record = {
[BlockEnum.End]: 'bg-[#F79009]',
[BlockEnum.IfElse]: 'bg-[#06AED4]',
[BlockEnum.HttpRequest]: 'bg-[#875BF7]',
- [BlockEnum.DirectAnswer]: 'bg-[#F79009]',
+ [BlockEnum.Answer]: 'bg-[#F79009]',
[BlockEnum.KnowledgeRetrieval]: 'bg-[#16B364]',
[BlockEnum.QuestionClassifier]: 'bg-[#16B364]',
[BlockEnum.TemplateTransform]: 'bg-[#2E90FA]',
diff --git a/web/app/components/workflow/block-selector/blocks.tsx b/web/app/components/workflow/block-selector/blocks.tsx
index 8feda5dccf..829ff64377 100644
--- a/web/app/components/workflow/block-selector/blocks.tsx
+++ b/web/app/components/workflow/block-selector/blocks.tsx
@@ -32,7 +32,7 @@ const Blocks = ({
const groups = useMemo(() => {
return BLOCK_CLASSIFICATIONS.reduce((acc, classification) => {
const list = groupBy(blocks, 'classification')[classification].filter((block) => {
- if (block.type === BlockEnum.DirectAnswer && !isChatMode)
+ if (block.type === BlockEnum.Answer && !isChatMode)
return false
return block.title.toLowerCase().includes(searchText.toLowerCase())
diff --git a/web/app/components/workflow/block-selector/constants.tsx b/web/app/components/workflow/block-selector/constants.tsx
index 2b4ad0739c..64997036b9 100644
--- a/web/app/components/workflow/block-selector/constants.tsx
+++ b/web/app/components/workflow/block-selector/constants.tsx
@@ -21,7 +21,7 @@ export const BLOCKS: Block[] = [
},
{
classification: BlockClassificationEnum.Default,
- type: BlockEnum.DirectAnswer,
+ type: BlockEnum.Answer,
title: 'Direct Answer',
},
{
diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts
index 4723294445..50cf03f50b 100644
--- a/web/app/components/workflow/constants.ts
+++ b/web/app/components/workflow/constants.ts
@@ -1,7 +1,7 @@
import type { Var } from './types'
import { BlockEnum, VarType } from './types'
import StartNodeDefault from './nodes/start/default'
-import DirectAnswerDefault from './nodes/direct-answer/default'
+import AnswerDefault from './nodes/answer/default'
import LLMDefault from './nodes/llm/default'
import KnowledgeRetrievalDefault from './nodes/knowledge-retrieval/default'
import QuestionClassifierDefault from './nodes/question-classifier/default'
@@ -22,7 +22,7 @@ export const NODES_EXTRA_DATA = {
author: 'Dify',
about: '',
},
- [BlockEnum.DirectAnswer]: {
+ [BlockEnum.Answer]: {
author: 'Dify',
about: '',
},
@@ -77,11 +77,11 @@ export const NODES_INITIAL_DATA = {
desc: '',
...EndNodeDefault.defaultValue,
},
- [BlockEnum.DirectAnswer]: {
- type: BlockEnum.DirectAnswer,
+ [BlockEnum.Answer]: {
+ type: BlockEnum.Answer,
title: '',
desc: '',
- ...DirectAnswerDefault.defaultValue,
+ ...AnswerDefault.defaultValue,
},
[BlockEnum.LLM]: {
type: BlockEnum.LLM,
diff --git a/web/app/components/workflow/nodes/_base/hooks/use-var-list.ts b/web/app/components/workflow/nodes/_base/hooks/use-var-list.ts
index 0cb287fcb4..63d284f260 100644
--- a/web/app/components/workflow/nodes/_base/hooks/use-var-list.ts
+++ b/web/app/components/workflow/nodes/_base/hooks/use-var-list.ts
@@ -12,9 +12,9 @@ function useVarList({
setInputs,
varKey = 'variables',
}: Params) {
- const handleVarListChange = useCallback((newList: Variable[]) => {
+ const handleVarListChange = useCallback((newList: Variable[] | string) => {
const newInputs = produce(inputs, (draft: any) => {
- draft[varKey] = newList
+ draft[varKey] = newList as Variable[]
})
setInputs(newInputs)
}, [inputs, setInputs, varKey])
diff --git a/web/app/components/workflow/nodes/direct-answer/default.ts b/web/app/components/workflow/nodes/answer/default.ts
similarity index 67%
rename from web/app/components/workflow/nodes/direct-answer/default.ts
rename to web/app/components/workflow/nodes/answer/default.ts
index 21900f4306..d36cf78bbf 100644
--- a/web/app/components/workflow/nodes/direct-answer/default.ts
+++ b/web/app/components/workflow/nodes/answer/default.ts
@@ -1,7 +1,7 @@
import type { NodeDefault } from '../../types'
-import type { DirectAnswerNodeType } from './types'
+import type { AnswerNodeType } from './types'
-const nodeDefault: NodeDefault = {
+const nodeDefault: NodeDefault = {
defaultValue: {
variables: [],
answer: '',
diff --git a/web/app/components/workflow/nodes/direct-answer/node.tsx b/web/app/components/workflow/nodes/answer/node.tsx
similarity index 65%
rename from web/app/components/workflow/nodes/direct-answer/node.tsx
rename to web/app/components/workflow/nodes/answer/node.tsx
index 77996c52b5..348eac5eb6 100644
--- a/web/app/components/workflow/nodes/direct-answer/node.tsx
+++ b/web/app/components/workflow/nodes/answer/node.tsx
@@ -2,17 +2,17 @@ import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import InfoPanel from '../_base/components/info-panel'
-import type { DirectAnswerNodeType } from './types'
+import type { AnswerNodeType } from './types'
import type { NodeProps } from '@/app/components/workflow/types'
-const Node: FC> = ({
+const Node: FC> = ({
data,
}) => {
const { t } = useTranslation()
return (
-
+
)
}
diff --git a/web/app/components/workflow/nodes/direct-answer/panel.tsx b/web/app/components/workflow/nodes/answer/panel.tsx
similarity index 86%
rename from web/app/components/workflow/nodes/direct-answer/panel.tsx
rename to web/app/components/workflow/nodes/answer/panel.tsx
index 59cc9c5a49..0b6e77bbda 100644
--- a/web/app/components/workflow/nodes/direct-answer/panel.tsx
+++ b/web/app/components/workflow/nodes/answer/panel.tsx
@@ -2,7 +2,7 @@ import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import useConfig from './use-config'
-import type { DirectAnswerNodeType } from './types'
+import type { AnswerNodeType } from './types'
import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import AddButton from '@/app/components/base/button/add-button'
@@ -10,9 +10,9 @@ import Split from '@/app/components/workflow/nodes/_base/components/split'
import Editor from '@/app/components/workflow/nodes/_base/components/prompt/editor'
import type { NodePanelProps } from '@/app/components/workflow/types'
-const i18nPrefix = 'workflow.nodes.directAnswer'
+const i18nPrefix = 'workflow.nodes.answer'
-const Panel: FC> = ({
+const Panel: FC> = ({
id,
data,
}) => {
@@ -29,12 +29,13 @@ const Panel: FC> = ({
return (
}
>
{
- const { inputs, setInputs } = useNodeCrud(id, payload)
+const useConfig = (id: string, payload: AnswerNodeType) => {
+ const { inputs, setInputs } = useNodeCrud(id, payload)
// variables
- const { handleVarListChange, handleAddVariable } = useVarList({
+ const { handleVarListChange, handleAddVariable } = useVarList({
inputs,
setInputs,
})
diff --git a/web/app/components/workflow/nodes/answer/utils.ts b/web/app/components/workflow/nodes/answer/utils.ts
new file mode 100644
index 0000000000..8c3424815c
--- /dev/null
+++ b/web/app/components/workflow/nodes/answer/utils.ts
@@ -0,0 +1,5 @@
+import type { AnswerNodeType } from './types'
+
+export const checkNodeValid = (payload: AnswerNodeType) => {
+ return true
+}
diff --git a/web/app/components/workflow/nodes/constants.ts b/web/app/components/workflow/nodes/constants.ts
index 2c6eebcea0..c77fcffc0a 100644
--- a/web/app/components/workflow/nodes/constants.ts
+++ b/web/app/components/workflow/nodes/constants.ts
@@ -4,8 +4,8 @@ import StartNode from './start/node'
import StartPanel from './start/panel'
import EndNode from './end/node'
import EndPanel from './end/panel'
-import DirectAnswerNode from './direct-answer/node'
-import DirectAnswerPanel from './direct-answer/panel'
+import AnswerNode from './answer/node'
+import AnswerPanel from './answer/panel'
import LLMNode from './llm/node'
import LLMPanel from './llm/panel'
import KnowledgeRetrievalNode from './knowledge-retrieval/node'
@@ -28,7 +28,7 @@ import VariableAssignerPanel from './variable-assigner/panel'
export const NodeComponentMap: Record> = {
[BlockEnum.Start]: StartNode,
[BlockEnum.End]: EndNode,
- [BlockEnum.DirectAnswer]: DirectAnswerNode,
+ [BlockEnum.Answer]: AnswerNode,
[BlockEnum.LLM]: LLMNode,
[BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalNode,
[BlockEnum.QuestionClassifier]: QuestionClassifierNode,
@@ -43,7 +43,7 @@ export const NodeComponentMap: Record> = {
export const PanelComponentMap: Record = {
[BlockEnum.Start]: StartPanel,
[BlockEnum.End]: EndPanel,
- [BlockEnum.DirectAnswer]: DirectAnswerPanel,
+ [BlockEnum.Answer]: AnswerPanel,
[BlockEnum.LLM]: LLMPanel,
[BlockEnum.KnowledgeRetrieval]: KnowledgeRetrievalPanel,
[BlockEnum.QuestionClassifier]: QuestionClassifierPanel,
diff --git a/web/app/components/workflow/nodes/direct-answer/utils.ts b/web/app/components/workflow/nodes/direct-answer/utils.ts
deleted file mode 100644
index a519aa96f0..0000000000
--- a/web/app/components/workflow/nodes/direct-answer/utils.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { DirectAnswerNodeType } from './types'
-
-export const checkNodeValid = (payload: DirectAnswerNodeType) => {
- return true
-}
diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts
index 66c59dc23b..1d112ee3da 100644
--- a/web/app/components/workflow/types.ts
+++ b/web/app/components/workflow/types.ts
@@ -8,7 +8,7 @@ import type { VarType as VarKindType } from '@/app/components/workflow/nodes/too
export enum BlockEnum {
Start = 'start',
End = 'end',
- DirectAnswer = 'direct-answer',
+ Answer = 'answer',
LLM = 'llm',
KnowledgeRetrieval = 'knowledge-retrieval',
QuestionClassifier = 'question-classifier',
diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts
index b50df284a1..92faa9c127 100644
--- a/web/i18n/en-US/workflow.ts
+++ b/web/i18n/en-US/workflow.ts
@@ -44,7 +44,7 @@ const translation = {
blocks: {
'start': 'Start',
'end': 'End',
- 'direct-answer': 'Direct Answer',
+ 'answer': 'Answer',
'llm': 'LLM',
'knowledge-retrieval': 'Knowledge Retrieval',
'question-classifier': 'Question Classifier',
@@ -57,7 +57,7 @@ const translation = {
blocksAbout: {
'start': 'Define the initial parameters for launching a workflow',
'end': 'Define the end and result type of a workflow',
- 'direct-answer': 'Specify a custom text reply',
+ 'answer': 'Define the reply content of a chat conversation',
'llm': 'Invoking large language models to answer questions or process natural language',
'knowledge-retrieval': 'Allows you to query text content related to user questions from the Knowledge',
'question-classifier': 'Define the classification conditions of user questions, LLM can define how the conversation progresses based on the classification description',
@@ -129,9 +129,9 @@ const translation = {
'structured': 'Structured',
},
},
- directAnswer: {
+ answer: {
answer: 'Answer',
- inputVars: 'Input Variables',
+ outputVars: 'Output Variables',
},
llm: {
model: 'model',
diff --git a/web/i18n/lang/workflow.en.ts b/web/i18n/lang/workflow.en.ts
index ca8118b1a3..ef3b094c40 100644
--- a/web/i18n/lang/workflow.en.ts
+++ b/web/i18n/lang/workflow.en.ts
@@ -26,7 +26,7 @@ const translation = {
'structured': 'Structured',
},
},
- directAnswer: {
+ answer: {
answer: 'Answer',
inputVars: 'Input Variables',
},
diff --git a/web/i18n/lang/workflow.zh.ts b/web/i18n/lang/workflow.zh.ts
index 5ecd764db7..c37673eebb 100644
--- a/web/i18n/lang/workflow.zh.ts
+++ b/web/i18n/lang/workflow.zh.ts
@@ -25,7 +25,7 @@ const translation = {
'structured': '结构化',
},
},
- directAnswer: {
+ answer: {
answer: '回复',
inputVars: '输入变量',
},
diff --git a/web/i18n/pt-BR/workflow.ts b/web/i18n/pt-BR/workflow.ts
index ca8118b1a3..ef3b094c40 100644
--- a/web/i18n/pt-BR/workflow.ts
+++ b/web/i18n/pt-BR/workflow.ts
@@ -26,7 +26,7 @@ const translation = {
'structured': 'Structured',
},
},
- directAnswer: {
+ answer: {
answer: 'Answer',
inputVars: 'Input Variables',
},
diff --git a/web/i18n/uk-UA/workflow.ts b/web/i18n/uk-UA/workflow.ts
index ca8118b1a3..ef3b094c40 100644
--- a/web/i18n/uk-UA/workflow.ts
+++ b/web/i18n/uk-UA/workflow.ts
@@ -26,7 +26,7 @@ const translation = {
'structured': 'Structured',
},
},
- directAnswer: {
+ answer: {
answer: 'Answer',
inputVars: 'Input Variables',
},
diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts
index 20143c85f7..677850009f 100644
--- a/web/i18n/zh-Hans/workflow.ts
+++ b/web/i18n/zh-Hans/workflow.ts
@@ -44,7 +44,7 @@ const translation = {
blocks: {
'start': '开始',
'end': '结束',
- 'direct-answer': '直接回复',
+ 'answer': '直接回复',
'llm': 'LLM',
'knowledge-retrieval': '知识检索',
'question-classifier': '问题分类器',
@@ -57,7 +57,7 @@ const translation = {
blocksAbout: {
'start': '定义一个 workflow 流程启动的初始参数',
'end': '定义一个 workflow 流程的结束和结果类型',
- 'direct-answer': '指定一段自定义的文本回复',
+ 'answer': '定义一个聊天对话的回复内容',
'llm': '调用大语言模型回答问题或者对自然语言进行处理',
'knowledge-retrieval': '允许你从知识库中查询与用户问题相关的文本内容',
'question-classifier': '定义用户问题的分类条件,LLM 能够根据分类描述定义对话的进展方式',
@@ -129,9 +129,9 @@ const translation = {
'structured': '结构化',
},
},
- directAnswer: {
+ answer: {
answer: '回复',
- inputVars: '输入变量',
+ outputVars: '输出变量',
},
llm: {
model: '模型',