Feat: Add a form with data operations operators #10427 (#11001)

### 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:
balibabu
2025-11-04 19:42:59 +08:00
committed by GitHub
parent 880a6a0428
commit db9fa3042b
16 changed files with 433 additions and 49 deletions

View File

@ -1,5 +1,6 @@
import { variableEnabledFieldMap } from '@/constants/chat';
import { TFunction } from 'i18next';
import { camelCase } from 'lodash';
import omit from 'lodash/omit';
// chat model setting and generate operator
@ -32,11 +33,12 @@ export function buildOptions(
data: Record<string, any>,
t?: TFunction<['translation', ...string[]], undefined>,
prefix?: string,
camel: boolean = false,
) {
if (t) {
return Object.values(data).map((val) => ({
label: t(
`${prefix ? prefix + '.' : ''}${typeof val === 'string' ? val.toLowerCase() : val}`,
`${prefix ? prefix + '.' : ''}${typeof val === 'string' ? (camel ? camelCase(val) : val.toLowerCase()) : val}`,
),
value: val,
}));