mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Feat: Use react-hook-form to synchronize the data of the categorize form to the agent node. #3221 (#5665)
### What problem does this PR solve? Feat: Use react-hook-form to synchronize the data of the categorize form to the agent node. #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -8,7 +8,7 @@ import { removeUselessFieldsFromValues } from '@/utils/form';
|
||||
import { Edge, Node, Position, XYPosition } from '@xyflow/react';
|
||||
import { FormInstance, FormListFieldData } from 'antd';
|
||||
import { humanId } from 'human-id';
|
||||
import { curry, get, intersectionWith, isEqual, sample } from 'lodash';
|
||||
import { curry, get, intersectionWith, isEqual, omit, sample } from 'lodash';
|
||||
import pipe from 'lodash/fp/pipe';
|
||||
import isObject from 'lodash/isObject';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@ -416,3 +416,25 @@ export const buildCategorizeListFromObject = (
|
||||
}, [])
|
||||
.sort((a, b) => a.index - b.index);
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert the list in the following form into an object
|
||||
* {
|
||||
"items": [
|
||||
{
|
||||
"name": "Categorize 1",
|
||||
"description": "111",
|
||||
"examples": "ddd",
|
||||
"to": "Retrieval:LazyEelsStick"
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
export const buildCategorizeObjectFromList = (list: Array<ICategorizeItem>) => {
|
||||
return list.reduce<ICategorizeItemResult>((pre, cur) => {
|
||||
if (cur?.name) {
|
||||
pre[cur.name] = omit(cur, 'name');
|
||||
}
|
||||
return pre;
|
||||
}, {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user