mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
feat: add i18n type generation scripts and improve code formatting
This commit is contained in:
@ -10,7 +10,7 @@ const ManageInputField = ({
|
||||
}: ManageInputFieldProps) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className='flex items-center border-t border-divider-subtle pt-1'>
|
||||
<div
|
||||
className='flex h-8 grow cursor-pointer items-center px-3'
|
||||
|
||||
@ -120,41 +120,41 @@ describe('match the schema type', () => {
|
||||
title: 'File',
|
||||
description: 'Schema for file objects (v1)',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
description: 'file name',
|
||||
},
|
||||
size: {
|
||||
type: 'number',
|
||||
description: 'file size',
|
||||
},
|
||||
extension: {
|
||||
type: 'string',
|
||||
description: 'file extension',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
description: 'file type',
|
||||
},
|
||||
mime_type: {
|
||||
type: 'string',
|
||||
description: 'file mime type',
|
||||
},
|
||||
transfer_method: {
|
||||
type: 'string',
|
||||
description: 'file transfer method',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'file url',
|
||||
},
|
||||
related_id: {
|
||||
type: 'string',
|
||||
description: 'file related id',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
description: 'file name',
|
||||
},
|
||||
size: {
|
||||
type: 'number',
|
||||
description: 'file size',
|
||||
},
|
||||
extension: {
|
||||
type: 'string',
|
||||
description: 'file extension',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
description: 'file type',
|
||||
},
|
||||
mime_type: {
|
||||
type: 'string',
|
||||
description: 'file mime type',
|
||||
},
|
||||
transfer_method: {
|
||||
type: 'string',
|
||||
description: 'file transfer method',
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
description: 'file url',
|
||||
},
|
||||
related_id: {
|
||||
type: 'string',
|
||||
description: 'file related id',
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'name',
|
||||
'name',
|
||||
],
|
||||
}
|
||||
expect(matchTheSchemaType(fileSchema, file)).toBe(true)
|
||||
|
||||
@ -4,9 +4,9 @@ import type { AnyObj } from './match-schema-type'
|
||||
import matchTheSchemaType from './match-schema-type'
|
||||
|
||||
export const getMatchedSchemaType = (obj: AnyObj, schemaTypeDefinitions?: SchemaTypeDefinition[]): string => {
|
||||
if(!schemaTypeDefinitions) return ''
|
||||
const matched = schemaTypeDefinitions.find(def => matchTheSchemaType(obj, def.schema))
|
||||
return matched ? matched.name : ''
|
||||
if(!schemaTypeDefinitions) return ''
|
||||
const matched = schemaTypeDefinitions.find(def => matchTheSchemaType(obj, def.schema))
|
||||
return matched ? matched.name : ''
|
||||
}
|
||||
|
||||
const useMatchSchemaType = () => {
|
||||
|
||||
@ -132,10 +132,10 @@ const VarReferencePicker: FC<Props> = ({
|
||||
})
|
||||
|
||||
const node = nodes.find(n => n.id === nodeId)
|
||||
const isInIteration = !!(node?.data as any).isInIteration
|
||||
const isInIteration = !!(node?.data as any)?.isInIteration
|
||||
const iterationNode = isInIteration ? nodes.find(n => n.id === node?.parentId) : null
|
||||
|
||||
const isInLoop = !!(node?.data as any).isInLoop
|
||||
const isInLoop = !!(node?.data as any)?.isInLoop
|
||||
const loopNode = isInLoop ? nodes.find(n => n.id === node?.parentId) : null
|
||||
|
||||
const triggerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
@ -25,9 +25,9 @@ const useAvailableVarList = (nodeId: string, {
|
||||
hideChatVar,
|
||||
passedInAvailableNodes,
|
||||
}: Params = {
|
||||
onlyLeafNodeVar: false,
|
||||
filterVar: () => true,
|
||||
}) => {
|
||||
onlyLeafNodeVar: false,
|
||||
filterVar: () => true,
|
||||
}) => {
|
||||
const { getTreeLeafNodes, getNodeById, getBeforeNodesInSameBranchIncludeParent } = useWorkflow()
|
||||
const { getNodeAvailableVars } = useWorkflowVariables()
|
||||
const isChatMode = useIsChatMode()
|
||||
|
||||
@ -42,7 +42,7 @@ export const useConfig = (id: string) => {
|
||||
retrieval_model,
|
||||
chunk_structure,
|
||||
index_chunk_variable_selector,
|
||||
} = nodeData?.data
|
||||
} = nodeData?.data || {}
|
||||
const { search_method } = retrieval_model || {}
|
||||
handleNodeDataUpdate({
|
||||
chunk_structure: chunkStructure,
|
||||
|
||||
@ -63,9 +63,9 @@ const DatasetItem: FC<Props> = ({
|
||||
<div className={`group/dataset-item flex h-10 cursor-pointer items-center justify-between rounded-lg
|
||||
border-[0.5px] border-components-panel-border-subtle px-2
|
||||
${isDeleteHovered
|
||||
? 'border-state-destructive-border bg-state-destructive-hover'
|
||||
: 'bg-components-panel-on-panel-item-bg hover:bg-components-panel-on-panel-item-bg-hover'
|
||||
}`}>
|
||||
? 'border-state-destructive-border bg-state-destructive-hover'
|
||||
: 'bg-components-panel-on-panel-item-bg hover:bg-components-panel-on-panel-item-bg-hover'
|
||||
}`}>
|
||||
<div className='flex w-0 grow items-center space-x-1.5'>
|
||||
<AppIcon
|
||||
size='tiny'
|
||||
|
||||
@ -37,25 +37,25 @@ import { createLayoutSlice } from './layout-slice'
|
||||
import type { WorkflowSliceShape as WorkflowAppSliceShape } from '@/app/components/workflow-app/store/workflow/workflow-slice'
|
||||
import type { RagPipelineSliceShape } from '@/app/components/rag-pipeline/store'
|
||||
|
||||
export type SliceFromInjection =
|
||||
Partial<WorkflowAppSliceShape> &
|
||||
Partial<RagPipelineSliceShape>
|
||||
export type SliceFromInjection
|
||||
= Partial<WorkflowAppSliceShape>
|
||||
& Partial<RagPipelineSliceShape>
|
||||
|
||||
export type Shape =
|
||||
ChatVariableSliceShape &
|
||||
EnvVariableSliceShape &
|
||||
FormSliceShape &
|
||||
HelpLineSliceShape &
|
||||
HistorySliceShape &
|
||||
NodeSliceShape &
|
||||
PanelSliceShape &
|
||||
ToolSliceShape &
|
||||
VersionSliceShape &
|
||||
WorkflowDraftSliceShape &
|
||||
WorkflowSliceShape &
|
||||
InspectVarsSliceShape &
|
||||
LayoutSliceShape &
|
||||
SliceFromInjection
|
||||
export type Shape
|
||||
= ChatVariableSliceShape
|
||||
& EnvVariableSliceShape
|
||||
& FormSliceShape
|
||||
& HelpLineSliceShape
|
||||
& HistorySliceShape
|
||||
& NodeSliceShape
|
||||
& PanelSliceShape
|
||||
& ToolSliceShape
|
||||
& VersionSliceShape
|
||||
& WorkflowDraftSliceShape
|
||||
& WorkflowSliceShape
|
||||
& InspectVarsSliceShape
|
||||
& LayoutSliceShape
|
||||
& SliceFromInjection
|
||||
|
||||
export type InjectWorkflowStoreSliceFn = StateCreator<SliceFromInjection>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user