mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? some chunk method pictures are not in English #437 feat: set the height of both html and body to 100% feat: add SharedChat feat: add shared hooks ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
23 lines
687 B
TypeScript
23 lines
687 B
TypeScript
import isObject from 'lodash/isObject';
|
|
import snakeCase from 'lodash/snakeCase';
|
|
|
|
export const isFormData = (data: unknown): data is FormData => {
|
|
return data instanceof FormData;
|
|
};
|
|
|
|
export const convertTheKeysOfTheObjectToSnake = (data: unknown) => {
|
|
if (isObject(data) && !isFormData(data)) {
|
|
return Object.keys(data).reduce<Record<string, any>>((pre, cur) => {
|
|
const value = (data as Record<string, any>)[cur];
|
|
pre[isFormData(value) ? cur : snakeCase(cur)] = value;
|
|
return pre;
|
|
}, {});
|
|
}
|
|
return data;
|
|
};
|
|
|
|
export const getSearchValue = (key: string) => {
|
|
const params = new URL(document.location as any).searchParams;
|
|
return params.get(key);
|
|
};
|