mirror of https://github.com/langgenius/dify.git
96 lines
2.2 KiB
TypeScript
96 lines
2.2 KiB
TypeScript
import { groupBy } from 'lodash-es'
|
|
import type { Block } from '../types'
|
|
import { BlockEnum } from '../types'
|
|
|
|
export const TABS = [
|
|
{
|
|
key: 'blocks',
|
|
name: 'Blocks',
|
|
},
|
|
{
|
|
key: 'built-in-tool',
|
|
name: 'Built-in Tool',
|
|
},
|
|
{
|
|
key: 'custom-tool',
|
|
name: 'Custom Tool',
|
|
},
|
|
]
|
|
|
|
export enum BlockClassificationEnum {
|
|
Default = '-',
|
|
QuestionUnderstand = 'question-understand',
|
|
Logic = 'logic',
|
|
Transform = 'transform',
|
|
Utilities = 'utilities',
|
|
}
|
|
|
|
export const BLOCKS: Block[] = [
|
|
{
|
|
classification: BlockClassificationEnum.Default,
|
|
type: BlockEnum.Start,
|
|
title: 'Start',
|
|
description: '',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Default,
|
|
type: BlockEnum.LLM,
|
|
title: 'LLM',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Default,
|
|
type: BlockEnum.End,
|
|
title: 'End',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Default,
|
|
type: BlockEnum.DirectAnswer,
|
|
title: 'Direct Answer',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.QuestionUnderstand,
|
|
type: BlockEnum.KnowledgeRetrieval,
|
|
title: 'Knowledge Retrieval',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.QuestionUnderstand,
|
|
type: BlockEnum.QuestionClassifier,
|
|
title: 'Question Classifier',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Logic,
|
|
type: BlockEnum.IfElse,
|
|
title: 'IF/ELSE',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Transform,
|
|
type: BlockEnum.Code,
|
|
title: 'Code',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Transform,
|
|
type: BlockEnum.TemplateTransform,
|
|
title: 'Templating Transform',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Transform,
|
|
type: BlockEnum.VariableAssigner,
|
|
title: 'Variable Assigner',
|
|
},
|
|
{
|
|
classification: BlockClassificationEnum.Utilities,
|
|
type: BlockEnum.HttpRequest,
|
|
title: 'HTTP Request',
|
|
},
|
|
]
|
|
|
|
export const BLOCK_CLASSIFICATIONS: string[] = [
|
|
BlockClassificationEnum.Default,
|
|
BlockClassificationEnum.QuestionUnderstand,
|
|
BlockClassificationEnum.Logic,
|
|
BlockClassificationEnum.Transform,
|
|
BlockClassificationEnum.Utilities,
|
|
]
|
|
|
|
export const BLOCK_GROUP_BY_CLASSIFICATION = groupBy(BLOCKS, 'classification')
|