Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

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

KVOJJJin762657eeef4a
diff --git a/web/app/components/datasets/documents/detail/embedding/index.tsx b/web/app/components/datasets/documents/detail/embedding/index.tsx
index 3c152f3f995..80d1cc3b4bd 100644
--- a/web/app/components/datasets/documents/detail/embedding/index.tsx
+++ b/web/app/components/datasets/documents/detail/embedding/index.tsx
@@ -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()
}