mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat: fetch flow (#1068)
### What problem does this PR solve? feat: fetch flow #918 feat: save graph ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
28
web/src/utils/form.ts
Normal file
28
web/src/utils/form.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { variableEnabledFieldMap } from '@/constants/chat';
|
||||
import omit from 'lodash/omit';
|
||||
|
||||
// chat model setting and generate operator
|
||||
export const excludeUnEnabledVariables = (
|
||||
values: any,
|
||||
prefix = 'llm_setting.',
|
||||
) => {
|
||||
const unEnabledFields: Array<keyof typeof variableEnabledFieldMap> =
|
||||
Object.keys(variableEnabledFieldMap).filter((key) => !values[key]) as Array<
|
||||
keyof typeof variableEnabledFieldMap
|
||||
>;
|
||||
|
||||
return unEnabledFields.map(
|
||||
(key) => `${prefix}${variableEnabledFieldMap[key]}`,
|
||||
);
|
||||
};
|
||||
|
||||
// chat model setting and generate operator
|
||||
export const removeUselessFieldsFromValues = (values: any, prefix?: string) => {
|
||||
const nextValues: any = omit(values, [
|
||||
...Object.keys(variableEnabledFieldMap),
|
||||
'parameters',
|
||||
...excludeUnEnabledVariables(values, prefix),
|
||||
]);
|
||||
|
||||
return nextValues;
|
||||
};
|
||||
@ -1,7 +1,10 @@
|
||||
import omit from 'lodash/omit';
|
||||
import { RequestMethod } from 'umi-request';
|
||||
|
||||
type Service<T extends string> = Record<T, (params?: any) => any>;
|
||||
type Service<T extends string> = Record<
|
||||
T,
|
||||
(params?: any, urlAppendix?: string) => any
|
||||
>;
|
||||
|
||||
const registerServer = <T extends string>(
|
||||
opt: Record<T, { url: string; method: string }>,
|
||||
|
||||
Reference in New Issue
Block a user