feat: add i18n type generation scripts and improve code formatting

This commit is contained in:
twwu
2025-09-17 16:05:10 +08:00
parent f89d6376dd
commit 253b8dbc0a
16 changed files with 90 additions and 85 deletions

View File

@ -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'

View File

@ -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)

View File

@ -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 = () => {

View File

@ -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)

View File

@ -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()

View File

@ -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,

View File

@ -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'

View File

@ -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>