
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Patryk Garstecki <patryk20120@yahoo.pl> Co-authored-by: Sebastian.W <thiner@gmail.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: takatost <takatost@users.noreply.github.com> Co-authored-by: rechardwang <wh_goodjob@163.com> Co-authored-by: Nite Knite <nkCoding@gmail.com> Co-authored-by: Chenhe Gu <guchenhe@gmail.com> Co-authored-by: Joshua <138381132+joshua20231026@users.noreply.github.com> Co-authored-by: Weaxs <459312872@qq.com> Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com> Co-authored-by: leejoo0 <81673835+leejoo0@users.noreply.github.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Vikey Chen <vikeytk@gmail.com> Co-authored-by: wanghl <Wang-HL@users.noreply.github.com> Co-authored-by: Haolin Wang-汪皓临 <haolin.wang@atlaslovestravel.com> Co-authored-by: Zixuan Cheng <61724187+Theysua@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: Bowen Liang <bowenliang@apache.org> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: fanghongtai <42790567+fanghongtai@users.noreply.github.com> Co-authored-by: wxfanghongtai <wxfanghongtai@gf.com.cn> Co-authored-by: Matri <qjp@bithuman.io> Co-authored-by: Benjamin <benjaminx@gmail.com>
71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
'use client'
|
|
import type { FC } from 'react'
|
|
import React from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import TextEditor from '../../_base/components/editor/text-editor'
|
|
import MemoryConfig from '../../_base/components/memory-config'
|
|
import type { Memory } from '@/app/components/workflow/types'
|
|
import TooltipPlus from '@/app/components/base/tooltip-plus'
|
|
import { HelpCircle } from '@/app/components/base/icons/src/vender/line/general'
|
|
const i18nPrefix = 'workflow.nodes.questionClassifiers'
|
|
|
|
type Props = {
|
|
instruction: string
|
|
onInstructionChange: (instruction: string) => void
|
|
hideMemorySetting: boolean
|
|
memory?: Memory
|
|
onMemoryChange: (memory?: Memory) => void
|
|
readonly?: boolean
|
|
}
|
|
|
|
const AdvancedSetting: FC<Props> = ({
|
|
instruction,
|
|
onInstructionChange,
|
|
hideMemorySetting,
|
|
memory,
|
|
onMemoryChange,
|
|
readonly,
|
|
}) => {
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<>
|
|
<TextEditor
|
|
isInNode
|
|
title={
|
|
<div className='flex items-center space-x-1'>
|
|
<span className='uppercase'>{t(`${i18nPrefix}.instruction`)}</span>
|
|
<TooltipPlus popupContent={
|
|
<div className='w-[120px]'>
|
|
{t(`${i18nPrefix}.instructionTip`)}
|
|
</div>}>
|
|
<HelpCircle className='w-3.5 h-3.5 ml-0.5 text-gray-400' />
|
|
</TooltipPlus>
|
|
</div>
|
|
}
|
|
value={instruction}
|
|
onChange={onInstructionChange}
|
|
minHeight={160}
|
|
placeholder={t(`${i18nPrefix}.instructionPlaceholder`)!}
|
|
headerRight={(
|
|
<div className='flex items-center h-full'>
|
|
<div className='text-xs font-medium text-gray-500'>{instruction?.length || 0}</div>
|
|
<div className='mx-3 h-3 w-px bg-gray-200'></div>
|
|
</div>
|
|
)}
|
|
readonly={readonly}
|
|
/>
|
|
{!hideMemorySetting && (
|
|
<MemoryConfig
|
|
className='mt-4'
|
|
readonly={false}
|
|
config={{ data: memory }}
|
|
onChange={onMemoryChange}
|
|
canSetRoleName={false}
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
export default React.memo(AdvancedSetting)
|