Feat/attachments (#9526)

Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: JzoNg <jzongcode@gmail.com>
This commit is contained in:
zxhlyh
2024-10-21 10:32:37 +08:00
committed by GitHub
parent 4fd2743efa
commit 7a1d6fe509
445 changed files with 11759 additions and 6922 deletions

View File

@@ -59,6 +59,7 @@ import {
UPDATE_HISTORY_EVENT_EMITTER,
} from './constants'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import cn from '@/utils/classnames'
export type PromptEditorProps = {
instanceId?: string
@@ -78,6 +79,7 @@ export type PromptEditorProps = {
variableBlock?: VariableBlockType
externalToolBlock?: ExternalToolBlockType
workflowVariableBlock?: WorkflowVariableBlockType
isSupportFileVar?: boolean
}
const PromptEditor: FC<PromptEditorProps> = ({
@@ -98,6 +100,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock,
externalToolBlock,
workflowVariableBlock,
isSupportFileVar,
}) => {
const { eventEmitter } = useEventEmitterContextContext()
const initialConfig = {
@@ -147,7 +150,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
<div className='relative min-h-5'>
<RichTextPlugin
contentEditable={<ContentEditable className={`${className} outline-none ${compact ? 'leading-5 text-[13px]' : 'leading-6 text-sm'} text-gray-700`} style={style || {}} />}
placeholder={<Placeholder value={placeholder} className={placeholderClassName} compact={compact} />}
placeholder={<Placeholder value={placeholder} className={cn('truncate', placeholderClassName)} compact={compact} />}
ErrorBoundary={LexicalErrorBoundary}
/>
<ComponentPickerBlock
@@ -158,6 +161,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock={variableBlock}
externalToolBlock={externalToolBlock}
workflowVariableBlock={workflowVariableBlock}
isSupportFileVar={isSupportFileVar}
/>
<ComponentPickerBlock
triggerString='{'
@@ -167,6 +171,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
variableBlock={variableBlock}
externalToolBlock={externalToolBlock}
workflowVariableBlock={workflowVariableBlock}
isSupportFileVar={isSupportFileVar}
/>
{
contextBlock?.show && (