* readme * Add queue log * Test interactive (#4509) * Support nested node interaction (#4503) * feat: Add a new InteractiveContext type and update InteractiveBasicType, adding an optional context property to support more complex interaction state management. * feat: Enhance workflow interactivity by adding InteractiveContext support and updating dispatch logic to manage nested contexts and entry nodes more effectively. * feat: Refactor dispatchWorkFlow to utilize InteractiveContext for improved context management * feat: Enhance entry node resolution by adding validation for entryNodeIds and recursive search in InteractiveContext * feat: Remove workflowDepth from InteractiveContext and update recovery logic to utilize parentContext for improved context management * feat: Update getWorkflowEntryNodeIds to use lastInteractive for improved context handling in runtime nodes * feat: Add lastInteractive support to enhance context management across workflow components * feat: Enhance interactive workflow by adding stopForInteractive flag and improving memory edge validation in runtime logic * feat: Refactor InteractiveContext by removing interactiveAppId and updating runtime edge handling in dispatchRunApp for improved context management * feat: Simplify runtime node and edge initialization in dispatchRunApp by using ternary operators for improved readability and maintainability * feat: Improve memory edge validation in initWorkflowEdgeStatus by adding detailed comments for better understanding of subset checks and recursive context searching * feat: Remove commented-out current level information from InteractiveContext for cleaner code and improved readability * feat: Simplify stopForInteractive check in dispatchWorkFlow for improved code clarity and maintainability * feat: Remove stopForInteractive handling and related references for improved code clarity and maintainability * feat: Add interactive response handling in dispatchRunAppNode for enhanced workflow interactivity * feat: Add context property to InteractiveBasicType and InteractiveNodeType for improved interactivity management * feat: remove comments * feat: Remove the node property from ChatDispatchProps to simplify type definitions * feat: Remove workflowInteractiveResponse from dispatchRunAppNode for cleaner code * feat: Refactor interactive value handling in chat history processing for improved clarity * feat: Simplify initWorkflowEdgeStatus logic for better readability and maintainability * feat: Add workflowInteractiveResponse to dispatchWorkFlow for enhanced functionality * feat: Enhance interactive response handling with nested children support * feat: Remove commented-out code for interactive node handling to improve clarity * feat: remove InteractiveContext type * feat: Refactor UserSelectInteractive and UserInputInteractive params for improved structure and clarity * feat: remove * feat: The front end supports extracting the deepest interaction parameters to enhance interaction processing * feat: The front end supports extracting the deepest interaction parameters to enhance interaction processing * fix: handle undefined interactive values in runtimeEdges and runtimeNodes initialization * fix: handle undefined interactive values in runtimeNodes and runtimeEdges initialization * fix: update runtimeNodes and runtimeEdges initialization to use last interactive value * fix: remove unused imports and replace getLastInteractiveValue with lastInteractive in runtimeEdges initialization * fix: import WorkflowInteractiveResponseType and handle lastInteractive as undefined in chatTest * feat: implement extractDeepestInteractive function and refactor usage in AIResponseBox and ChatBox utils * fix: refactor initWorkflowEdgeStatus and getWorkflowEntryNodeIds calls in dispatchRunAppNode for recovery handling * fix: ensure lastInteractive is handled consistently as undefined in runtimeEdges and runtimeNodes initialization * fix: update dispatchFormInput and dispatchUserSelect to use lastInteractive consistently * fix: update condition checks in dispatchFormInput and dispatchUserSelect to ensure lastInteractive type is validated correctly * fix: refactor dispatchRunAppNode to replace isRecovery with childrenInteractive for improved clarity in runtimeNodes and runtimeEdges initialization * refactor: streamline runtimeNodes and runtimeEdges initialization in dispatchRunAppNode for improved readability and maintainability * fix: update rewriteNodeOutputByHistories function to accept runtimeNodes and interactive as parameters for improved clarity * fix: simplify interactiveResponse assignment in dispatchWorkFlow for improved clarity * fix: update entryNodeIds check in getWorkflowEntryNodeIds to ensure it's an array for improved reliability * remove some invalid code --------- Co-authored-by: Theresa <63280168+sd0ric4@users.noreply.github.com> * update doc * update log * fix: update debug workflow to conditionally include nextStepSkipNodes… (#4511) * fix: update debug workflow to conditionally include nextStepSkipNodes based on lastInteractive for improved debugging accuracy * fix : type error * remove invalid code * fix: QA queue * fix: interactive * Test log (#4519) * add log (#4504) * add log * update log i18n * update log * delete template * add i18NT * add team operation log --------- Co-authored-by: gggaaallleee <91131304+gggaaallleee@users.noreply.github.com> * remove search * update doc --------- Co-authored-by: Theresa <63280168+sd0ric4@users.noreply.github.com> Co-authored-by: gggaaallleee <91131304+gggaaallleee@users.noreply.github.com>
183 lines
5.9 KiB
TypeScript
183 lines
5.9 KiB
TypeScript
import { serviceSideProps } from '@/web/common/i18n/utils';
|
|
import AccountContainer from '@/pageComponents/account/AccountContainer';
|
|
import { Box, Flex } from '@chakra-ui/react';
|
|
import Icon from '@fastgpt/web/components/common/Icon';
|
|
import { useTranslation } from 'next-i18next';
|
|
import TeamSelector from '@/pageComponents/account/TeamSelector';
|
|
import { useUserStore } from '@/web/support/user/useUserStore';
|
|
import React, { useMemo } from 'react';
|
|
import { useContextSelector } from 'use-context-selector';
|
|
import { useRouter } from 'next/router';
|
|
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
|
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
|
import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
|
|
import { TeamContext, TeamModalContextProvider } from '@/pageComponents/account/team/context';
|
|
import dynamic from 'next/dynamic';
|
|
|
|
const MemberTable = dynamic(() => import('@/pageComponents/account/team/MemberTable'));
|
|
const PermissionManage = dynamic(
|
|
() => import('@/pageComponents/account/team/PermissionManage/index')
|
|
);
|
|
const OperationLogTable = dynamic(() => import('@/pageComponents/account/team/OperationLog/index'));
|
|
const GroupManage = dynamic(() => import('@/pageComponents/account/team/GroupManage/index'));
|
|
const OrgManage = dynamic(() => import('@/pageComponents/account/team/OrgManage/index'));
|
|
const HandleInviteModal = dynamic(
|
|
() => import('@/pageComponents/account/team/Invite/HandleInviteModal')
|
|
);
|
|
|
|
export enum TeamTabEnum {
|
|
member = 'member',
|
|
org = 'org',
|
|
group = 'group',
|
|
permission = 'permission',
|
|
operationLog = 'operationLog'
|
|
}
|
|
|
|
const Team = () => {
|
|
const router = useRouter();
|
|
|
|
const invitelinkid = useMemo(() => {
|
|
const _id = router.query.invitelinkid;
|
|
if (!_id && typeof _id !== 'string') {
|
|
return '';
|
|
} else {
|
|
return _id as string;
|
|
}
|
|
}, [router.query.invitelinkid]);
|
|
|
|
const { teamTab = TeamTabEnum.member } = router.query as { teamTab: `${TeamTabEnum}` };
|
|
|
|
const { t } = useTranslation();
|
|
const { userInfo } = useUserStore();
|
|
|
|
const { setEditTeamData, teamSize } = useContextSelector(TeamContext, (v) => v);
|
|
|
|
const Tabs = useMemo(
|
|
() => (
|
|
<FillRowTabs
|
|
list={[
|
|
{ label: t('account_team:member'), value: TeamTabEnum.member },
|
|
{ label: t('account_team:org'), value: TeamTabEnum.org },
|
|
{ label: t('account_team:group'), value: TeamTabEnum.group },
|
|
{ label: t('account_team:permission'), value: TeamTabEnum.permission },
|
|
{ label: t('account_team:operation_log'), value: TeamTabEnum.operationLog }
|
|
]}
|
|
px={'1rem'}
|
|
value={teamTab}
|
|
onChange={(e) => {
|
|
router.replace({
|
|
query: {
|
|
...router.query,
|
|
teamTab: e
|
|
}
|
|
});
|
|
}}
|
|
/>
|
|
),
|
|
[router, t, teamTab]
|
|
);
|
|
|
|
return (
|
|
<AccountContainer>
|
|
<Flex h={'100%'} flexDirection={'column'}>
|
|
{/* header */}
|
|
<Flex
|
|
w={'100%'}
|
|
h={'3.5rem'}
|
|
px={'1.56rem'}
|
|
py={'0.56rem'}
|
|
borderBottom={'1px solid'}
|
|
borderColor={'myGray.200'}
|
|
bg={'myGray.25'}
|
|
align={'center'}
|
|
gap={6}
|
|
justify={'space-between'}
|
|
>
|
|
<Flex align={'center'}>
|
|
<Flex gap={2} color={'myGray.900'}>
|
|
<Icon name="support/user/usersLight" w={'1.25rem'} h={'1.25rem'} />
|
|
<Box fontWeight={'500'} fontSize={'1rem'}>
|
|
{t('account:team')}
|
|
</Box>
|
|
</Flex>
|
|
<Flex align={'center'} ml={6}>
|
|
<TeamSelector height={'28px'} />
|
|
</Flex>
|
|
{userInfo?.team?.role === TeamMemberRoleEnum.owner && (
|
|
<Flex align={'center'} justify={'center'} ml={2} p={'0.44rem'}>
|
|
<MyIcon
|
|
name="edit"
|
|
w="18px"
|
|
cursor="pointer"
|
|
_hover={{
|
|
color: 'primary.500'
|
|
}}
|
|
onClick={() => {
|
|
if (!userInfo?.team) return;
|
|
setEditTeamData({
|
|
id: userInfo.team.teamId,
|
|
name: userInfo.team.teamName,
|
|
avatar: userInfo.team.avatar,
|
|
notificationAccount: userInfo.team.notificationAccount
|
|
});
|
|
}}
|
|
/>
|
|
</Flex>
|
|
)}
|
|
</Flex>
|
|
|
|
<Box
|
|
float={'right'}
|
|
color={'myGray.900'}
|
|
h={'1.25rem'}
|
|
px={'0.5rem'}
|
|
py={'0.125rem'}
|
|
fontSize={'0.75rem'}
|
|
borderRadius={'1.25rem'}
|
|
bg={'myGray.150'}
|
|
>
|
|
{t('account_team:total_team_members', { amount: teamSize })}
|
|
</Box>
|
|
</Flex>
|
|
|
|
{/* table */}
|
|
<Box
|
|
py={'1.5rem'}
|
|
px={'2rem'}
|
|
flex={'1 0 0'}
|
|
display={'flex'}
|
|
flexDirection={'column'}
|
|
overflow={'auto'}
|
|
>
|
|
{teamTab === TeamTabEnum.member && <MemberTable Tabs={Tabs} />}
|
|
{teamTab === TeamTabEnum.org && <OrgManage Tabs={Tabs} />}
|
|
{teamTab === TeamTabEnum.group && <GroupManage Tabs={Tabs} />}
|
|
{teamTab === TeamTabEnum.permission && <PermissionManage Tabs={Tabs} />}
|
|
{teamTab === TeamTabEnum.operationLog && <OperationLogTable Tabs={Tabs} />}
|
|
</Box>
|
|
</Flex>
|
|
{invitelinkid && <HandleInviteModal invitelinkid={invitelinkid} />}
|
|
</AccountContainer>
|
|
);
|
|
};
|
|
|
|
export async function getServerSideProps(content: any) {
|
|
return {
|
|
props: {
|
|
...(await serviceSideProps(content, ['account', 'account_team', 'user']))
|
|
}
|
|
};
|
|
}
|
|
|
|
const Render = () => {
|
|
const { userInfo } = useUserStore();
|
|
|
|
return !!userInfo?.team ? (
|
|
<TeamModalContextProvider>
|
|
<Team />
|
|
</TeamModalContextProvider>
|
|
) : null;
|
|
};
|
|
|
|
export default React.memo(Render);
|