mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 16:33:49 +00:00
ts and app detail
This commit is contained in:
@@ -46,7 +46,7 @@ export const triggerModelCollection = (appId: string) =>
|
||||
|
||||
// ====================== data
|
||||
export const getAppTotalUsage = (data: { appId: string }) =>
|
||||
POST<{ date: Date; total: number }[]>(`/app/data/totalUsage`, {
|
||||
POST<{ date: String; total: number }[]>(`/app/data/totalUsage`, {
|
||||
...data,
|
||||
start: addDays(new Date(), -13),
|
||||
end: addDays(new Date(), 1)
|
||||
|
@@ -15,10 +15,8 @@ import MyIcon from '@/components/Icon';
|
||||
import TotalUsage from './Charts/TotalUsage';
|
||||
|
||||
const InfoModal = dynamic(() => import('./InfoModal'));
|
||||
import AppEdit from './edit';
|
||||
import styles from '../../list/index.module.scss';
|
||||
|
||||
const Settings = ({ appId }: { appId: string }) => {
|
||||
const OverView = ({ appId }: { appId: string }) => {
|
||||
const theme = useTheme();
|
||||
const { toast } = useToast();
|
||||
const router = useRouter();
|
||||
@@ -28,7 +26,6 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
content: '确认删除该应用?'
|
||||
});
|
||||
const [settingAppInfo, setSettingAppInfo] = useState<AppSchema>();
|
||||
const [fullScreen, setFullScreen] = useState(false);
|
||||
|
||||
/* 点击删除 */
|
||||
const handleDelModel = useCallback(async () => {
|
||||
@@ -61,7 +58,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
<Grid gridTemplateColumns={['1fr', 'repeat(2,1fr)']} gridGap={[2, 4, 6]}>
|
||||
<Box>
|
||||
<Box mb={2} fontSize={['md', 'xl']}>
|
||||
概览
|
||||
基本信息
|
||||
</Box>
|
||||
<Box
|
||||
border={theme.borders.base}
|
||||
@@ -93,7 +90,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
onClick={openConfirm(handleDelModel)}
|
||||
/>
|
||||
</Flex>
|
||||
<Box className={styles.intro} py={3} wordBreak={'break-all'} color={'myGray.600'}>
|
||||
<Box className={'textEllipsis3'} py={3} wordBreak={'break-all'} color={'myGray.600'}>
|
||||
{appDetail.intro || '快来给应用一个介绍~'}
|
||||
</Box>
|
||||
<Flex>
|
||||
@@ -140,13 +137,6 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
</Flex>
|
||||
</Grid>
|
||||
</Box>
|
||||
<Box flex={'1 0 0'} position={'relative'}>
|
||||
<AppEdit
|
||||
app={appDetail}
|
||||
onFullScreen={(val) => setFullScreen(val)}
|
||||
fullScreen={fullScreen}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{settingAppInfo && (
|
||||
<InfoModal
|
||||
@@ -162,4 +152,4 @@ const Settings = ({ appId }: { appId: string }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Settings;
|
||||
export default OverView;
|
@@ -9,11 +9,16 @@ import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import Tabs from '@/components/Tabs';
|
||||
import SideTabs from '@/components/SideTabs';
|
||||
import Settings from './components/Settings';
|
||||
import OverView from './components/OverView';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import PageContainer from '@/components/PageContainer';
|
||||
import Loading from '@/components/Loading';
|
||||
|
||||
const Edit = dynamic(() => import('./components/Edit'), {
|
||||
ssr: false,
|
||||
loading: () => <Loading />
|
||||
});
|
||||
const Share = dynamic(() => import('./components/Share'), {
|
||||
ssr: false
|
||||
});
|
||||
@@ -22,6 +27,7 @@ const API = dynamic(() => import('./components/API'), {
|
||||
});
|
||||
|
||||
enum TabEnum {
|
||||
'overview' = 'overview',
|
||||
'settings' = 'settings',
|
||||
'share' = 'share',
|
||||
'API' = 'API'
|
||||
@@ -48,7 +54,8 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
|
||||
const tabList = useMemo(
|
||||
() => [
|
||||
{ label: '概览', id: TabEnum.settings, icon: 'overviewLight' },
|
||||
{ label: '概览', id: TabEnum.overview, icon: 'overviewLight' },
|
||||
{ label: '高级编排', id: TabEnum.settings, icon: 'settingLight' },
|
||||
{ label: '链接分享', id: TabEnum.share, icon: 'shareLight' },
|
||||
{ label: 'API访问', id: TabEnum.API, icon: 'apiLight' },
|
||||
{ label: '立即对话', id: 'startChat', icon: 'chatLight' }
|
||||
@@ -157,7 +164,14 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
/>
|
||||
</Box>
|
||||
<Box flex={'1 0 0'} h={[0, '100%']} overflow={['overlay', '']}>
|
||||
{currentTab === TabEnum.settings && <Settings appId={appId} />}
|
||||
{currentTab === TabEnum.overview && <OverView appId={appId} />}
|
||||
{currentTab === TabEnum.settings && appDetail && (
|
||||
<Edit
|
||||
app={appDetail}
|
||||
fullScreen={true}
|
||||
onFullScreen={() => setCurrentTab(TabEnum.overview)}
|
||||
/>
|
||||
)}
|
||||
{currentTab === TabEnum.API && <API appId={appId} />}
|
||||
{currentTab === TabEnum.share && <Share appId={appId} />}
|
||||
</Box>
|
||||
@@ -167,7 +181,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context: any) {
|
||||
const currentTab = context?.query?.currentTab || TabEnum.settings;
|
||||
const currentTab = context?.query?.currentTab || TabEnum.overview;
|
||||
|
||||
return {
|
||||
props: { currentTab }
|
||||
|
@@ -34,6 +34,7 @@ const BillTable = () => {
|
||||
borderRadius={'md'}
|
||||
cursor={item.read ? 'default' : 'pointer'}
|
||||
position={'relative'}
|
||||
_notLast={{ mb: 3 }}
|
||||
onClick={async () => {
|
||||
if (!item.read) {
|
||||
await readInform(item._id);
|
||||
|
Reference in New Issue
Block a user