feat: phone slider
This commit is contained in:
@@ -347,7 +347,7 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => {
|
||||
<MyTooltip label={'测试对话'}>
|
||||
<IconButton
|
||||
mr={6}
|
||||
icon={<MyIcon name={'chatLight'} w={['14px', '16px']} />}
|
||||
icon={<MyIcon name={'chat'} w={['14px', '16px']} />}
|
||||
borderRadius={'lg'}
|
||||
aria-label={'save'}
|
||||
variant={'base'}
|
||||
|
||||
@@ -52,6 +52,7 @@ import MyTooltip from '@/components/MyTooltip';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import ChatBox, { type ComponentRef, type StartChatFnProps } from '@/components/ChatBox';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getSpecialModule } from '@/components/ChatBox/utils';
|
||||
|
||||
import { addVariable } from '../VariableEditModal';
|
||||
@@ -63,6 +64,7 @@ const InfoModal = dynamic(() => import('../InfoModal'));
|
||||
const Settings = ({ appId }: { appId: string }) => {
|
||||
const theme = useTheme();
|
||||
const router = useRouter();
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const { appDetail, updateAppDetail, loadKbList, myKbList } = useUserStore();
|
||||
const { isPc } = useGlobalStore();
|
||||
@@ -72,9 +74,11 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
|
||||
const { openConfirm, ConfirmChild } = useConfirm({
|
||||
title: '警告',
|
||||
content: '保存后将会覆盖高级编排配置,请确保该应用未使用高级编排功能。'
|
||||
const { openConfirm: openConfirmSave, ConfirmModal: ConfirmSaveModal } = useConfirm({
|
||||
content: t('app.Confirm Save App Tip')
|
||||
});
|
||||
const { openConfirm: openConfirmDel, ConfirmModal: ConfirmDelModal } = useConfirm({
|
||||
content: t('app.Confirm Del App Tip')
|
||||
});
|
||||
const { register, setValue, getValues, reset, handleSubmit, control } = useForm<EditFormType>({
|
||||
defaultValues: getDefaultAppForm()
|
||||
@@ -227,7 +231,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
color: 'red.600'
|
||||
}}
|
||||
isLoading={isLoading}
|
||||
onClick={openConfirm(handleDelModel)}
|
||||
onClick={openConfirmDel(handleDelModel)}
|
||||
/>
|
||||
</Flex>
|
||||
<Box
|
||||
@@ -243,7 +247,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
<Button
|
||||
size={['sm', 'md']}
|
||||
variant={'base'}
|
||||
leftIcon={<MyIcon name={'chatLight'} w={'16px'} />}
|
||||
leftIcon={<MyIcon name={'chat'} w={'16px'} />}
|
||||
onClick={() => router.push(`/chat?appId=${appId}`)}
|
||||
>
|
||||
对话
|
||||
@@ -286,7 +290,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
isLoading={isSaving}
|
||||
fontSize={'sm'}
|
||||
size={['sm', 'md']}
|
||||
onClick={openConfirm(handleSubmit((data) => onSubmitSave(data)))}
|
||||
onClick={openConfirmSave(handleSubmit((data) => onSubmitSave(data)))}
|
||||
>
|
||||
{isPc ? '保存并预览' : '保存'}
|
||||
</Button>
|
||||
@@ -494,7 +498,8 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<ConfirmChild />
|
||||
<ConfirmSaveModal />
|
||||
<ConfirmDelModal />
|
||||
{settingAppInfo && (
|
||||
<InfoModal defaultApp={settingAppInfo} onClose={() => setSettingAppInfo(undefined)} />
|
||||
)}
|
||||
|
||||
@@ -59,7 +59,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
{ label: '高级编排', id: TabEnum.adEdit, icon: 'settingLight' },
|
||||
{ label: '链接分享', id: TabEnum.share, icon: 'shareLight' },
|
||||
{ label: 'API访问', id: TabEnum.API, icon: 'apiLight' },
|
||||
{ label: '立即对话', id: 'startChat', icon: 'chatLight' }
|
||||
{ label: '立即对话', id: 'startChat', icon: 'chat' }
|
||||
],
|
||||
[]
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ const MyApps = () => {
|
||||
const theme = useTheme();
|
||||
const router = useRouter();
|
||||
const { myApps, loadMyApps } = useUserStore();
|
||||
const { openConfirm, ConfirmChild } = useConfirm({
|
||||
const { openConfirm, ConfirmModal } = useConfirm({
|
||||
title: '删除提示',
|
||||
content: '确认删除该应用所有信息?'
|
||||
});
|
||||
@@ -53,7 +53,7 @@ const MyApps = () => {
|
||||
title: '删除成功',
|
||||
status: 'success'
|
||||
});
|
||||
loadMyApps();
|
||||
loadMyApps(true);
|
||||
} catch (err: any) {
|
||||
toast({
|
||||
title: err?.message || '删除失败',
|
||||
@@ -65,7 +65,7 @@ const MyApps = () => {
|
||||
);
|
||||
|
||||
/* 加载模型 */
|
||||
useQuery(['loadModels'], loadMyApps, {
|
||||
useQuery(['loadModels'], () => loadMyApps(true), {
|
||||
refetchOnMount: true
|
||||
});
|
||||
|
||||
@@ -147,7 +147,7 @@ const MyApps = () => {
|
||||
size={'sm'}
|
||||
icon={
|
||||
<MyTooltip label={'去聊天'}>
|
||||
<MyIcon name={'chatLight'} w={'14px'} />
|
||||
<MyIcon name={'chat'} w={'14px'} />
|
||||
</MyTooltip>
|
||||
}
|
||||
variant={'base'}
|
||||
@@ -165,8 +165,10 @@ const MyApps = () => {
|
||||
</Card>
|
||||
))}
|
||||
</Grid>
|
||||
<ConfirmChild />
|
||||
{isOpenCreateModal && <CreateModal onClose={onCloseCreateModal} onSuccess={loadMyApps} />}
|
||||
<ConfirmModal />
|
||||
{isOpenCreateModal && (
|
||||
<CreateModal onClose={onCloseCreateModal} onSuccess={() => loadMyApps(true)} />
|
||||
)}
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user