Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
83d54d04
authored
May 08, 2025
by
Archer
Committed by
GitHub
May 08, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: replace cite;perf: app card ui (#4768)
* perf: replace cite * perf: app card ui * fix: test
parent
c75f1547
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
16 deletions
+95
-16
packages/service/core/ai/utils.ts
+1
-1
packages/web/components/common/UserBox/index.tsx
+5
-1
projects/app/src/pageComponents/dashboard/apps/List.tsx
+3
-10
projects/app/src/pages/dashboard/apps/index.tsx
+0
-2
test/cases/function/packages/service/core/ai/parseStreamResponse.test.ts
+86
-2
No files found.
packages/service/core/ai/utils.ts
View file @
83d54d04
...
@@ -221,7 +221,7 @@ export const parseReasoningContent = (text: string): [string, string] => {
...
@@ -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
...
...
packages/web/components/common/UserBox/index.tsx
View file @
83d54d04
...
@@ -9,12 +9,16 @@ export type UserBoxProps = {
...
@@ -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
>
);
);
...
...
projects/app/src/pageComponents/dashboard/apps/List.tsx
View file @
83d54d04
...
@@ -220,14 +220,8 @@ const ListItem = () => {
...
@@ -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 = () => {
...
@@ -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 = () => {
...
@@ -394,7 +387,7 @@ const ListItem = () => {
</
Box
>
</
Box
>
)
}
)
}
</
HStack
>
</
HStack
>
</
Flex
>
</
HStack
>
</
MyBox
>
</
MyBox
>
</
MyTooltip
>
</
MyTooltip
>
);
);
...
...
projects/app/src/pages/dashboard/apps/index.tsx
View file @
83d54d04
...
@@ -28,13 +28,11 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
...
@@ -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
(
...
...
test/cases/function/packages/service/core/ai/parseStreamResponse.test.ts
View file @
83d54d04
...
@@ -168,6 +168,90 @@ describe('Parse dataset cite content test', async () => {
...
@@ -168,6 +168,90 @@ describe('Parse dataset cite content test', async () => {
}
}
},
},
{
{
// 只要 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
:
[
{
content
:
'知识库问答系统'
},
{
content
:
'知识库问答系统'
},
...
@@ -177,7 +261,7 @@ describe('Parse dataset cite content test', async () => {
...
@@ -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 () => {
...
@@ -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)'
}
}
},
},
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment