mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 23:46:52 +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:
@ -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,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user