feat: question classify node support use var in instruction (#4710)

This commit is contained in:
Joel
2024-06-04 14:01:40 +08:00
committed by GitHub
parent 86e7c7321f
commit a38dfc006e
4 changed files with 87 additions and 20 deletions

View File

@@ -2,9 +2,9 @@
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 Editor from '@/app/components/workflow/nodes/_base/components/prompt/editor'
import type { Memory, Node, NodeOutPutVar } 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'
@@ -16,6 +16,15 @@ type Props = {
memory?: Memory
onMemoryChange: (memory?: Memory) => void
readonly?: boolean
isChatModel: boolean
isChatApp: boolean
hasSetBlockStatus?: {
context: boolean
history: boolean
query: boolean
}
nodesOutputVars: NodeOutPutVar[]
availableNodes: Node[]
}
const AdvancedSetting: FC<Props> = ({
@@ -25,13 +34,17 @@ const AdvancedSetting: FC<Props> = ({
memory,
onMemoryChange,
readonly,
isChatModel,
isChatApp,
hasSetBlockStatus,
nodesOutputVars,
availableNodes,
}) => {
const { t } = useTranslation()
return (
<>
<TextEditor
isInNode
<Editor
title={
<div className='flex items-center space-x-1'>
<span className='uppercase'>{t(`${i18nPrefix}.instruction`)}</span>
@@ -45,15 +58,13 @@ const AdvancedSetting: FC<Props> = ({
}
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}
readOnly={readonly}
isChatModel={isChatModel}
isChatApp={isChatApp}
isShowContext={false}
hasSetBlockStatus={hasSetBlockStatus}
nodesOutputVars={nodesOutputVars}
availableNodes={availableNodes}
/>
{!hideMemorySetting && (
<MemoryConfig