mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-25 08:06:48 +08:00
### What problem does this PR solve? Feat: Add a form with data operations operators #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -4,14 +4,14 @@ import { JsonSchemaDataType } from '../constant';
|
||||
|
||||
export function hasSpecificTypeChild(
|
||||
data: Record<string, any> | Array<any>,
|
||||
type: string,
|
||||
types: string[] = [],
|
||||
) {
|
||||
if (Array.isArray(data)) {
|
||||
for (const value of data) {
|
||||
if (isPlainObject(value) && value.type === type) {
|
||||
if (isPlainObject(value) && types.some((x) => x === value.type)) {
|
||||
return true;
|
||||
}
|
||||
if (hasSpecificTypeChild(value, type)) {
|
||||
if (hasSpecificTypeChild(value, types)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -19,11 +19,11 @@ export function hasSpecificTypeChild(
|
||||
|
||||
if (isPlainObject(data)) {
|
||||
for (const value of Object.values(data)) {
|
||||
if (isPlainObject(value) && value.type === type) {
|
||||
if (isPlainObject(value) && types.some((x) => x === value.type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (hasSpecificTypeChild(value, type)) {
|
||||
if (hasSpecificTypeChild(value, types)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -33,7 +33,7 @@ export function hasSpecificTypeChild(
|
||||
}
|
||||
|
||||
export function hasArrayChild(data: Record<string, any> | Array<any>) {
|
||||
return hasSpecificTypeChild(data, JsonSchemaDataType.Array);
|
||||
return hasSpecificTypeChild(data, [JsonSchemaDataType.Array]);
|
||||
}
|
||||
|
||||
export function hasJsonSchemaChild(data: JSONSchema) {
|
||||
|
||||
Reference in New Issue
Block a user