Skip to content

Commit

Permalink
4.8.5 test (#1825)
Browse files Browse the repository at this point in the history
* update model logo

* perf: hide list clb api
  • Loading branch information
c121914yu authored Jun 24, 2024
1 parent 24596a6 commit a9ab9eb
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 85 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"editor.formatOnSave": true,
"editor.mouseWheelZoom": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.prettierPath": "../node_modules/prettier",
"typescript.tsdk": "node_modules/typescript/lib",
"prettier.prettierPath": "",
"i18n-ally.localesPaths": [
"packages/web/i18n",
],
Expand Down
3 changes: 3 additions & 0 deletions docSite/content/zh-cn/docs/development/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ llm模型全部合并
- /imgs/model/openai.svg - OpenAI GPT
- /imgs/model/qwen.svg - 通义千问
- /imgs/model/yi.svg - 零一万物
- /imgs/model/gemini.svg - gemini
- /imgs/model/deepseek.svg - deepseek
- /imgs/model/minimax.svg - minimax
-

## 特殊模型
Expand Down
8 changes: 8 additions & 0 deletions packages/global/common/string/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ export const getNanoid = (size = 12) => {
/* Custom text to reg, need to replace special chats */
export const replaceRegChars = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

export const getRegQueryStr = (text: string, flags = 'i') => {
const formatText = replaceRegChars(text);
const chars = formatText.split('');
const regexPattern = chars.join('.*');

return new RegExp(regexPattern, flags);
};

/* slice json str */
export const sliceJsonStr = (str: string) => {
str = str.replace(/(\\n|\\)/g, '').replace(/ /g, '');
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/common/MyMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const MyMenu = ({
direction={'ltr'}
isLazy
lazyBehavior={'keepMounted'}
placement="bottom-start"
>
<Box
ref={ref}
Expand Down Expand Up @@ -141,7 +142,6 @@ const MyMenu = ({
</Box>
<MenuList
minW={isOpen ? `${width}px !important` : '80px'}
w={width ?? 'auto'}
maxW={'300px'}
p={'6px'}
border={'1px solid #fff'}
Expand Down
6 changes: 6 additions & 0 deletions projects/app/public/imgs/model/deepseek.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions projects/app/public/imgs/model/minimax.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 65 additions & 59 deletions projects/app/src/components/common/folder/SlideCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import CollaboratorContextProvider, {
MemberManagerInputPropsType
} from '../../support/permission/MemberManager/context';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useSystemStore } from '@/web/common/system/useSystemStore';

const FolderSlideCard = ({
refreshDeps,
Expand Down Expand Up @@ -41,6 +42,7 @@ const FolderSlideCard = ({
managePer: MemberManagerInputPropsType;
}) => {
const { t } = useTranslation();
const { feConfigs } = useSystemStore();

const { ConfirmModal, openConfirm } = useConfirm({
type: 'delete',
Expand Down Expand Up @@ -109,69 +111,73 @@ const FolderSlideCard = ({
</>
)}

<MyDivider my={6} />
{feConfigs?.isPlus && (
<>
<MyDivider my={6} />

<Box>
<FormLabel>{t('support.permission.Permission')}</FormLabel>
<Box>
<FormLabel>{t('support.permission.Permission')}</FormLabel>

{managePer.permission.hasManagePer && (
<Box mt={5}>
<Box fontSize={'sm'} color={'myGray.500'}>
{t('permission.Default permission')}
{managePer.permission.hasManagePer && (
<Box mt={5}>
<Box fontSize={'sm'} color={'myGray.500'}>
{t('permission.Default permission')}
</Box>
<DefaultPermissionList
mt="1"
per={defaultPer.value}
defaultPer={defaultPer.defaultValue}
onChange={defaultPer.onChange}
/>
</Box>
)}
<Box mt={6}>
<CollaboratorContextProvider {...managePer} refreshDeps={refreshDeps}>
{({ MemberListCard, onOpenManageModal, onOpenAddMember }) => {
return (
<>
<Flex alignItems="center" justifyContent="space-between">
<Box fontSize={'sm'} color={'myGray.500'}>
{t('permission.Collaborator')}
</Box>
{managePer.permission.hasManagePer && (
<HStack spacing={3}>
<MyTooltip label={t('permission.Manage')}>
<MyIcon
w="1rem"
name="common/settingLight"
cursor={'pointer'}
_hover={{ color: 'primary.600' }}
onClick={onOpenManageModal}
/>
</MyTooltip>
<MyTooltip label={t('common.Add')}>
<MyIcon
w="1rem"
name="support/permission/collaborator"
cursor={'pointer'}
_hover={{ color: 'primary.600' }}
onClick={onOpenAddMember}
/>
</MyTooltip>
</HStack>
)}
</Flex>
<MemberListCard
mt={2}
tagStyle={{
type: 'borderSolid',
colorSchema: 'gray'
}}
/>
</>
);
}}
</CollaboratorContextProvider>
</Box>
<DefaultPermissionList
mt="1"
per={defaultPer.value}
defaultPer={defaultPer.defaultValue}
onChange={defaultPer.onChange}
/>
</Box>
)}
<Box mt={6}>
<CollaboratorContextProvider {...managePer} refreshDeps={refreshDeps}>
{({ MemberListCard, onOpenManageModal, onOpenAddMember }) => {
return (
<>
<Flex alignItems="center" justifyContent="space-between">
<Box fontSize={'sm'} color={'myGray.500'}>
{t('permission.Collaborator')}
</Box>
{managePer.permission.hasManagePer && (
<HStack spacing={3}>
<MyTooltip label={t('permission.Manage')}>
<MyIcon
w="1rem"
name="common/settingLight"
cursor={'pointer'}
_hover={{ color: 'primary.600' }}
onClick={onOpenManageModal}
/>
</MyTooltip>
<MyTooltip label={t('common.Add')}>
<MyIcon
w="1rem"
name="support/permission/collaborator"
cursor={'pointer'}
_hover={{ color: 'primary.600' }}
onClick={onOpenAddMember}
/>
</MyTooltip>
</HStack>
)}
</Flex>
<MemberListCard
mt={2}
tagStyle={{
type: 'borderSolid',
colorSchema: 'gray'
}}
/>
</>
);
}}
</CollaboratorContextProvider>
</Box>
</Box>
</>
)}

<ConfirmModal />
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import { useMemo, useState } from 'react';
import PermissionSelect from './PermissionSelect';
import PermissionTags from './PermissionTags';
import { CollaboratorContext } from './context';
import { useQuery } from '@tanstack/react-query';
import { useUserStore } from '@/web/support/user/useUserStore';
import { getTeamMembers } from '@/web/support/user/team/api';
import MyBox from '@fastgpt/web/components/common/MyBox';
import { ChevronDownIcon } from '@chakra-ui/icons';
import Avatar from '@/components/Avatar';
import { useRequest } from '@fastgpt/web/hooks/useRequest';
import { useRequest, useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { useTranslation } from 'next-i18next';

export type AddModalPropsType = {
Expand All @@ -39,15 +38,17 @@ function AddMemberModal({ onClose }: AddModalPropsType) {
const { permissionList, collaboratorList, onUpdateCollaborators, getPerLabelList } =
useContextSelector(CollaboratorContext, (v) => v);
const [searchText, setSearchText] = useState<string>('');
const {
data: members = [],
refetch: refetchMembers,
isLoading: loadingMembers
} = useQuery(['getMembers', userInfo?.team?.teamId], async () => {
if (!userInfo?.team?.teamId) return [];
const members = await getTeamMembers();
return members;
});
const { data: members = [], loading: loadingMembers } = useRequest2(
async () => {
if (!userInfo?.team?.teamId) return [];
const members = await getTeamMembers();
return members;
},
{
manual: false,
refreshDeps: [userInfo?.team?.teamId]
}
);
const filterMembers = useMemo(() => {
return members.filter((item) => {
// if (item.permission.isOwner) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
import { PermissionList } from '@fastgpt/global/support/permission/constant';
import { Permission } from '@fastgpt/global/support/permission/controller';
import { PermissionListType, PermissionValueType } from '@fastgpt/global/support/permission/type';
import { useQuery } from '@tanstack/react-query';
import { ReactNode, useCallback } from 'react';
import { createContext } from 'use-context-selector';
import dynamic from 'next/dynamic';

import MemberListCard, { MemberListCardProps } from './MemberListCard';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { useSystemStore } from '@/web/common/system/useSystemStore';
const AddMemberModal = dynamic(() => import('./AddMemberModal'));
const ManageModal = dynamic(() => import('./ManageModal'));

Expand Down Expand Up @@ -71,14 +71,24 @@ const CollaboratorContextProvider = ({
}: MemberManagerInputPropsType & {
children: (props: ChildrenProps) => ReactNode;
}) => {
const { feConfigs } = useSystemStore();

const {
data: collaboratorList = [],
runAsync: refetchCollaboratorList,
loading: isFetchingCollaborator
} = useRequest2(onGetCollaboratorList, {
manual: false,
refreshDeps
});
} = useRequest2(
async () => {
if (feConfigs.isPlus) {
return onGetCollaboratorList();
}
return [];
},
{
manual: false,
refreshDeps
}
);

const onUpdateCollaboratorsThen = async (props: UpdateClbPermissionProps) => {
await onUpdateCollaborators(props);
Expand Down
20 changes: 12 additions & 8 deletions projects/app/src/pages/dataset/list/component/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ function List() {
}}
>
<MyMenu
width={120}
Button={
<Box w={'22px'} h={'22px'}>
<MyIcon
Expand Down Expand Up @@ -279,13 +278,7 @@ function List() {
label: t('Move'),
onClick: () => setMoveDataId(dataset._id)
},
{
icon: 'export',
label: t('Export'),
onClick: () => {
exportDataset(dataset);
}
},

...(dataset.permission.hasManagePer
? [
{
Expand All @@ -297,6 +290,17 @@ function List() {
: [])
]
},
{
children: [
{
icon: 'export',
label: t('Export'),
onClick: () => {
exportDataset(dataset);
}
}
]
},
...(dataset.permission.hasManagePer
? [
{
Expand Down

0 comments on commit a9ab9eb

Please sign in to comment.