import type { FileEntity } from '@/app/components/base/file-uploader/types' import type { FileUploadConfigResponse } from '@/models/common' import type { VarInInspect } from '@/types/workflow' import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader' import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' import Textarea from '@/app/components/base/textarea' import ErrorMessage from '@/app/components/workflow/nodes/llm/components/json-schema-config-modal/error-message' import SchemaEditor from '@/app/components/workflow/nodes/llm/components/json-schema-config-modal/schema-editor' import { SupportUploadFileTypes } from '@/app/components/workflow/types' import { TransferMethod } from '@/types/app' import { cn } from '@/utils/classnames' import { PreviewMode } from '../../base/features/types' import BoolValue from '../panel/chat-variable-panel/components/bool-value' import DisplayContent from './display-content' import LargeDataAlert from './large-data-alert' import { PreviewType } from './types' type TextEditorSectionProps = { currentVar: VarInInspect value: unknown textEditorDisabled: boolean isTruncated: boolean onTextChange: (value: string) => void } export const TextEditorSection = ({ currentVar, value, textEditorDisabled, isTruncated, onTextChange, }: TextEditorSectionProps) => { return ( <> {isTruncated && } {currentVar.value_type === 'string' ? ( ) : ( onTextChange(e.target.value)} /> )} > ) } type BoolArraySectionProps = { values: boolean[] onChange: (nextValue: boolean[]) => void } export const BoolArraySection = ({ values, onChange, }: BoolArraySectionProps) => { return ( {values.map((value, index) => ( { const nextValue = [...values] nextValue[index] = newValue onChange(nextValue) }} /> ))} ) } type JsonEditorSectionProps = { hasChunks: boolean schemaType?: string valueType: VarInInspect['value_type'] json: string readonly: boolean isTruncated: boolean onChange: (value: string) => void } export const JsonEditorSection = ({ hasChunks, schemaType, valueType, json, readonly, isTruncated, onChange, }: JsonEditorSectionProps) => { if (hasChunks) { return ( ) } return ( ) } type FileEditorSectionProps = { currentVar: VarInInspect fileValue: FileEntity[] fileUploadConfig?: FileUploadConfigResponse textEditorDisabled: boolean onChange: (files: FileEntity[]) => void } export const FileEditorSection = ({ currentVar, fileValue, fileUploadConfig, textEditorDisabled, onChange, }: FileEditorSectionProps) => { return ( ) } export const ErrorMessages = ({ parseError, validationError, }: { parseError: Error | null validationError: string }) => { return ( <> {parseError && } {validationError && } > ) }