Skip to content

Commit

Permalink
fix: plugin group api position & team selector optional display (#3339)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk authored Dec 9, 2024
1 parent 6ceee7c commit 021ec05
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
18 changes: 9 additions & 9 deletions projects/app/src/pages/account/info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ const AiPointsModal = dynamic(() =>

const Info = () => {
const { isPc } = useSystem();
const { teamPlanStatus } = useUserStore();
const { teamPlanStatus, initUserInfo } = useUserStore();
const standardPlan = teamPlanStatus?.standardConstants;
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
const { initUserInfo } = useUserStore();

useQuery(['init'], initUserInfo);

Expand Down Expand Up @@ -112,11 +111,10 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
const theme = useTheme();
const { feConfigs } = useSystemStore();
const { t } = useTranslation();
const { userInfo, updateUserInfo } = useUserStore();
const { userInfo, updateUserInfo, teamPlanStatus } = useUserStore();
const { reset } = useForm<UserUpdateParams>({
defaultValues: userInfo as UserType
});
const { teamPlanStatus } = useUserStore();
const standardPlan = teamPlanStatus?.standardConstants;
const { isPc } = useSystem();
const { toast } = useToast();
Expand Down Expand Up @@ -305,12 +303,14 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
)}
</Flex>
)}
<Flex mt={6} alignItems={'center'}>
<Box {...labelStyles}>{t('account_info:user_team_team_name')}:&nbsp;</Box>
<Flex flex={'1 0 0'} w={0} align={'center'}>
<TeamSelector height={'28px'} w={'100%'} showManage />
{feConfigs.isPlus && (
<Flex mt={6} alignItems={'center'}>
<Box {...labelStyles}>{t('account_info:user_team_team_name')}:&nbsp;</Box>
<Flex flex={'1 0 0'} w={0} align={'center'}>
<TeamSelector height={'28px'} w={'100%'} showManage />
</Flex>
</Flex>
</Flex>
)}
{feConfigs?.isPlus && (userInfo?.team?.balance ?? 0) > 0 && (
<Box mt={6} whiteSpace={'nowrap'}>
<Flex alignItems={'center'}>
Expand Down
29 changes: 29 additions & 0 deletions projects/app/src/pages/api/core/app/plugin/getPluginGroups.ts
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion projects/app/src/web/core/app/api/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getSystemPlugTemplates = (data: GetSystemPluginTemplatesBody) =>
POST<NodeTemplateListItemType[]>('/core/app/plugin/getSystemPluginTemplates', data);

export const getPluginGroups = () =>
GET<PluginGroupSchemaType[]>('/proApi/core/app/plugin/getPluginGroups');
GET<PluginGroupSchemaType[]>('/core/app/plugin/getPluginGroups');

export const getSystemPluginPaths = (parentId: ParentIdType) => {
if (!parentId) return Promise.resolve<ParentTreePathItemType[]>([]);
Expand Down

0 comments on commit 021ec05

Please sign in to comment.