style(question-classifier): fix line endings and whitespace in panel component

pull/22066/head
Mminamiyama 11 months ago
parent d6cfb21992
commit 3e1d5e23df

@ -1,146 +1,146 @@
import type { FC } from 'react' import type { FC } from 'react'
import React from 'react' import React from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import VarReferencePicker from '../_base/components/variable/var-reference-picker' import VarReferencePicker from '../_base/components/variable/var-reference-picker'
import ConfigVision from '../_base/components/config-vision' import ConfigVision from '../_base/components/config-vision'
import useConfig from './use-config' import useConfig from './use-config'
import ClassList from './components/class-list' import ClassList from './components/class-list'
import AdvancedSetting from './components/advanced-setting' import AdvancedSetting from './components/advanced-setting'
import type { QuestionClassifierNodeType } from './types' import type { QuestionClassifierNodeType } from './types'
import Field from '@/app/components/workflow/nodes/_base/components/field' import Field from '@/app/components/workflow/nodes/_base/components/field'
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal' import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
import type { NodePanelProps } from '@/app/components/workflow/types' import type { NodePanelProps } from '@/app/components/workflow/types'
import Split from '@/app/components/workflow/nodes/_base/components/split' import Split from '@/app/components/workflow/nodes/_base/components/split'
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse' import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
const i18nPrefix = 'workflow.nodes.questionClassifiers' const i18nPrefix = 'workflow.nodes.questionClassifiers'
const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
id, id,
data, data,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { const {
readOnly, readOnly,
inputs, inputs,
handleModelChanged, handleModelChanged,
isChatMode, isChatMode,
isChatModel, isChatModel,
handleCompletionParamsChange, handleCompletionParamsChange,
handleQueryVarChange, handleQueryVarChange,
handleTopicsChange, handleTopicsChange,
hasSetBlockStatus, hasSetBlockStatus,
availableVars, availableVars,
availableNodesWithParent, availableNodesWithParent,
handleInstructionChange, handleInstructionChange,
handleMemoryChange, handleMemoryChange,
isVisionModel, isVisionModel,
handleVisionResolutionChange, handleVisionResolutionChange,
handleVisionResolutionEnabledChange, handleVisionResolutionEnabledChange,
filterVar, filterVar,
handleSortTopic, handleSortTopic,
} = useConfig(id, data) } = useConfig(id, data)
const model = inputs.model const model = inputs.model
return ( return (
<div className='pt-2'> <div className='pt-2'>
<div className='space-y-4 px-4'> <div className='space-y-4 px-4'>
<Field <Field
title={t(`${i18nPrefix}.model`)} title={t(`${i18nPrefix}.model`)}
required required
> >
<ModelParameterModal <ModelParameterModal
popupClassName='!w-[387px]' popupClassName='!w-[387px]'
isInWorkflow isInWorkflow
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}
readonly={readOnly} readonly={readOnly}
/> />
</Field> </Field>
<Field <Field
title={t(`${i18nPrefix}.inputVars`)} title={t(`${i18nPrefix}.inputVars`)}
required required
> >
<VarReferencePicker <VarReferencePicker
readonly={readOnly} readonly={readOnly}
isShowNodeName isShowNodeName
nodeId={id} nodeId={id}
value={inputs.query_variable_selector} value={inputs.query_variable_selector}
onChange={handleQueryVarChange} onChange={handleQueryVarChange}
filterVar={filterVar} filterVar={filterVar}
/> />
</Field> </Field>
<Split /> <Split />
<ConfigVision <ConfigVision
nodeId={id} nodeId={id}
readOnly={readOnly} readOnly={readOnly}
isVisionModel={isVisionModel} isVisionModel={isVisionModel}
enabled={inputs.vision?.enabled} enabled={inputs.vision?.enabled}
onEnabledChange={handleVisionResolutionEnabledChange} onEnabledChange={handleVisionResolutionEnabledChange}
config={inputs.vision?.configs} config={inputs.vision?.configs}
onConfigChange={handleVisionResolutionChange} onConfigChange={handleVisionResolutionChange}
/> />
<Field <Field
title={t(`${i18nPrefix}.class`)} title={t(`${i18nPrefix}.class`)}
required required
> >
<ClassList <ClassList
nodeId={id} nodeId={id}
list={inputs.classes} list={inputs.classes}
onChange={handleTopicsChange} onChange={handleTopicsChange}
readonly={readOnly} readonly={readOnly}
filterVar={filterVar} filterVar={filterVar}
handleSortTopic={handleSortTopic} handleSortTopic={handleSortTopic}
/> />
</Field> </Field>
<Split /> <Split />
</div> </div>
<FieldCollapse <FieldCollapse
title={t(`${i18nPrefix}.advancedSetting`)} title={t(`${i18nPrefix}.advancedSetting`)}
> >
<AdvancedSetting <AdvancedSetting
hideMemorySetting={!isChatMode} hideMemorySetting={!isChatMode}
instruction={inputs.instruction} instruction={inputs.instruction}
onInstructionChange={handleInstructionChange} onInstructionChange={handleInstructionChange}
memory={inputs.memory} memory={inputs.memory}
onMemoryChange={handleMemoryChange} onMemoryChange={handleMemoryChange}
readonly={readOnly} readonly={readOnly}
isChatApp={isChatMode} isChatApp={isChatMode}
isChatModel={isChatModel} isChatModel={isChatModel}
hasSetBlockStatus={hasSetBlockStatus} hasSetBlockStatus={hasSetBlockStatus}
nodesOutputVars={availableVars} nodesOutputVars={availableVars}
availableNodes={availableNodesWithParent} availableNodes={availableNodesWithParent}
/> />
</FieldCollapse> </FieldCollapse>
<Split /> <Split />
<div> <div>
<OutputVars> <OutputVars>
<> <>
<VarItem <VarItem
name='class_name' name='class_name'
type='string' type='string'
description={t(`${i18nPrefix}.outputVars.className`)} description={t(`${i18nPrefix}.outputVars.className`)}
/> />
<VarItem <VarItem
name='usage' name='usage'
type='object' type='object'
description={t(`${i18nPrefix}.outputVars.usage`)} description={t(`${i18nPrefix}.outputVars.usage`)}
/> />
</> </>
</OutputVars> </OutputVars>
</div> </div>
</div> </div>
) )
} }
export default React.memo(Panel) export default React.memo(Panel)

Loading…
Cancel
Save