Fix: stop indexing status check when api of status checking failed (#3156)

This commit is contained in:
KVOJJJin 2024-04-08 16:14:31 +08:00 committed by GitHub
parent 16e3b0484d
commit 762657eeef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,19 +120,19 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
const localDocumentId = docId ?? documentId
const localIndexingTechnique = indexingType ?? indexingTechnique
// const { data: indexingStatusDetailFromApi, error: indexingStatusErr, mutate: statusMutate } = useSWR({
// action: 'fetchIndexingStatus',
// datasetId: localDatasetId,
// documentId: localDocumentId,
// }, apiParams => fetchIndexingStatus(omit(apiParams, 'action')), {
// refreshInterval: 2500,
// revalidateOnFocus: false,
// })
const [indexingStatusDetail, setIndexingStatusDetail, getIndexingStatusDetail] = useGetState<any>(null)
const fetchIndexingStatus = async () => {
const status = await doFetchIndexingStatus({ datasetId: localDatasetId, documentId: localDocumentId })
setIndexingStatusDetail(status)
try {
const status = await doFetchIndexingStatus({ datasetId: localDatasetId, documentId: localDocumentId })
setIndexingStatusDetail(status)
// eslint-disable-next-line @typescript-eslint/no-use-before-define
startQueryStatus()
}
catch (err) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
stopQueryStatus()
notify({ type: 'error', message: `error: ${err}` })
}
}
const [runId, setRunId, getRunId] = useGetState<any>(null)
@ -156,7 +156,6 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
useEffect(() => {
fetchIndexingStatus()
startQueryStatus()
return () => {
stopQueryStatus()
}