mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
feat: ai proxy v1 (#3898)
* feat: ai proxy v1 * perf: ai proxy channel crud * feat: ai proxy logs * feat: channel test * doc * update lock
This commit is contained in:
@@ -7,13 +7,17 @@ import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const ModelConfigTable = dynamic(() => import('@/pageComponents/account/model/ModelConfigTable'));
|
||||
const ChannelTable = dynamic(() => import('@/pageComponents/account/model/Channel'));
|
||||
const ChannelLog = dynamic(() => import('@/pageComponents/account/model/Log'));
|
||||
|
||||
type TabType = 'model' | 'config' | 'channel';
|
||||
type TabType = 'model' | 'config' | 'channel' | 'channel_log';
|
||||
|
||||
const ModelProvider = () => {
|
||||
const { t } = useTranslation();
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
const [tab, setTab] = useState<TabType>('model');
|
||||
|
||||
@@ -22,21 +26,29 @@ const ModelProvider = () => {
|
||||
<FillRowTabs<TabType>
|
||||
list={[
|
||||
{ label: t('account:active_model'), value: 'model' },
|
||||
{ label: t('account:config_model'), value: 'config' }
|
||||
// { label: t('account:channel'), value: 'channel' }
|
||||
{ label: t('account:config_model'), value: 'config' },
|
||||
// @ts-ignore
|
||||
...(feConfigs?.show_aiproxy
|
||||
? [
|
||||
{ label: t('account:channel'), value: 'channel' },
|
||||
{ label: t('account_model:log'), value: 'channel_log' }
|
||||
]
|
||||
: [])
|
||||
]}
|
||||
value={tab}
|
||||
py={1}
|
||||
onChange={setTab}
|
||||
/>
|
||||
);
|
||||
}, [t, tab]);
|
||||
}, [feConfigs.show_aiproxy, t, tab]);
|
||||
|
||||
return (
|
||||
<AccountContainer>
|
||||
<Flex h={'100%'} flexDirection={'column'} gap={4} py={4} px={6}>
|
||||
{tab === 'model' && <ValidModelTable Tab={Tab} />}
|
||||
{tab === 'config' && <ModelConfigTable Tab={Tab} />}
|
||||
{tab === 'channel' && <ChannelTable Tab={Tab} />}
|
||||
{tab === 'channel_log' && <ChannelLog Tab={Tab} />}
|
||||
</Flex>
|
||||
</AccountContainer>
|
||||
);
|
||||
@@ -45,7 +57,7 @@ const ModelProvider = () => {
|
||||
export async function getServerSideProps(content: any) {
|
||||
return {
|
||||
props: {
|
||||
...(await serviceSideProps(content, ['account']))
|
||||
...(await serviceSideProps(content, ['account', 'account_model']))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user