@@ -40,7 +40,7 @@ const getMessageText = (message: Content): string => {
40
40
const renderTextWithInlineHighlighting = (
41
41
text : string ,
42
42
supports : GroundingSupport [ ] ,
43
- chunks : GroundingChunk [ ] , // Pass chunks for tooltips/links
43
+ chunks : GroundingChunk [ ] ,
44
44
) : React . ReactNode [ ] => {
45
45
if ( ! supports || supports . length === 0 || ! text ) {
46
46
return [ text ] ;
@@ -50,11 +50,8 @@ const renderTextWithInlineHighlighting = (
50
50
51
51
supports . forEach ( ( support , supportIndex ) => {
52
52
if ( support . segment && support . groundingChunkIndices ) {
53
- // Assuming partIndex is 0 for concatenated text.
54
- // If message.parts can have multiple text parts, this needs adjustment.
55
53
const segment = support . segment ;
56
54
if ( segment . partIndex === undefined || segment . partIndex === 0 ) {
57
- // check if partIndex is specified and is 0 or not specified
58
55
segmentsToHighlight . push ( {
59
56
startIndex : segment . startIndex ,
60
57
endIndex : segment . endIndex , // API's endIndex is typically exclusive
@@ -69,7 +66,7 @@ const renderTextWithInlineHighlighting = (
69
66
return [ text ] ;
70
67
}
71
68
72
- // Sort segments by start index, then by end index (longer segments first if they start at same point)
69
+ // Sort segments by start index, then by end index
73
70
segmentsToHighlight . sort ( ( a , b ) => {
74
71
if ( a . startIndex !== b . startIndex ) {
75
72
return a . startIndex - b . startIndex ;
@@ -100,7 +97,7 @@ const renderTextWithInlineHighlighting = (
100
97
< span
101
98
key = { `seg-${ i } ` }
102
99
className = { styles . highlightedSegment }
103
- title = { `Sources: ${ tooltipText } ` } // Tooltip for hover
100
+ title = { `Sources: ${ tooltipText } ` }
104
101
data-source-indices = { seg . chunkIndices . join ( "," ) }
105
102
>
106
103
{ currentSegmentText }
@@ -145,7 +142,6 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
145
142
return null ;
146
143
}
147
144
148
- // Determine content to render
149
145
let messageContentNodes : React . ReactNode [ ] ;
150
146
if (
151
147
isModel &&
0 commit comments