1
1
import { useState , useRef , useEffect } from 'react'
2
2
import { Box , Typography , Chip , IconButton , Drawer } from '@mui/material'
3
3
import { Close , Search } from '@mui/icons-material'
4
- import { FileSearchResultData } from '../../../shared/types'
5
4
import { useTranslation } from 'react-i18next'
6
5
import { useToolResults } from './api'
7
6
import ReactMarkdown from 'react-markdown'
8
7
import remarkGfm from 'remark-gfm'
9
8
import { OutlineButtonBlack } from './general/Buttons'
10
9
import SubjectIcon from '@mui/icons-material/Subject'
11
- import { ChatToolResult } from '../../../shared/tools'
12
- import { ToolCallResultEvent , ToolCallStatusEvent } from '../../../shared/chat'
13
- import { RagChunk } from '../../../shared/rag'
10
+ import type { ToolCallResultEvent } from '../../../shared/chat'
11
+ import type { RagChunk } from '../../../shared/rag'
14
12
15
13
const AnnotationTruncated = ( {
16
14
data,
@@ -191,14 +189,14 @@ const Queries = ({ queries }: { queries: string[] }) => {
191
189
)
192
190
}
193
191
194
- const FileSearchResults = ( {
195
- fileSearchResult ,
192
+ const ToolResult = ( {
193
+ toolResult ,
196
194
setActiveToolResult,
197
195
} : {
198
- fileSearchResult : ToolCallResultEvent
196
+ toolResult : ToolCallResultEvent
199
197
setActiveToolResult : ( result : ToolCallResultEvent | undefined ) => void
200
198
} ) => {
201
- const { data : results , isSuccess : isResultsSuccess } = useToolResults ( fileSearchResult . callId )
199
+ const { data : results , isSuccess : isResultsSuccess } = useToolResults ( toolResult . callId )
202
200
const [ isDrawerOpen , setIsDrawerOpen ] = useState < boolean > ( false )
203
201
const [ selectedAnnotation , setSelectedAnnotation ] = useState < number | null > ( null )
204
202
const arrayResults = Array . isArray ( results ) ? results : [ ]
@@ -237,7 +235,7 @@ const FileSearchResults = ({
237
235
{ t ( 'chat:searchResults' ) }
238
236
</ Typography >
239
237
< IconButton
240
- id = "close-annotations"
238
+ data-testid = "close-annotations"
241
239
sx = { {
242
240
color : 'grey.500' ,
243
241
background : '#FFF' ,
@@ -249,7 +247,7 @@ const FileSearchResults = ({
249
247
< Close />
250
248
</ IconButton >
251
249
</ Box >
252
- < Queries queries = { [ fileSearchResult . input ?. query ?? '' ] } />
250
+ < Queries queries = { [ toolResult . input ?. query ?? '' ] } />
253
251
{ isResultsSuccess ? (
254
252
< Box
255
253
sx = { {
@@ -292,7 +290,7 @@ const FileSearchResults = ({
292
290
} }
293
291
>
294
292
< IconButton
295
- id = "close-expanded-annotations"
293
+ data-testid = "close-expanded-annotations"
296
294
onClick = { ( ) => {
297
295
setIsDrawerOpen ( false )
298
296
setSelectedAnnotation ( null )
@@ -326,4 +324,4 @@ const FileSearchResults = ({
326
324
)
327
325
}
328
326
329
- export default FileSearchResults
327
+ export default ToolResult
0 commit comments