mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 12:20:34 +00:00
perf: replace cite;perf: app card ui (#4768)
* perf: replace cite * perf: app card ui * fix: test
This commit is contained in:
@@ -221,7 +221,7 @@ export const parseReasoningContent = (text: string): [string, string] => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const removeDatasetCiteText = (text: string, retainDatasetCite: boolean) => {
|
export const removeDatasetCiteText = (text: string, retainDatasetCite: boolean) => {
|
||||||
return retainDatasetCite ? text : text.replace(/\[([a-f0-9]{24})\]\(CITE\)/g, '');
|
return retainDatasetCite ? text : text.replace(/\[([a-f0-9]{24})\](?:\([^\)]*\)?)?/g, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse llm stream part
|
// Parse llm stream part
|
||||||
|
@@ -9,12 +9,16 @@ export type UserBoxProps = {
|
|||||||
sourceMember: SourceMemberType;
|
sourceMember: SourceMemberType;
|
||||||
avatarSize?: string;
|
avatarSize?: string;
|
||||||
} & StackProps;
|
} & StackProps;
|
||||||
|
|
||||||
function UserBox({ sourceMember, avatarSize = '1.25rem', ...props }: UserBoxProps) {
|
function UserBox({ sourceMember, avatarSize = '1.25rem', ...props }: UserBoxProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HStack space="1" {...props}>
|
<HStack space="1" {...props}>
|
||||||
<Avatar src={sourceMember.avatar} w={avatarSize} />
|
<Avatar src={sourceMember.avatar} w={avatarSize} />
|
||||||
<Box>{sourceMember.name}</Box>
|
<Box maxW={'150px'} whiteSpace={'nowrap'} overflow={'hidden'}>
|
||||||
|
{sourceMember.name}
|
||||||
|
</Box>
|
||||||
{sourceMember.status === 'leave' && <Tag color="gray">{t('common:user_leaved')}</Tag>}
|
{sourceMember.status === 'leave' && <Tag color="gray">{t('common:user_leaved')}</Tag>}
|
||||||
</HStack>
|
</HStack>
|
||||||
);
|
);
|
||||||
|
@@ -220,14 +220,8 @@ const ListItem = () => {
|
|||||||
{app.intro || t('common:no_intro')}
|
{app.intro || t('common:no_intro')}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Flex
|
<HStack h={'24px'} fontSize={'mini'} color={'myGray.500'} w="full">
|
||||||
h={'24px'}
|
<HStack flex={'1 0 0'}>
|
||||||
alignItems={'center'}
|
|
||||||
justifyContent={'space-between'}
|
|
||||||
fontSize={'mini'}
|
|
||||||
color={'myGray.500'}
|
|
||||||
>
|
|
||||||
<HStack spacing={3.5}>
|
|
||||||
<UserBox
|
<UserBox
|
||||||
sourceMember={app.sourceMember}
|
sourceMember={app.sourceMember}
|
||||||
fontSize="xs"
|
fontSize="xs"
|
||||||
@@ -241,7 +235,6 @@ const ListItem = () => {
|
|||||||
w={'0.875rem'}
|
w={'0.875rem'}
|
||||||
/>
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<HStack>
|
<HStack>
|
||||||
{isPc && (
|
{isPc && (
|
||||||
<HStack spacing={0.5} className="time">
|
<HStack spacing={0.5} className="time">
|
||||||
@@ -394,7 +387,7 @@ const ListItem = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
</Flex>
|
</HStack>
|
||||||
</MyBox>
|
</MyBox>
|
||||||
</MyTooltip>
|
</MyTooltip>
|
||||||
);
|
);
|
||||||
|
@@ -28,13 +28,11 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
|
|||||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import JsonImportModal from '@/pageComponents/dashboard/apps/JsonImportModal';
|
import JsonImportModal from '@/pageComponents/dashboard/apps/JsonImportModal';
|
||||||
import { type PermissionValueType } from '@fastgpt/global/support/permission/type';
|
|
||||||
import DashboardContainer from '@/pageComponents/dashboard/Container';
|
import DashboardContainer from '@/pageComponents/dashboard/Container';
|
||||||
import List from '@/pageComponents/dashboard/apps/List';
|
import List from '@/pageComponents/dashboard/apps/List';
|
||||||
import MCPToolsEditModal from '@/pageComponents/dashboard/apps/MCPToolsEditModal';
|
import MCPToolsEditModal from '@/pageComponents/dashboard/apps/MCPToolsEditModal';
|
||||||
import { getUtmWorkflow } from '@/web/support/marketing/utils';
|
import { getUtmWorkflow } from '@/web/support/marketing/utils';
|
||||||
import { useMount } from 'ahooks';
|
import { useMount } from 'ahooks';
|
||||||
import { type AppCollaboratorDeleteParams } from '@fastgpt/global/core/app/collaborator';
|
|
||||||
|
|
||||||
const CreateModal = dynamic(() => import('@/pageComponents/dashboard/apps/CreateModal'));
|
const CreateModal = dynamic(() => import('@/pageComponents/dashboard/apps/CreateModal'));
|
||||||
const EditFolderModal = dynamic(
|
const EditFolderModal = dynamic(
|
||||||
|
@@ -167,6 +167,90 @@ describe('Parse dataset cite content test', async () => {
|
|||||||
responseContent: '知识库问答系统'
|
responseContent: '知识库问答系统'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// 只要 objectId
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861]' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861]',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 满足替换条件的
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861](' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861](',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 满足替换条件的
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861](C' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861](C',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 满足替换条件的
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861](CI' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861](CI',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 满足替换条件的
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861](CIT' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861](CIT',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// 满足替换条件的
|
||||||
|
data: [
|
||||||
|
{ content: '知识库' },
|
||||||
|
{ content: '问答系统' },
|
||||||
|
{ content: '[67e517e747' },
|
||||||
|
{ content: '67063e882d' },
|
||||||
|
{ content: '6861](CITE' }
|
||||||
|
],
|
||||||
|
correct: {
|
||||||
|
content: '知识库问答系统[67e517e74767063e882d6861](CITE',
|
||||||
|
responseContent: '知识库问答系统'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// 缺失结尾
|
// 缺失结尾
|
||||||
data: [
|
data: [
|
||||||
@@ -177,7 +261,7 @@ describe('Parse dataset cite content test', async () => {
|
|||||||
],
|
],
|
||||||
correct: {
|
correct: {
|
||||||
content: '知识库问答系统[67e517e74767063e882d6861](CITE',
|
content: '知识库问答系统[67e517e74767063e882d6861](CITE',
|
||||||
responseContent: '知识库问答系统[67e517e74767063e882d6861](CITE'
|
responseContent: '知识库问答系统'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -265,7 +349,7 @@ describe('Parse dataset cite content test', async () => {
|
|||||||
],
|
],
|
||||||
correct: {
|
correct: {
|
||||||
content: '知识库问答系统[](https://fastgpt.cn)[67e517e74767063e882d6861](CIT',
|
content: '知识库问答系统[](https://fastgpt.cn)[67e517e74767063e882d6861](CIT',
|
||||||
responseContent: '知识库问答系统[](https://fastgpt.cn)[67e517e74767063e882d6861](CIT'
|
responseContent: '知识库问答系统[](https://fastgpt.cn)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user