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
a6fc27f6
authored
Jun 16, 2026
by
Archer
Committed by
GitHub
Jun 16, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: slider title (#7130)
parent
eb27fafe
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
10 deletions
+52
-10
projects/app/src/components/Markdown/A.tsx
+17
-6
projects/app/src/components/Markdown/utils.ts
+2
-0
projects/app/src/pageComponents/chat/slider/ChatSliderList.tsx
+8
-2
projects/app/src/pages/api/v1/chat/completions.ts
+1
-1
projects/app/src/pages/api/v2/chat/completions.ts
+1
-1
projects/app/test/components/Markdown/utils.test.ts
+23
-0
No files found.
projects/app/src/components/Markdown/A.tsx
View file @
a6fc27f6
...
@@ -56,6 +56,18 @@ const EmptyHrefLink = function EmptyHrefLink({ content }: { content: string }) {
...
@@ -56,6 +56,18 @@ const EmptyHrefLink = function EmptyHrefLink({ content }: { content: string }) {
);
);
};
};
const
getLinkTextContent
=
(
children
:
React
.
ReactNode
):
string
=>
{
if
(
children
===
undefined
||
children
===
null
||
typeof
children
===
'boolean'
)
return
''
;
if
(
typeof
children
===
'string'
||
typeof
children
===
'number'
)
return
String
(
children
);
if
(
Array
.
isArray
(
children
))
return
children
.
map
(
getLinkTextContent
).
join
(
''
);
if
(
React
.
isValidElement
<
{
children
?:
React
.
ReactNode
}
>
(
children
))
{
return
getLinkTextContent
(
children
.
props
.
children
);
}
return
''
;
};
const
CiteLink
=
React
.
memo
(
function
CiteLink
({
const
CiteLink
=
React
.
memo
(
function
CiteLink
({
id
,
id
,
chatAuthData
,
chatAuthData
,
...
@@ -65,11 +77,6 @@ const CiteLink = React.memo(function CiteLink({
...
@@ -65,11 +77,6 @@ const CiteLink = React.memo(function CiteLink({
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
if
(
!
isObjectId
(
id
))
{
return
<></>;
}
const
{
const
{
data
:
datasetCiteData
,
data
:
datasetCiteData
,
loading
,
loading
,
...
@@ -86,6 +93,10 @@ const CiteLink = React.memo(function CiteLink({
...
@@ -86,6 +93,10 @@ const CiteLink = React.memo(function CiteLink({
[
sourceData
]
[
sourceData
]
);
);
if
(
!
isObjectId
(
id
))
{
return
<></>;
}
return
(
return
(
<
Popover
<
Popover
isLazy
isLazy
...
@@ -199,7 +210,7 @@ const A = ({
...
@@ -199,7 +210,7 @@ const A = ({
showAnimation
:
boolean
;
showAnimation
:
boolean
;
[
key
:
string
]:
any
;
[
key
:
string
]:
any
;
})
=>
{
})
=>
{
const
content
=
useMemo
(()
=>
(
children
===
undefined
?
''
:
String
(
children
)
),
[
children
]);
const
content
=
useMemo
(()
=>
getLinkTextContent
(
children
),
[
children
]);
// empty href link
// empty href link
if
(
!
props
.
href
&&
typeof
children
?.[
0
]
===
'string'
)
{
if
(
!
props
.
href
&&
typeof
children
?.[
0
]
===
'string'
)
{
...
...
projects/app/src/components/Markdown/utils.ts
View file @
a6fc27f6
...
@@ -18,6 +18,8 @@ const streamingIncompleteMarkdownTailPatterns = [
...
@@ -18,6 +18,8 @@ const streamingIncompleteMarkdownTailPatterns = [
/!
\[[^\]\n]
*
\]\([^\s\n
)
]
*$/
,
/!
\[[^\]\n]
*
\]\([^\s\n
)
]
*$/
,
/!
\[[^\]\n]
*
\]
$/
,
/!
\[[^\]\n]
*
\]
$/
,
/!
\[[^\]\n]
*$/
,
/!
\[[^\]\n]
*$/
,
/
\[[
a-f0-9
]{0,24}\]\((?:
CITE|QUOTE
)?
$/i
,
/
\[[
a-f0-9
]{1,24}\]?
$/i
,
/
\[[^\]\n]
*
\]\([^\s\n
)
]
*$/
/
\[[^\]\n]
*
\]\([^\s\n
)
]
*$/
];
];
const
streamingIncompleteTextMarkdownTailMarkers
=
[
'**'
,
'__'
,
'~~'
]
as
const
;
const
streamingIncompleteTextMarkdownTailMarkers
=
[
'**'
,
'__'
,
'~~'
]
as
const
;
...
...
projects/app/src/pageComponents/chat/slider/ChatSliderList.tsx
View file @
a6fc27f6
...
@@ -44,12 +44,17 @@ const ChatSliderList = () => {
...
@@ -44,12 +44,17 @@ const ChatSliderList = () => {
hasBeenRead
?:
boolean
;
hasBeenRead
?:
boolean
;
isTemporary
?:
boolean
;
isTemporary
?:
boolean
;
}[]
=
scopedHistories
.
map
((
item
)
=>
{
}[]
=
scopedHistories
.
map
((
item
)
=>
{
const
isActiveChat
=
item
.
chatId
===
activeChatId
&&
chatBoxData
.
chatId
===
item
.
chatId
;
const
isActiveChat
=
item
.
chatId
===
activeChatId
&&
chatBoxData
.
chatId
===
item
.
chatId
&&
chatBoxData
.
appId
===
item
.
appId
;
const
customTitle
=
item
.
customTitle
?.
trim
()
?
item
.
customTitle
:
undefined
;
const
customTitle
=
item
.
customTitle
?.
trim
()
?
item
.
customTitle
:
undefined
;
const
realtimeTitle
=
chatBoxData
.
title
?.
trim
()
?
chatBoxData
.
title
:
undefined
;
const
title
=
(
isActiveChat
?
realtimeTitle
:
undefined
)
||
customTitle
||
item
.
title
;
return
{
return
{
id
:
item
.
chatId
,
id
:
item
.
chatId
,
title
:
getHistoryDisplayTitle
(
customTitle
||
item
.
title
),
title
:
getHistoryDisplayTitle
(
title
),
customTitle
,
customTitle
,
top
:
item
.
top
,
top
:
item
.
top
,
updateTime
:
item
.
updateTime
,
updateTime
:
item
.
updateTime
,
...
@@ -88,6 +93,7 @@ const ChatSliderList = () => {
...
@@ -88,6 +93,7 @@ const ChatSliderList = () => {
histories
,
histories
,
t
,
t
,
chatBoxData
.
chatId
,
chatBoxData
.
chatId
,
chatBoxData
.
appId
,
chatBoxData
.
title
,
chatBoxData
.
title
,
chatBoxData
.
chatGenerateStatus
,
chatBoxData
.
chatGenerateStatus
,
chatBoxData
.
hasBeenRead
chatBoxData
.
hasBeenRead
...
...
projects/app/src/pages/api/v1/chat/completions.ts
View file @
a6fc27f6
...
@@ -403,7 +403,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
...
@@ -403,7 +403,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
});
});
}
}
const
isOwnerUse
=
!
shareId
&&
!
spaceTeamId
&&
String
(
tmbId
)
===
String
(
app
.
tmbId
)
;
const
isOwnerUse
=
!
shareId
&&
!
spaceTeamId
;
if
(
isOwnerUse
&&
source
===
ChatSourceEnum
.
online
)
{
if
(
isOwnerUse
&&
source
===
ChatSourceEnum
.
online
)
{
await
recordAppUsage
({
await
recordAppUsage
({
appId
:
app
.
_id
,
appId
:
app
.
_id
,
...
...
projects/app/src/pages/api/v2/chat/completions.ts
View file @
a6fc27f6
...
@@ -412,7 +412,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
...
@@ -412,7 +412,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
});
});
}
}
const
isOwnerUse
=
!
shareId
&&
!
spaceTeamId
&&
String
(
tmbId
)
===
String
(
app
.
tmbId
)
;
const
isOwnerUse
=
!
shareId
&&
!
spaceTeamId
;
if
(
isOwnerUse
&&
source
===
ChatSourceEnum
.
online
)
{
if
(
isOwnerUse
&&
source
===
ChatSourceEnum
.
online
)
{
await
recordAppUsage
({
await
recordAppUsage
({
appId
:
app
.
_id
,
appId
:
app
.
_id
,
...
...
projects/app/test/components/Markdown/utils.test.ts
View file @
a6fc27f6
...
@@ -114,6 +114,29 @@ describe('Markdown utils', () => {
...
@@ -114,6 +114,29 @@ describe('Markdown utils', () => {
expect
(
hideStreamingIncompleteMarkdownTail
(
text
)).
toBe
(
text
);
expect
(
hideStreamingIncompleteMarkdownTail
(
text
)).
toBe
(
text
);
});
});
it
(
'should hide incomplete cite markdown at the streaming tail'
,
()
=>
{
expect
(
hideStreamingIncompleteMarkdownTail
(
'before [507f1f77bcf86cd799439011](CITE'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before [507f1f77bcf86cd799439011](QUOTE'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before [507f1f77bcf86cd799439011]'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before [507f1f77bcf86cd79943901'
)).
toBe
(
'before '
);
});
it
(
'should keep complete cite markdown unchanged'
,
()
=>
{
const
cite
=
'before [507f1f77bcf86cd799439011](CITE)'
;
const
quote
=
'before [507f1f77bcf86cd799439011](QUOTE)'
;
expect
(
hideStreamingIncompleteMarkdownTail
(
cite
)).
toBe
(
cite
);
expect
(
hideStreamingIncompleteMarkdownTail
(
quote
)).
toBe
(
quote
);
});
it
(
'should hide incomplete text style markdown at the streaming tail'
,
()
=>
{
it
(
'should hide incomplete text style markdown at the streaming tail'
,
()
=>
{
expect
(
hideStreamingIncompleteMarkdownTail
(
'before **bold'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before **bold'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before __bold'
)).
toBe
(
'before '
);
expect
(
hideStreamingIncompleteMarkdownTail
(
'before __bold'
)).
toBe
(
'before '
);
...
...
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