feat: submit new password to backend and submit user information and add Form to UserSettingProfile (#114)

* feat: add Form to UserSettingProfile

* feat: submit user information

* feat: submit new password to backend
This commit is contained in:
balibabu
2024-03-08 17:09:07 +08:00
committed by GitHub
parent 8f86ab9f7f
commit fa171dfe6c
15 changed files with 880 additions and 32 deletions

View File

@ -26,6 +26,11 @@ import { useDispatch, useSelector } from 'umi';
import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llmHooks';
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
import { IKnowledge } from '@/interfaces/database/knowledge';
import {
getBase64FromUploadFileList,
getUploadFileListFromBase64,
normFile,
} from '@/utils/fileUtil';
import { PlusOutlined } from '@ant-design/icons';
import { LlmModelType } from '../../constant';
import styles from './index.less';
@ -43,26 +48,12 @@ const Configuration = () => {
(state: any) => state.kSModel.knowledgeDetails,
);
const normFile = (e: any) => {
if (Array.isArray(e)) {
return e;
}
return e?.fileList;
};
const parserList = useSelectParserList();
const embeddingModelOptions = useSelectLlmOptions();
const onFinish = async (values: any) => {
console.info(values);
const fileList = values.avatar;
let avatar;
if (Array.isArray(fileList) && fileList.length > 0) {
avatar = fileList[0].thumbUrl;
}
const avatar = getBase64FromUploadFileList(values.avatar);
dispatch({
type: 'kSModel/updateKb',
payload: {
@ -78,12 +69,10 @@ const Configuration = () => {
};
useEffect(() => {
const avatar = knowledgeDetails.avatar;
let fileList: UploadFile[] = [];
const fileList: UploadFile[] = getUploadFileListFromBase64(
knowledgeDetails.avatar,
);
if (avatar) {
fileList = [{ uid: '1', name: 'file', thumbUrl: avatar, status: 'done' }];
}
form.setFieldsValue({
...pick(knowledgeDetails, [
'description',