mirror of https://github.com/langgenius/dify.git
temp
This commit is contained in:
parent
90c8d9d27b
commit
57e9e229de
|
|
@ -32,7 +32,7 @@ const allMockData = {
|
|||
[BlockEnum.End]: EndNodeMock,
|
||||
}
|
||||
const nodes = [
|
||||
BlockEnum.QuestionClassifier/* 5 */, BlockEnum.Start/* 1 */, BlockEnum.DirectAnswer/* 2 */, BlockEnum.LLM/* 3 */, BlockEnum.KnowledgeRetrieval/* 4 */,
|
||||
BlockEnum.Start/* 1 */, BlockEnum.QuestionClassifier/* 5 */, BlockEnum.DirectAnswer/* 2 */, BlockEnum.LLM/* 3 */, BlockEnum.KnowledgeRetrieval/* 4 */,
|
||||
BlockEnum.IfElse/* 6 */, BlockEnum.Code/* 7 */, BlockEnum.TemplateTransform/* 8 */, BlockEnum.HttpRequest/* 9 */, BlockEnum.Tool/* 10 */,
|
||||
BlockEnum.VariableAssigner/* 11 */, BlockEnum.End/* 12 */,
|
||||
].map((item, i) => {
|
||||
|
|
|
|||
|
|
@ -1,29 +1,42 @@
|
|||
import { BlockEnum } from './types'
|
||||
import StartNodeDefault from './nodes/start/default'
|
||||
import DirectAnswerDefault from './nodes/direct-answer/default'
|
||||
import LLMDefault from './nodes/llm/default'
|
||||
import KnowledgeRetrievalDefault from './nodes/knowledge-retrieval/default'
|
||||
import QuestionClassifierDefault from './nodes/question-classifier/default'
|
||||
import IfElseDefault from './nodes/if-else/default'
|
||||
import CodeDefault from './nodes/code/default'
|
||||
import TemplateTransformDefault from './nodes/template-transform/default'
|
||||
import HttpRequestDefault from './nodes/http/default'
|
||||
import ToolDefault from './nodes/tool/default'
|
||||
import VariableAssignerDefault from './nodes/variable-assigner/default'
|
||||
import EndNodeDefault from './nodes/end/default'
|
||||
|
||||
export const NodeInitialData = {
|
||||
[BlockEnum.Start]: {
|
||||
type: BlockEnum.Start,
|
||||
title: '',
|
||||
desc: '',
|
||||
variables: [],
|
||||
...StartNodeDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.End]: {
|
||||
type: BlockEnum.End,
|
||||
title: '',
|
||||
desc: '',
|
||||
outputs: {},
|
||||
...EndNodeDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.DirectAnswer]: {
|
||||
type: BlockEnum.DirectAnswer,
|
||||
title: '',
|
||||
desc: '',
|
||||
variables: [],
|
||||
...DirectAnswerDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.LLM]: {
|
||||
type: BlockEnum.LLM,
|
||||
title: '',
|
||||
desc: '',
|
||||
variables: [],
|
||||
...LLMDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.KnowledgeRetrieval]: {
|
||||
type: BlockEnum.KnowledgeRetrieval,
|
||||
|
|
@ -32,9 +45,10 @@ export const NodeInitialData = {
|
|||
query_variable_selector: [],
|
||||
dataset_ids: [],
|
||||
retrieval_mode: 'single',
|
||||
...KnowledgeRetrievalDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.IfElse]: {
|
||||
targetBranches: [
|
||||
_targetBranches: [
|
||||
{
|
||||
id: 'if-true',
|
||||
name: 'IS TRUE',
|
||||
|
|
@ -49,6 +63,7 @@ export const NodeInitialData = {
|
|||
desc: '',
|
||||
logical_operator: 'and',
|
||||
conditions: [],
|
||||
...IfElseDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.Code]: {
|
||||
type: BlockEnum.Code,
|
||||
|
|
@ -58,6 +73,7 @@ export const NodeInitialData = {
|
|||
code_language: 'python3',
|
||||
code: '',
|
||||
outputs: [],
|
||||
...CodeDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.TemplateTransform]: {
|
||||
type: BlockEnum.TemplateTransform,
|
||||
|
|
@ -65,6 +81,7 @@ export const NodeInitialData = {
|
|||
desc: '',
|
||||
variables: [],
|
||||
template: '',
|
||||
...TemplateTransformDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.QuestionClassifier]: {
|
||||
type: BlockEnum.QuestionClassifier,
|
||||
|
|
@ -72,12 +89,14 @@ export const NodeInitialData = {
|
|||
desc: '',
|
||||
query_variable_selector: [],
|
||||
topics: [],
|
||||
...QuestionClassifierDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.HttpRequest]: {
|
||||
type: BlockEnum.HttpRequest,
|
||||
title: '',
|
||||
desc: '',
|
||||
variables: [],
|
||||
...HttpRequestDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.VariableAssigner]: {
|
||||
type: BlockEnum.VariableAssigner,
|
||||
|
|
@ -85,11 +104,13 @@ export const NodeInitialData = {
|
|||
desc: '',
|
||||
variables: [],
|
||||
output_type: '',
|
||||
...VariableAssignerDefault.defaultValue,
|
||||
},
|
||||
[BlockEnum.Tool]: {
|
||||
type: BlockEnum.Tool,
|
||||
title: '',
|
||||
desc: '',
|
||||
...ToolDefault.defaultValue,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ import type { NodeDefault } from '../../types'
|
|||
import type { DirectAnswerNodeType } from './types'
|
||||
|
||||
const nodeDefault: NodeDefault<DirectAnswerNodeType> = {
|
||||
defaultValue: {},
|
||||
defaultValue: {
|
||||
variables: [],
|
||||
answer: '',
|
||||
},
|
||||
getAvailablePrevNodes() {
|
||||
return []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ import type { NodeDefault } from '../../types'
|
|||
import type { LLMNodeType } from './types'
|
||||
|
||||
const nodeDefault: NodeDefault<LLMNodeType> = {
|
||||
defaultValue: {},
|
||||
defaultValue: {
|
||||
|
||||
},
|
||||
getAvailablePrevNodes() {
|
||||
return []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import type { NodeProps } from '@/app/components/workflow/types'
|
|||
const Node: FC<NodeProps<LLMNodeType>> = ({
|
||||
data,
|
||||
}) => {
|
||||
const { provider, name: modelId } = data.model
|
||||
const { provider, name: modelId } = data.model || {}
|
||||
const {
|
||||
textGenerationModelList,
|
||||
} = useTextGenerationCurrentProviderAndModelAndModelList()
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ const Panel: FC<NodeProps<LLMNodeType>> = ({
|
|||
isAdvancedMode={true}
|
||||
mode={model?.mode}
|
||||
provider={model?.provider}
|
||||
completionParams={model.completion_params}
|
||||
modelId={model.name}
|
||||
completionParams={model?.completion_params}
|
||||
modelId={model?.name}
|
||||
setModel={handleModelChanged}
|
||||
onCompletionParamsChange={handleCompletionParamsChange}
|
||||
hideDebugWithMultipleModel
|
||||
|
|
@ -81,7 +81,7 @@ const Panel: FC<NodeProps<LLMNodeType>> = ({
|
|||
<VarReferencePicker
|
||||
readonly={readOnly}
|
||||
isShowNodeName
|
||||
value={inputs.context.variable_selector}
|
||||
value={inputs.context?.variable_selector || []}
|
||||
onChange={handleContextVarChange}
|
||||
/>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ import type { NodeDefault } from '../../types'
|
|||
import type { StartNodeType } from './types'
|
||||
|
||||
const nodeDefault: NodeDefault<StartNodeType> = {
|
||||
defaultValue: {},
|
||||
defaultValue: {
|
||||
variables: [],
|
||||
},
|
||||
getAvailablePrevNodes() {
|
||||
return []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const Node: FC<NodeProps<StartNodeType>> = ({
|
|||
data,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { variables = [] } = data
|
||||
const { variables } = data
|
||||
|
||||
return (
|
||||
<div className='px-3'>
|
||||
|
|
|
|||
Loading…
Reference in New Issue