mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 00:56:26 +00:00
ts and app detail
This commit is contained in:
@@ -5,7 +5,8 @@ RUN apk add --no-cache libc6-compat && npm install -g pnpm
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Install dependencies based on the preferred package manager
|
||||||
COPY package.json pnpm-lock.yaml* ./
|
COPY package.json ./
|
||||||
|
COPY pnpm-lock.yaml* ./
|
||||||
RUN pnpm config set registry https://registry.npmmirror.com/
|
RUN pnpm config set registry https://registry.npmmirror.com/
|
||||||
RUN \
|
RUN \
|
||||||
[ -f pnpm-lock.yaml ] && pnpm install || \
|
[ -f pnpm-lock.yaml ] && pnpm install || \
|
||||||
|
@@ -46,7 +46,7 @@ export const triggerModelCollection = (appId: string) =>
|
|||||||
|
|
||||||
// ====================== data
|
// ====================== data
|
||||||
export const getAppTotalUsage = (data: { appId: string }) =>
|
export const getAppTotalUsage = (data: { appId: string }) =>
|
||||||
POST<{ date: Date; total: number }[]>(`/app/data/totalUsage`, {
|
POST<{ date: String; total: number }[]>(`/app/data/totalUsage`, {
|
||||||
...data,
|
...data,
|
||||||
start: addDays(new Date(), -13),
|
start: addDays(new Date(), -13),
|
||||||
end: addDays(new Date(), 1)
|
end: addDays(new Date(), 1)
|
||||||
|
@@ -15,10 +15,8 @@ import MyIcon from '@/components/Icon';
|
|||||||
import TotalUsage from './Charts/TotalUsage';
|
import TotalUsage from './Charts/TotalUsage';
|
||||||
|
|
||||||
const InfoModal = dynamic(() => import('./InfoModal'));
|
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 theme = useTheme();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -28,7 +26,6 @@ const Settings = ({ appId }: { appId: string }) => {
|
|||||||
content: '确认删除该应用?'
|
content: '确认删除该应用?'
|
||||||
});
|
});
|
||||||
const [settingAppInfo, setSettingAppInfo] = useState<AppSchema>();
|
const [settingAppInfo, setSettingAppInfo] = useState<AppSchema>();
|
||||||
const [fullScreen, setFullScreen] = useState(false);
|
|
||||||
|
|
||||||
/* 点击删除 */
|
/* 点击删除 */
|
||||||
const handleDelModel = useCallback(async () => {
|
const handleDelModel = useCallback(async () => {
|
||||||
@@ -61,7 +58,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
|||||||
<Grid gridTemplateColumns={['1fr', 'repeat(2,1fr)']} gridGap={[2, 4, 6]}>
|
<Grid gridTemplateColumns={['1fr', 'repeat(2,1fr)']} gridGap={[2, 4, 6]}>
|
||||||
<Box>
|
<Box>
|
||||||
<Box mb={2} fontSize={['md', 'xl']}>
|
<Box mb={2} fontSize={['md', 'xl']}>
|
||||||
概览
|
基本信息
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
border={theme.borders.base}
|
border={theme.borders.base}
|
||||||
@@ -93,7 +90,7 @@ const Settings = ({ appId }: { appId: string }) => {
|
|||||||
onClick={openConfirm(handleDelModel)}
|
onClick={openConfirm(handleDelModel)}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</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 || '快来给应用一个介绍~'}
|
{appDetail.intro || '快来给应用一个介绍~'}
|
||||||
</Box>
|
</Box>
|
||||||
<Flex>
|
<Flex>
|
||||||
@@ -140,13 +137,6 @@ const Settings = ({ appId }: { appId: string }) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex={'1 0 0'} position={'relative'}>
|
|
||||||
<AppEdit
|
|
||||||
app={appDetail}
|
|
||||||
onFullScreen={(val) => setFullScreen(val)}
|
|
||||||
fullScreen={fullScreen}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
{settingAppInfo && (
|
{settingAppInfo && (
|
||||||
<InfoModal
|
<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 Tabs from '@/components/Tabs';
|
||||||
import SideTabs from '@/components/SideTabs';
|
import SideTabs from '@/components/SideTabs';
|
||||||
import Settings from './components/Settings';
|
import OverView from './components/OverView';
|
||||||
import Avatar from '@/components/Avatar';
|
import Avatar from '@/components/Avatar';
|
||||||
import MyIcon from '@/components/Icon';
|
import MyIcon from '@/components/Icon';
|
||||||
import PageContainer from '@/components/PageContainer';
|
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'), {
|
const Share = dynamic(() => import('./components/Share'), {
|
||||||
ssr: false
|
ssr: false
|
||||||
});
|
});
|
||||||
@@ -22,6 +27,7 @@ const API = dynamic(() => import('./components/API'), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
enum TabEnum {
|
enum TabEnum {
|
||||||
|
'overview' = 'overview',
|
||||||
'settings' = 'settings',
|
'settings' = 'settings',
|
||||||
'share' = 'share',
|
'share' = 'share',
|
||||||
'API' = 'API'
|
'API' = 'API'
|
||||||
@@ -48,7 +54,8 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
|||||||
|
|
||||||
const tabList = useMemo(
|
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: '链接分享', id: TabEnum.share, icon: 'shareLight' },
|
||||||
{ label: 'API访问', id: TabEnum.API, icon: 'apiLight' },
|
{ label: 'API访问', id: TabEnum.API, icon: 'apiLight' },
|
||||||
{ label: '立即对话', id: 'startChat', icon: 'chatLight' }
|
{ label: '立即对话', id: 'startChat', icon: 'chatLight' }
|
||||||
@@ -157,7 +164,14 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex={'1 0 0'} h={[0, '100%']} overflow={['overlay', '']}>
|
<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.API && <API appId={appId} />}
|
||||||
{currentTab === TabEnum.share && <Share appId={appId} />}
|
{currentTab === TabEnum.share && <Share appId={appId} />}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -167,7 +181,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function getServerSideProps(context: any) {
|
export async function getServerSideProps(context: any) {
|
||||||
const currentTab = context?.query?.currentTab || TabEnum.settings;
|
const currentTab = context?.query?.currentTab || TabEnum.overview;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { currentTab }
|
props: { currentTab }
|
||||||
|
@@ -34,6 +34,7 @@ const BillTable = () => {
|
|||||||
borderRadius={'md'}
|
borderRadius={'md'}
|
||||||
cursor={item.read ? 'default' : 'pointer'}
|
cursor={item.read ? 'default' : 'pointer'}
|
||||||
position={'relative'}
|
position={'relative'}
|
||||||
|
_notLast={{ mb: 3 }}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (!item.read) {
|
if (!item.read) {
|
||||||
await readInform(item._id);
|
await readInform(item._id);
|
||||||
|
Reference in New Issue
Block a user