mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
fix: plugin group api position & team selector optional display (#3339)
This commit is contained in:
@@ -61,10 +61,9 @@ const AiPointsModal = dynamic(() =>
|
|||||||
|
|
||||||
const Info = () => {
|
const Info = () => {
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
const { teamPlanStatus } = useUserStore();
|
const { teamPlanStatus, initUserInfo } = useUserStore();
|
||||||
const standardPlan = teamPlanStatus?.standardConstants;
|
const standardPlan = teamPlanStatus?.standardConstants;
|
||||||
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
|
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
|
||||||
const { initUserInfo } = useUserStore();
|
|
||||||
|
|
||||||
useQuery(['init'], initUserInfo);
|
useQuery(['init'], initUserInfo);
|
||||||
|
|
||||||
@@ -112,11 +111,10 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { feConfigs } = useSystemStore();
|
const { feConfigs } = useSystemStore();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { userInfo, updateUserInfo } = useUserStore();
|
const { userInfo, updateUserInfo, teamPlanStatus } = useUserStore();
|
||||||
const { reset } = useForm<UserUpdateParams>({
|
const { reset } = useForm<UserUpdateParams>({
|
||||||
defaultValues: userInfo as UserType
|
defaultValues: userInfo as UserType
|
||||||
});
|
});
|
||||||
const { teamPlanStatus } = useUserStore();
|
|
||||||
const standardPlan = teamPlanStatus?.standardConstants;
|
const standardPlan = teamPlanStatus?.standardConstants;
|
||||||
const { isPc } = useSystem();
|
const { isPc } = useSystem();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
@@ -305,12 +303,14 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
|
|||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
{feConfigs.isPlus && (
|
||||||
<Flex mt={6} alignItems={'center'}>
|
<Flex mt={6} alignItems={'center'}>
|
||||||
<Box {...labelStyles}>{t('account_info:user_team_team_name')}: </Box>
|
<Box {...labelStyles}>{t('account_info:user_team_team_name')}: </Box>
|
||||||
<Flex flex={'1 0 0'} w={0} align={'center'}>
|
<Flex flex={'1 0 0'} w={0} align={'center'}>
|
||||||
<TeamSelector height={'28px'} w={'100%'} showManage />
|
<TeamSelector height={'28px'} w={'100%'} showManage />
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
)}
|
||||||
{feConfigs?.isPlus && (userInfo?.team?.balance ?? 0) > 0 && (
|
{feConfigs?.isPlus && (userInfo?.team?.balance ?? 0) > 0 && (
|
||||||
<Box mt={6} whiteSpace={'nowrap'}>
|
<Box mt={6} whiteSpace={'nowrap'}>
|
||||||
<Flex alignItems={'center'}>
|
<Flex alignItems={'center'}>
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
import { NextAPI } from '@/service/middleware/entry';
|
||||||
|
import { MongoPluginGroups } from '@fastgpt/service/core/app/plugin/pluginGroupSchema';
|
||||||
|
import { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type';
|
||||||
|
import { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';
|
||||||
|
|
||||||
|
export type getPluginGroupsQuery = {};
|
||||||
|
|
||||||
|
export type getPluginGroupsBody = {};
|
||||||
|
|
||||||
|
export type getPluginGroupsResponse = PluginGroupSchemaType[];
|
||||||
|
|
||||||
|
async function handler(
|
||||||
|
req: ApiRequestProps<getPluginGroupsBody, getPluginGroupsQuery>,
|
||||||
|
res: ApiResponseType<any>
|
||||||
|
): Promise<getPluginGroupsResponse> {
|
||||||
|
const pluginGroups = await MongoPluginGroups.find().sort({ groupOrder: 1 });
|
||||||
|
|
||||||
|
const result = pluginGroups.map((item) => ({
|
||||||
|
groupId: item.groupId,
|
||||||
|
groupName: item.groupName,
|
||||||
|
groupAvatar: item.groupAvatar,
|
||||||
|
groupTypes: item.groupTypes,
|
||||||
|
groupOrder: item.groupOrder
|
||||||
|
}));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NextAPI(handler);
|
@@ -42,7 +42,7 @@ export const getSystemPlugTemplates = (data: GetSystemPluginTemplatesBody) =>
|
|||||||
POST<NodeTemplateListItemType[]>('/core/app/plugin/getSystemPluginTemplates', data);
|
POST<NodeTemplateListItemType[]>('/core/app/plugin/getSystemPluginTemplates', data);
|
||||||
|
|
||||||
export const getPluginGroups = () =>
|
export const getPluginGroups = () =>
|
||||||
GET<PluginGroupSchemaType[]>('/proApi/core/app/plugin/getPluginGroups');
|
GET<PluginGroupSchemaType[]>('/core/app/plugin/getPluginGroups');
|
||||||
|
|
||||||
export const getSystemPluginPaths = (parentId: ParentIdType) => {
|
export const getSystemPluginPaths = (parentId: ParentIdType) => {
|
||||||
if (!parentId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
if (!parentId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
||||||
|
Reference in New Issue
Block a user