mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -1,33 +1,32 @@
|
||||
import type { FC } from 'react'
|
||||
import type { KnowledgeBaseNodeType } from './types'
|
||||
import type { NodePanelProps, Var } from '@/app/components/workflow/types'
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
useMemo,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { KnowledgeBaseNodeType } from './types'
|
||||
import {
|
||||
ChunkStructureEnum,
|
||||
IndexMethodEnum,
|
||||
} from './types'
|
||||
import ChunkStructure from './components/chunk-structure'
|
||||
import IndexMethod from './components/index-method'
|
||||
import RetrievalSetting from './components/retrieval-setting'
|
||||
import EmbeddingModel from './components/embedding-model'
|
||||
import { useConfig } from './hooks/use-config'
|
||||
import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||
import { checkShowMultiModalTip } from '@/app/components/datasets/settings/utils'
|
||||
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import { useModelList } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { useNodesReadOnly } from '@/app/components/workflow/hooks'
|
||||
import {
|
||||
BoxGroup,
|
||||
BoxGroupField,
|
||||
Group,
|
||||
} from '@/app/components/workflow/nodes/_base/components/layout'
|
||||
import Split from '../_base/components/split'
|
||||
import { useNodesReadOnly } from '@/app/components/workflow/hooks'
|
||||
import VarReferencePicker from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker'
|
||||
import type { Var } from '@/app/components/workflow/types'
|
||||
import { checkShowMultiModalTip } from '@/app/components/datasets/settings/utils'
|
||||
import { useModelList } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import Split from '../_base/components/split'
|
||||
import ChunkStructure from './components/chunk-structure'
|
||||
import EmbeddingModel from './components/embedding-model'
|
||||
import IndexMethod from './components/index-method'
|
||||
import RetrievalSetting from './components/retrieval-setting'
|
||||
import { useConfig } from './hooks/use-config'
|
||||
import {
|
||||
ChunkStructureEnum,
|
||||
IndexMethodEnum,
|
||||
} from './types'
|
||||
|
||||
const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
id,
|
||||
@ -55,7 +54,8 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
} = useConfig(id)
|
||||
|
||||
const filterVar = useCallback((variable: Var) => {
|
||||
if (!data.chunk_structure) return false
|
||||
if (!data.chunk_structure)
|
||||
return false
|
||||
switch (data.chunk_structure) {
|
||||
case ChunkStructureEnum.general:
|
||||
return variable.schemaType === 'general_structure' || variable.schemaType === 'multimodal_general_structure'
|
||||
@ -69,7 +69,8 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
}, [data.chunk_structure])
|
||||
|
||||
const chunkTypePlaceHolder = useMemo(() => {
|
||||
if (!data.chunk_structure) return ''
|
||||
if (!data.chunk_structure)
|
||||
return ''
|
||||
let placeholder = ''
|
||||
switch (data.chunk_structure) {
|
||||
case ChunkStructureEnum.general:
|
||||
@ -107,7 +108,7 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
return (
|
||||
<div>
|
||||
<Group
|
||||
className='py-3'
|
||||
className="py-3"
|
||||
withBorderBottom={!!data.chunk_structure}
|
||||
>
|
||||
<ChunkStructure
|
||||
@ -144,7 +145,7 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
/>
|
||||
</BoxGroupField>
|
||||
<BoxGroup>
|
||||
<div className='space-y-3'>
|
||||
<div className="space-y-3">
|
||||
<IndexMethod
|
||||
chunkStructure={data.chunk_structure}
|
||||
indexMethod={data.indexing_technique}
|
||||
@ -163,8 +164,8 @@ const Panel: FC<NodePanelProps<KnowledgeBaseNodeType>> = ({
|
||||
/>
|
||||
)
|
||||
}
|
||||
<div className='pt-1'>
|
||||
<Split className='h-[1px]' />
|
||||
<div className="pt-1">
|
||||
<Split className="h-[1px]" />
|
||||
</div>
|
||||
<RetrievalSetting
|
||||
indexMethod={data.indexing_technique}
|
||||
|
||||
Reference in New Issue
Block a user