feat: bottom to show vars

feat/enchance-prompt-and-code-fe
Joel 7 months ago
parent ab45f3ce26
commit 07288bda8b

@ -8,6 +8,8 @@ import type { Node, NodeOutPutVar, ValueSelector } from '@/app/components/workfl
import { BlockEnum } from '@/app/components/workflow/types' import { BlockEnum } from '@/app/components/workflow/types'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { Type } from '@/app/components/workflow/nodes/llm/types' import { Type } from '@/app/components/workflow/nodes/llm/types'
import { PROMPT_EDITOR_INSERT_QUICKLY } from '@/app/components/base/prompt-editor/plugins/update-block'
import { useEventEmitterContextContext } from '@/context/event-emitter'
type Props = { type Props = {
editorKey: string editorKey: string
@ -38,6 +40,8 @@ const InstructionEditor: FC<Props> = ({
isShowLastRunBlock, isShowLastRunBlock,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { eventEmitter } = useEventEmitterContextContext()
const isBasicMode = !!getVarType const isBasicMode = !!getVarType
// const [controlPromptEditorRerenderKey] = // const [controlPromptEditorRerenderKey] =
const isCode = generatorType === 'code' const isCode = generatorType === 'code'
@ -52,14 +56,19 @@ const InstructionEditor: FC<Props> = ({
</div> </div>
) )
const handleInsertVariable = () => {
eventEmitter?.emit({ type: PROMPT_EDITOR_INSERT_QUICKLY, instanceId: editorKey } as any)
}
return ( return (
<div> <div className='relative'>
<PromptEditor <PromptEditor
wrapperClassName='border !border-components-input-bg-normal bg-components-input-bg-normal hover:!border-components-input-bg-hover rounded-[10px] px-4 pt-3' wrapperClassName='border !border-components-input-bg-normal bg-components-input-bg-normal hover:!border-components-input-bg-hover rounded-[10px] px-4 pt-3'
key={editorKey} key={editorKey}
instanceId={editorKey}
placeholder={placeholder} placeholder={placeholder}
placeholderClassName='px-4 pt-3' placeholderClassName='px-4 pt-3'
className={cn('min-h-[240px] ')} className={cn('min-h-[240px] pb-8')}
value={value} value={value}
workflowVariableBlock={{ workflowVariableBlock={{
show: true, show: true,
@ -96,6 +105,12 @@ const InstructionEditor: FC<Props> = ({
editable editable
isSupportFileVar={false} isSupportFileVar={false}
/> />
<div className='system-xs-regular absolute bottom-0 left-3 flex h-8 items-center space-x-0.5 text-components-input-text-placeholder'>
<span>{t('appDebug.generate.press')}</span>
<span className='system-kbd flex h-4 w-3.5 items-center justify-center rounded-[4px] bg-components-kbd-bg-gray text-text-placeholder'>/</span>
<span>{t('appDebug.generate.to')}</span>
<span onClick={handleInsertVariable} className='!ml-1 cursor-pointer hover:border-b hover:border-dotted hover:border-text-tertiary hover:text-text-tertiary'>{t('appDebug.generate.insertContext')}</span>
</div>
</div> </div>
) )
} }

@ -302,6 +302,9 @@ const translation = {
instruction: 'Use advanced copyediting techniques to improve your writings', instruction: 'Use advanced copyediting techniques to improve your writings',
}, },
}, },
press: 'Press',
to: 'to ',
insertContext: 'insert context',
}, },
resetConfig: { resetConfig: {
title: 'Confirm reset?', title: 'Confirm reset?',

@ -301,6 +301,9 @@ const translation = {
instruction: '用地道的编辑技巧改进我的文章', instruction: '用地道的编辑技巧改进我的文章',
}, },
}, },
press: '输入',
to: '来',
insertContext: '插入上下文',
}, },
resetConfig: { resetConfig: {
title: '确认重置?', title: '确认重置?',

Loading…
Cancel
Save