Files
FastGPT/packages/web/components/v2/common/MyModal/index.tsx
T
Archer aaa7d17ef1 V4.14.9 dev (#6555)
* feat: encapsulate logger (#6535)

* feat: encapsulate logger

* update engines

---------

Co-authored-by: archer <545436317@qq.com>

* next config

* dev shell

* Agent sandbox (#6532)

* docs: switch to docs layout and apply black theme (#6533)

* feat: add Gemini 3.1 models

- Add gemini-3.1-pro-preview (released February 19, 2026)
- Add gemini-3.1-flash-lite-preview (released March 3, 2026)

Both models support:
- 1M context window
- 64k max response
- Vision
- Tool choice

* docs: switch to docs layout and apply black theme

- Change layout from notebook to docs
- Update logo to icon + text format
- Apply fumadocs black theme
- Simplify global.css (keep only navbar and TOC styles)
- Fix icon components to properly accept className props
- Add mobile text overflow handling
- Update Node engine requirement to >=20.x

* doc

* doc

* lock

* fix: ts

* doc

* doc

---------

Co-authored-by: archer <archer@archerdeMac-mini.local>
Co-authored-by: archer <545436317@qq.com>

* Doc (#6493)

* cloud doc

* doc refactor

* doc move

* seo

* remove doc

* yml

* doc

* fix: tsconfig

* fix: tsconfig

* sandbox version (#6497)

* sandbox version

* add sandbox log

* update lock

* fix

* fix: sandbox

* doc

* add console

* i18n

* sandbxo in agent

* feat: agent sandbox

* lock

* feat: sandbox ui

* sandbox check exists

* env tempalte

* doc

* lock

* sandbox in chat window

* sandbox entry

* fix: test

* rename var

* sandbox config tip

* update sandbox lifecircle

* update prompt

* rename provider test

* sandbox logger

* yml

---------

Co-authored-by: Archer <archer@fastgpt.io>
Co-authored-by: archer <archer@archerdeMac-mini.local>

* perf: sandbox error tip

* Add sandbox limit and fix some issue (#6550)

* sandbox in plan

* fix: some issue

* fix: test

* editor default path

* fix: comment

* perf: sandbox worksapce

* doc

* perf: del sandbox

* sandbox build

* fix: test

* fix: pr comment

---------

Co-authored-by: Ryo <whoeverimf5@gmail.com>
Co-authored-by: Archer <archer@fastgpt.io>
Co-authored-by: archer <archer@archerdeMac-mini.local>
2026-03-16 17:09:25 +08:00

132 lines
2.8 KiB
TypeScript

import React, { useMemo } from 'react';
import {
Modal,
ModalOverlay,
ModalContent,
ModalCloseButton,
type ModalContentProps,
Box,
type ImageProps,
Flex
} from '@chakra-ui/react';
import MyBox from '../../../common/MyBox';
import { useSystem } from '../../../../hooks/useSystem';
import Avatar from '../../../common/Avatar';
export interface MyModalProps extends ModalContentProps {
iconSrc?: string;
iconColor?: ImageProps['color'];
title?: any;
isCentered?: boolean;
isLoading?: boolean;
isOpen?: boolean;
onClose?: () => void;
closeOnOverlayClick?: boolean;
size?: 'sm' | 'md' | 'lg';
showCloseButton?: boolean;
}
const MyModal = ({
isOpen = true,
onClose,
iconSrc,
title,
children,
isCentered,
isLoading,
closeOnOverlayClick = true,
iconColor,
size = 'sm',
showCloseButton = true,
...props
}: MyModalProps) => {
const { isPc } = useSystem();
const sizeData = useMemo(() => {
const map = {
sm: {
w: '400px'
},
md: {
w: '560px'
},
lg: {
w: '800px'
}
};
return map[size];
}, [size]);
return (
<Modal
isOpen={isOpen}
onClose={() => onClose?.()}
size={size}
autoFocus={false}
isCentered={isPc ? isCentered : true}
blockScrollOnMount={false}
allowPinchZoom
scrollBehavior={'inside'}
closeOnOverlayClick={closeOnOverlayClick}
returnFocusOnClose={false}
>
<ModalOverlay zIndex={props.zIndex} />
<ModalContent
w={sizeData.w}
maxW={'90vw'}
position={'relative'}
maxH={'80vh'}
boxShadow={'3.5'}
padding={'8'}
containerProps={{
zIndex: props.zIndex
}}
{...props}
>
{onClose && <ModalCloseButton position={'absolute'} fontSize={'xs'} top={3} right={3} />}
{!!title && (
<Flex
alignItems={'center'}
fontSize={'lg'}
fontWeight={'500'}
mb={6}
py={0}
px={0}
gap={3}
>
{iconSrc && (
<>
<Avatar
color={iconColor}
objectFit={'contain'}
alt=""
src={iconSrc}
w={'20px'}
borderRadius={'sm'}
/>
</>
)}
<Box color="black" fontWeight={'500'}>
{title}
</Box>
<Box flex={1} />
</Flex>
)}
<MyBox
isLoading={isLoading}
overflow={props.overflow || 'overlay'}
h={'100%'}
display={'flex'}
flexDirection={'column'}
>
{children}
</MyBox>
</ModalContent>
</Modal>
);
};
export default React.memo(MyModal);