@@ -181,15 +181,23 @@ export default class ChatItem extends Component<ChatMessageProps> {
181181 const elementKey = `${ id } -${ index } ` ;
182182 // 系统消息渲染
183183 if ( role === 'system' ) {
184- return < div className = { `${ getClassPrefix ( ) } -chat__text--${ role } ` } > { content . data } </ div > ;
184+ return (
185+ < div key = { elementKey } className = { `${ getClassPrefix ( ) } -chat__text--${ role } ` } >
186+ { content . data }
187+ </ div >
188+ ) ;
185189 }
186190 // 用户消息渲染
187191 if ( role === 'user' ) {
188192 if ( isAttachmentContent ( content ) ) {
189- return renderAttachments ( { content : content . data } , this ) ;
193+ return renderAttachments ( { key : elementKey , content : content . data } , this ) ;
190194 }
191195 if ( isTextContent ( content ) || isMarkdownContent ( content ) ) {
192- return < div className = { `${ getClassPrefix ( ) } -chat__text--${ role } ` } > { content . data } </ div > ;
196+ return (
197+ < div key = { elementKey } className = { `${ getClassPrefix ( ) } -chat__text--${ role } ` } >
198+ { content . data }
199+ </ div >
200+ ) ;
193201 }
194202 return < slot key = { elementKey } name = { `${ content ?. slotName || `${ content . type } -${ index } ` } ` } > </ slot > ;
195203 }
@@ -198,6 +206,7 @@ export default class ChatItem extends Component<ChatMessageProps> {
198206 if ( role === 'assistant' ) {
199207 if ( isSearchContent ( content ) ) {
200208 return renderSearch ( {
209+ key : elementKey ,
201210 content : content . data ,
202211 status : content . status ,
203212 useCollapse : chatContentProps ?. search ?. useCollapse ,
@@ -208,13 +217,15 @@ export default class ChatItem extends Component<ChatMessageProps> {
208217
209218 if ( isSuggestionContent ( content ) ) {
210219 return renderSuggestion ( {
220+ key : elementKey ,
211221 content : content . data ,
212222 handlePromptClick : ( data ) => this . handleClickAction ( 'suggestion' , data ) ,
213223 } ) ;
214224 }
215225 if ( isThinkingContent ( content ) ) {
216226 // 思考
217227 return renderThinking ( {
228+ key : elementKey ,
218229 content : content . data ,
219230 status : content . status ,
220231 animation,
0 commit comments