chore(web): new lint setup (#30020)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-23 16:58:55 +08:00
committed by GitHub
parent 9701a2994b
commit f2842da397
3356 changed files with 85046 additions and 81278 deletions

View File

@ -1,13 +1,15 @@
import type { SchemaTypeDefinition } from '@/service/use-common'
import type { NodeDefault, Var } from '../../types'
import type { Field, StructuredOutput } from '../llm/types'
import type { PluginTriggerNodeType } from './types'
import type { SchemaTypeDefinition } from '@/service/use-common'
import { BlockEnum, VarType } from '../../types'
import { genNodeMetaData } from '../../utils'
import { VarKindType } from '../_base/types'
import { type Field, type StructuredOutput, Type } from '../llm/types'
import type { PluginTriggerNodeType } from './types'
import { Type } from '../llm/types'
const normalizeJsonSchemaType = (schema: any): string | undefined => {
if (!schema) return undefined
if (!schema)
return undefined
const { type, properties, items, oneOf, anyOf, allOf } = schema
if (Array.isArray(type))
@ -55,7 +57,7 @@ const extractSchemaType = (schema: any, _schemaTypeDefinitions?: SchemaTypeDefin
const resolveVarType = (
schema: any,
schemaTypeDefinitions?: SchemaTypeDefinition[],
): { type: VarType; schemaType?: string } => {
): { type: VarType, schemaType?: string } => {
const schemaType = extractSchemaType(schema, schemaTypeDefinitions)
const normalizedType = normalizeJsonSchemaType(schema)
@ -195,9 +197,9 @@ const buildOutputVars = (schema: Record<string, any>, schemaTypeDefinitions?: Sc
if (normalizedType === 'object') {
const childProperties = propertySchema?.properties
? Object.entries(propertySchema.properties).reduce((acc, [key, value]) => {
acc[key] = convertJsonSchemaToField(value, schemaTypeDefinitions)
return acc
}, {} as Record<string, Field>)
acc[key] = convertJsonSchemaToField(value, schemaTypeDefinitions)
return acc
}, {} as Record<string, Field>)
: {}
const required = Array.isArray(propertySchema?.required) ? propertySchema.required.filter(Boolean) : undefined
@ -263,7 +265,7 @@ const nodeDefault: NodeDefault<PluginTriggerNodeType> = {
}
const targetParam = typeof rawParam === 'object' && rawParam !== null && 'type' in rawParam
? rawParam as { type: VarKindType; value: any }
? rawParam as { type: VarKindType, value: any }
: { type: VarKindType.constant, value: rawParam }
const { type, value } = targetParam
@ -277,8 +279,9 @@ const nodeDefault: NodeDefault<PluginTriggerNodeType> = {
|| value === null
|| value === ''
|| (Array.isArray(value) && value.length === 0)
)
) {
errorMessage = t('workflow.errorMsg.fieldRequired', { field: field.label })
}
}
})
}