4.6.7-alpha commit (#743)

Co-authored-by: Archer <545436317@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-01-19 11:17:28 +08:00
committed by GitHub
parent 8ee7407c4c
commit c031e6dcc9
324 changed files with 8509 additions and 4757 deletions

View File

@@ -33,7 +33,7 @@ export const uploadFiles = ({
};
export const getUploadBase64ImgController = (props: CompressImgProps & UploadImgProps) =>
compressBase64Img({
compressBase64ImgAndUpload({
maxW: 4000,
maxH: 4000,
maxSize: 1024 * 1024 * 5,

View File

@@ -27,7 +27,7 @@ export const useSelectFile = (props?: {
if (e.target.files.length > maxCount) {
return toast({
status: 'warning',
title: t('file.Select a maximum of 10 files')
title: t('common.file.Select file amount limit', { max: maxCount })
});
}
onSelect(Array.from(e.target.files), openSign.current);
@@ -35,7 +35,7 @@ export const useSelectFile = (props?: {
/>
</Box>
),
[fileType, maxCount, multiple]
[fileType, maxCount, multiple, t, toast]
);
const onOpen = useCallback((sign?: any) => {

View File

@@ -56,8 +56,8 @@ export const useConfirm = (props?: {
),
ConfirmModal: useCallback(
({
closeText = t('Cancel'),
confirmText = t('Confirm'),
closeText = t('common.Close'),
confirmText = t('common.Confirm'),
isLoading,
bg,
countDown = 0

View File

@@ -2,6 +2,7 @@ import React, { useCallback, useRef } from 'react';
import { ModalFooter, ModalBody, Input, useDisclosure, Button, Box } from '@chakra-ui/react';
import MyModal from '@/components/MyModal';
import { useToast } from './useToast';
import { useTranslation } from 'next-i18next';
export const useEditTitle = ({
title,
@@ -16,6 +17,7 @@ export const useEditTitle = ({
canEmpty?: boolean;
valueRule?: (val: string) => string | void;
}) => {
const { t } = useTranslation();
const { isOpen, onOpen, onClose } = useDisclosure();
const inputRef = useRef<HTMLInputElement | null>(null);
@@ -74,10 +76,12 @@ export const useEditTitle = ({
const EditModal = useCallback(
({
maxLength = 30,
iconSrc = '/imgs/modal/edit.svg'
iconSrc = 'modal/edit',
closeBtnText = t('common.Close')
}: {
maxLength?: number;
iconSrc?: string;
closeBtnText?: string;
}) => (
<MyModal isOpen={isOpen} onClose={onClose} iconSrc={iconSrc} title={title} maxW={'500px'}>
<ModalBody>
@@ -96,10 +100,12 @@ export const useEditTitle = ({
/>
</ModalBody>
<ModalFooter>
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
</Button>
<Button onClick={onclickConfirm}></Button>
{!!closeBtnText && (
<Button mr={3} variant={'whiteBase'} onClick={onClose}>
{closeBtnText}
</Button>
)}
<Button onClick={onclickConfirm}>{t('common.Confirm')}</Button>
</ModalFooter>
</MyModal>
),

View File

@@ -30,10 +30,12 @@ export let simpleModeTemplates: AppSimpleEditConfigTemplateType[] = [];
let retryTimes = 3;
export const clientInitData = async (): Promise<InitDateResponse> => {
export const clientInitData = async (): Promise<{
feConfigs: FastGPTFeConfigsType;
}> => {
try {
const res = await getSystemInitData();
feConfigs = res.feConfigs;
feConfigs = res.feConfigs || {};
chatModelList = res.chatModels ?? chatModelList;
vectorModelList = res.vectorModels ?? vectorModelList;
@@ -51,7 +53,9 @@ export const clientInitData = async (): Promise<InitDateResponse> => {
systemVersion = res.systemVersion;
simpleModeTemplates = res.simpleModeTemplates;
return res;
return {
feConfigs
};
} catch (error) {
retryTimes--;
await delay(500);