mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
Fix type error (#27044)
This commit is contained in:
parent
6517323add
commit
4f7cb7cd2a
@ -25,8 +25,8 @@ export type TextareaProps = {
|
|||||||
destructive?: boolean
|
destructive?: boolean
|
||||||
styleCss?: CSSProperties
|
styleCss?: CSSProperties
|
||||||
ref?: React.Ref<HTMLTextAreaElement>
|
ref?: React.Ref<HTMLTextAreaElement>
|
||||||
onFocus?: () => void
|
onFocus?: React.FocusEventHandler<HTMLTextAreaElement>
|
||||||
onBlur?: () => void
|
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>
|
||||||
} & React.TextareaHTMLAttributes<HTMLTextAreaElement> & VariantProps<typeof textareaVariants>
|
} & React.TextareaHTMLAttributes<HTMLTextAreaElement> & VariantProps<typeof textareaVariants>
|
||||||
|
|
||||||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||||
|
|||||||
@ -18,7 +18,7 @@ type ConditionNumberProps = {
|
|||||||
nodesOutputVars: NodeOutPutVar[]
|
nodesOutputVars: NodeOutPutVar[]
|
||||||
availableNodes: Node[]
|
availableNodes: Node[]
|
||||||
isCommonVariable?: boolean
|
isCommonVariable?: boolean
|
||||||
commonVariables: { name: string, type: string }[]
|
commonVariables: { name: string; type: string; value: string }[]
|
||||||
} & ConditionValueMethodProps
|
} & ConditionValueMethodProps
|
||||||
const ConditionNumber = ({
|
const ConditionNumber = ({
|
||||||
value,
|
value,
|
||||||
|
|||||||
@ -18,7 +18,7 @@ type ConditionStringProps = {
|
|||||||
nodesOutputVars: NodeOutPutVar[]
|
nodesOutputVars: NodeOutPutVar[]
|
||||||
availableNodes: Node[]
|
availableNodes: Node[]
|
||||||
isCommonVariable?: boolean
|
isCommonVariable?: boolean
|
||||||
commonVariables: { name: string, type: string }[]
|
commonVariables: { name: string; type: string; value: string }[]
|
||||||
} & ConditionValueMethodProps
|
} & ConditionValueMethodProps
|
||||||
const ConditionString = ({
|
const ConditionString = ({
|
||||||
value,
|
value,
|
||||||
|
|||||||
@ -128,6 +128,6 @@ export type MetadataShape = {
|
|||||||
availableNumberVars?: NodeOutPutVar[]
|
availableNumberVars?: NodeOutPutVar[]
|
||||||
availableNumberNodesWithParent?: Node[]
|
availableNumberNodesWithParent?: Node[]
|
||||||
isCommonVariable?: boolean
|
isCommonVariable?: boolean
|
||||||
availableCommonStringVars?: { name: string; type: string; }[]
|
availableCommonStringVars?: { name: string; type: string; value: string }[]
|
||||||
availableCommonNumberVars?: { name: string; type: string; }[]
|
availableCommonNumberVars?: { name: string; type: string; value: string }[]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const JsonImporter: FC<JsonImporterProps> = ({
|
|||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [json, setJson] = useState('')
|
const [json, setJson] = useState('')
|
||||||
const [parseError, setParseError] = useState<any>(null)
|
const [parseError, setParseError] = useState<any>(null)
|
||||||
const importBtnRef = useRef<HTMLButtonElement>(null)
|
const importBtnRef = useRef<HTMLElement>(null)
|
||||||
const advancedEditing = useVisualEditorStore(state => state.advancedEditing)
|
const advancedEditing = useVisualEditorStore(state => state.advancedEditing)
|
||||||
const isAddingNewField = useVisualEditorStore(state => state.isAddingNewField)
|
const isAddingNewField = useVisualEditorStore(state => state.isAddingNewField)
|
||||||
const { emit } = useMittContext()
|
const { emit } = useMittContext()
|
||||||
|
|||||||
@ -18,7 +18,7 @@ type VisualEditorProviderProps = {
|
|||||||
export const VisualEditorContext = createContext<VisualEditorContextType>(null)
|
export const VisualEditorContext = createContext<VisualEditorContextType>(null)
|
||||||
|
|
||||||
export const VisualEditorContextProvider = ({ children }: VisualEditorProviderProps) => {
|
export const VisualEditorContextProvider = ({ children }: VisualEditorProviderProps) => {
|
||||||
const storeRef = useRef<VisualEditorStore>()
|
const storeRef = useRef<VisualEditorStore | null>(null)
|
||||||
|
|
||||||
if (!storeRef.current)
|
if (!storeRef.current)
|
||||||
storeRef.current = createVisualEditorStore()
|
storeRef.current = createVisualEditorStore()
|
||||||
|
|||||||
@ -23,7 +23,7 @@ const useConfig = (id: string, payload: LLMNodeType) => {
|
|||||||
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
const { nodesReadOnly: readOnly } = useNodesReadOnly()
|
||||||
const isChatMode = useIsChatMode()
|
const isChatMode = useIsChatMode()
|
||||||
|
|
||||||
const defaultConfig = useStore(s => s.nodesDefaultConfigs)[payload.type]
|
const defaultConfig = useStore(s => s.nodesDefaultConfigs)?.[payload.type]
|
||||||
const [defaultRolePrefix, setDefaultRolePrefix] = useState<{ user: string; assistant: string }>({ user: '', assistant: '' })
|
const [defaultRolePrefix, setDefaultRolePrefix] = useState<{ user: string; assistant: string }>({ user: '', assistant: '' })
|
||||||
const { inputs, setInputs: doSetInputs } = useNodeCrud<LLMNodeType>(id, payload)
|
const { inputs, setInputs: doSetInputs } = useNodeCrud<LLMNodeType>(id, payload)
|
||||||
const inputRef = useRef(inputs)
|
const inputRef = useRef(inputs)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ export const checkNodeValid = (_payload: LLMNodeType) => {
|
|||||||
|
|
||||||
export const getFieldType = (field: Field) => {
|
export const getFieldType = (field: Field) => {
|
||||||
const { type, items } = field
|
const { type, items } = field
|
||||||
if(field.schemaType === 'file') return 'file'
|
if(field.schemaType === 'file') return Type.file
|
||||||
if (type !== Type.array || !items)
|
if (type !== Type.array || !items)
|
||||||
return type
|
return type
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,10 @@ import BlockSelector from '../../../../block-selector'
|
|||||||
import type { Param, ParamType } from '../../types'
|
import type { Param, ParamType } from '../../types'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import { useStore } from '@/app/components/workflow/store'
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
|
import type {
|
||||||
|
DataSourceDefaultValue,
|
||||||
|
ToolDefaultValue,
|
||||||
|
} from '@/app/components/workflow/block-selector/types'
|
||||||
import type { ToolParameter } from '@/app/components/tools/types'
|
import type { ToolParameter } from '@/app/components/tools/types'
|
||||||
import { CollectionType } from '@/app/components/tools/types'
|
import { CollectionType } from '@/app/components/tools/types'
|
||||||
import type { BlockEnum } from '@/app/components/workflow/types'
|
import type { BlockEnum } from '@/app/components/workflow/types'
|
||||||
@ -43,8 +46,11 @@ const ImportFromTool: FC<Props> = ({
|
|||||||
const customTools = useStore(s => s.customTools)
|
const customTools = useStore(s => s.customTools)
|
||||||
const workflowTools = useStore(s => s.workflowTools)
|
const workflowTools = useStore(s => s.workflowTools)
|
||||||
|
|
||||||
const handleSelectTool = useCallback((_type: BlockEnum, toolInfo?: ToolDefaultValue) => {
|
const handleSelectTool = useCallback((_type: BlockEnum, toolInfo?: ToolDefaultValue | DataSourceDefaultValue) => {
|
||||||
const { provider_id, provider_type, tool_name } = toolInfo!
|
if (!toolInfo || 'datasource_name' in toolInfo)
|
||||||
|
return
|
||||||
|
|
||||||
|
const { provider_id, provider_type, tool_name } = toolInfo
|
||||||
const currentTools = (() => {
|
const currentTools = (() => {
|
||||||
switch (provider_type) {
|
switch (provider_type) {
|
||||||
case CollectionType.builtIn:
|
case CollectionType.builtIn:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user