@@ -32,6 +32,7 @@ import { extractDeepestInteractive } from '@fastgpt/global/core/workflow/runtime
3232import { useContextSelector } from 'use-context-selector' ;
3333import { ChatItemContext } from '@/web/core/chat/context/chatItemContext' ;
3434import { ChatBoxContext } from '../ChatContainer/ChatBox/Provider' ;
35+ import { useCreation } from 'ahooks' ;
3536
3637const accordionButtonStyle = {
3738 w : 'auto' ,
@@ -88,10 +89,12 @@ const RenderResoningContent = React.memo(function RenderResoningContent({
8889} ) ;
8990const RenderText = React . memo ( function RenderText ( {
9091 showAnimation,
91- text
92+ text,
93+ chatItemDataId
9294} : {
9395 showAnimation : boolean ;
9496 text : string ;
97+ chatItemDataId : string ;
9598} ) {
9699 const isResponseDetail = useContextSelector ( ChatItemContext , ( v ) => v . isResponseDetail ) ;
97100
@@ -103,19 +106,16 @@ const RenderText = React.memo(function RenderText({
103106 if ( ! text ) return '' ;
104107
105108 // Remove quote references if not showing response detail
106- return isResponseDetail ? text : text . replace ( / \[ [ a - f 0 - 9 ] { 24 } \] \( Q U O T E \) / g, '' ) ;
109+ return isResponseDetail
110+ ? text
111+ : text . replace ( / \[ ( [ a - f 0 - 9 ] { 24 } ) \] \( Q U O T E \) / g, '' ) . replace ( / \[ ( [ a - f 0 - 9 ] { 24 } ) \] (? ! \( ) / g, '' ) ;
107112 } , [ text , isResponseDetail ] ) ;
108113
109- // First empty line
110- // if (!source && !isLastChild) return null;
114+ const chatAuthData = useCreation ( ( ) => {
115+ return { appId, chatId, chatItemDataId, ...outLinkAuthData } ;
116+ } , [ appId , chatId , chatItemDataId , outLinkAuthData ] ) ;
111117
112- return (
113- < Markdown
114- source = { source }
115- showAnimation = { showAnimation }
116- metadata = { { appId, chatId, ...outLinkAuthData } }
117- />
118- ) ;
118+ return < Markdown source = { source } showAnimation = { showAnimation } chatAuthData = { chatAuthData } /> ;
119119} ) ;
120120
121121const RenderTool = React . memo (
@@ -241,17 +241,23 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({
241241} ) ;
242242
243243const AIResponseBox = ( {
244+ chatItemDataId,
244245 value,
245246 isLastResponseValue,
246247 isChatting
247248} : {
249+ chatItemDataId : string ;
248250 value : UserChatItemValueItemType | AIChatItemValueItemType ;
249251 isLastResponseValue : boolean ;
250252 isChatting : boolean ;
251253} ) => {
252254 if ( value . type === ChatItemValueTypeEnum . text && value . text ) {
253255 return (
254- < RenderText showAnimation = { isChatting && isLastResponseValue } text = { value . text . content } />
256+ < RenderText
257+ chatItemDataId = { chatItemDataId }
258+ showAnimation = { isChatting && isLastResponseValue }
259+ text = { value . text . content }
260+ />
255261 ) ;
256262 }
257263 if ( value . type === ChatItemValueTypeEnum . reasoning && value . reasoning ) {
0 commit comments