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) => {
|
||||
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
|
||||
|
@@ -9,12 +9,16 @@ export type UserBoxProps = {
|
||||
sourceMember: SourceMemberType;
|
||||
avatarSize?: string;
|
||||
} & StackProps;
|
||||
|
||||
function UserBox({ sourceMember, avatarSize = '1.25rem', ...props }: UserBoxProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<HStack space="1" {...props}>
|
||||
<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>}
|
||||
</HStack>
|
||||
);
|
||||
|
@@ -220,14 +220,8 @@ const ListItem = () => {
|
||||
{app.intro || t('common:no_intro')}
|
||||
</Box>
|
||||
</Box>
|
||||
<Flex
|
||||
h={'24px'}
|
||||
alignItems={'center'}
|
||||
justifyContent={'space-between'}
|
||||
fontSize={'mini'}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
<HStack spacing={3.5}>
|
||||
<HStack h={'24px'} fontSize={'mini'} color={'myGray.500'} w="full">
|
||||
<HStack flex={'1 0 0'}>
|
||||
<UserBox
|
||||
sourceMember={app.sourceMember}
|
||||
fontSize="xs"
|
||||
@@ -241,7 +235,6 @@ const ListItem = () => {
|
||||
w={'0.875rem'}
|
||||
/>
|
||||
</HStack>
|
||||
|
||||
<HStack>
|
||||
{isPc && (
|
||||
<HStack spacing={0.5} className="time">
|
||||
@@ -394,7 +387,7 @@ const ListItem = () => {
|
||||
</Box>
|
||||
)}
|
||||
</HStack>
|
||||
</Flex>
|
||||
</HStack>
|
||||
</MyBox>
|
||||
</MyTooltip>
|
||||
);
|
||||
|
@@ -28,13 +28,11 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import JsonImportModal from '@/pageComponents/dashboard/apps/JsonImportModal';
|
||||
import { type PermissionValueType } from '@fastgpt/global/support/permission/type';
|
||||
import DashboardContainer from '@/pageComponents/dashboard/Container';
|
||||
import List from '@/pageComponents/dashboard/apps/List';
|
||||
import MCPToolsEditModal from '@/pageComponents/dashboard/apps/MCPToolsEditModal';
|
||||
import { getUtmWorkflow } from '@/web/support/marketing/utils';
|
||||
import { useMount } from 'ahooks';
|
||||
import { type AppCollaboratorDeleteParams } from '@fastgpt/global/core/app/collaborator';
|
||||
|
||||
const CreateModal = dynamic(() => import('@/pageComponents/dashboard/apps/CreateModal'));
|
||||
const EditFolderModal = dynamic(
|
||||
|
@@ -167,6 +167,90 @@ describe('Parse dataset cite content test', async () => {
|
||||
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: [
|
||||
@@ -177,7 +261,7 @@ describe('Parse dataset cite content test', async () => {
|
||||
],
|
||||
correct: {
|
||||
content: '知识库问答系统[67e517e74767063e882d6861](CITE',
|
||||
responseContent: '知识库问答系统[67e517e74767063e882d6861](CITE'
|
||||
responseContent: '知识库问答系统'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -265,7 +349,7 @@ describe('Parse dataset cite content test', async () => {
|
||||
],
|
||||
correct: {
|
||||
content: '知识库问答系统[](https://fastgpt.cn)[67e517e74767063e882d6861](CIT',
|
||||
responseContent: '知识库问答系统[](https://fastgpt.cn)[67e517e74767063e882d6861](CIT'
|
||||
responseContent: '知识库问答系统[](https://fastgpt.cn)'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user