mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
chore: new block enum
This commit is contained in:
parent
ada558bedc
commit
2386eed703
@ -3,15 +3,16 @@
|
|||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import Workflow from '@/app/components/workflow'
|
import Workflow from '@/app/components/workflow'
|
||||||
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
const nodes = [
|
const nodes = [
|
||||||
'start', 'directAnswer', 'llm', 'knowledgeRetrieval', 'questionClassifier',
|
BlockEnum.Start, BlockEnum.DirectAnswer, BlockEnum.LLM, BlockEnum.KnowledgeRetrieval, BlockEnum.QuestionClassifier,
|
||||||
'questionClassifier', 'ifElse', 'code', 'templateTransform', 'http',
|
BlockEnum.QuestionClassifier, BlockEnum.IfElse, BlockEnum.Code, BlockEnum.TemplateTransform, BlockEnum.HttpRequest,
|
||||||
'tool',
|
BlockEnum.Tool,
|
||||||
].map((item, i) => ({
|
].map((item, i) => ({
|
||||||
id: `${i + 1}`,
|
id: `${i + 1}`,
|
||||||
type: 'custom',
|
type: 'custom',
|
||||||
position: { x: 330, y: 30 + i * 200 },
|
position: { x: 330, y: 30 + i * 200 },
|
||||||
data: { type: item },
|
data: { type: item, name: item },
|
||||||
}))
|
}))
|
||||||
const initialNodes = nodes
|
const initialNodes = nodes
|
||||||
|
|
||||||
|
|||||||
@ -29,78 +29,75 @@ const Panel: FC = () => {
|
|||||||
// const isChatMode = modelMode === 'chat'
|
// const isChatMode = modelMode === 'chat'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePanel
|
<BasePanel>
|
||||||
inputsElement={
|
<div className='mt-2 px-4 space-y-4'>
|
||||||
<div className='mt-2 px-4 space-y-4'>
|
<Field
|
||||||
<Field
|
title={t(`${i18nPrefix}.model`)}
|
||||||
title={t(`${i18nPrefix}.model`)}
|
>
|
||||||
>
|
<ModelParameterModal
|
||||||
<ModelParameterModal
|
popupClassName='!w-[387px]'
|
||||||
popupClassName='!w-[387px]'
|
isAdvancedMode={true}
|
||||||
isAdvancedMode={true}
|
mode={model?.mode}
|
||||||
mode={model?.mode}
|
provider={model?.provider}
|
||||||
provider={model?.provider}
|
completionParams={model.completion_params}
|
||||||
completionParams={model.completion_params}
|
modelId={model.name}
|
||||||
modelId={model.name}
|
setModel={handleModelChanged}
|
||||||
setModel={handleModelChanged}
|
onCompletionParamsChange={handleCompletionParamsChange}
|
||||||
onCompletionParamsChange={handleCompletionParamsChange}
|
hideDebugWithMultipleModel
|
||||||
hideDebugWithMultipleModel
|
debugWithMultipleModel={false}
|
||||||
debugWithMultipleModel={false}
|
/>
|
||||||
/>
|
</Field>
|
||||||
</Field>
|
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
title={t(`${i18nPrefix}.variables`)}
|
title={t(`${i18nPrefix}.variables`)}
|
||||||
operations={
|
operations={
|
||||||
<AddButton onClick={handleAddVariable} />
|
<AddButton onClick={handleAddVariable} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<VarList
|
<VarList
|
||||||
readonly={readOnly}
|
readonly={readOnly}
|
||||||
list={inputs.variables}
|
list={inputs.variables}
|
||||||
onChange={handleVarListChange}
|
onChange={handleVarListChange}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
title={t(`${i18nPrefix}.context`)}
|
title={t(`${i18nPrefix}.context`)}
|
||||||
operations={
|
operations={
|
||||||
<Switch
|
<Switch
|
||||||
defaultValue={inputs.context.enabled}
|
defaultValue={inputs.context.enabled}
|
||||||
onChange={toggleContextEnabled}
|
onChange={toggleContextEnabled}
|
||||||
size='md'
|
size='md'
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{inputs.context.enabled
|
{inputs.context.enabled
|
||||||
? (
|
? (
|
||||||
<div>Context</div>
|
<div>Context</div>
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
</Field>
|
</Field>
|
||||||
<Field
|
<Field
|
||||||
title={t(`${i18nPrefix}.prompt`)}
|
title={t(`${i18nPrefix}.prompt`)}
|
||||||
>
|
>
|
||||||
Prompt
|
Prompt
|
||||||
</Field>
|
</Field>
|
||||||
<Split />
|
<Split />
|
||||||
<Field
|
<Field
|
||||||
title={t(`${i18nPrefix}.vision`)}
|
title={t(`${i18nPrefix}.vision`)}
|
||||||
inline
|
inline
|
||||||
>
|
>
|
||||||
Vision
|
Vision
|
||||||
</Field>
|
</Field>
|
||||||
{/* This version not support function */}
|
{/* This version not support function */}
|
||||||
{/* <Field
|
{/* <Field
|
||||||
title={t(`${i18nPrefix}.fu`)}
|
title={t(`${i18nPrefix}.fu`)}
|
||||||
inline
|
inline
|
||||||
>
|
>
|
||||||
Functions
|
Functions
|
||||||
</Field> */}
|
</Field> */}
|
||||||
</div>
|
</div>
|
||||||
}
|
</BasePanel>
|
||||||
outputsElement={<div>start panel outputs</div>}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user