mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 10:25:52 +08:00
fix: missing imports (#281)
This commit is contained in:
parent
c67f626b66
commit
59e59c19b2
@ -1,12 +1,13 @@
|
|||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import React, { useCallback, useMemo, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useContext } from 'use-context-selector'
|
import { useContext } from 'use-context-selector'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { omit } from 'lodash-es'
|
import { omit } from 'lodash-es'
|
||||||
import cn from 'classnames'
|
|
||||||
import { ArrowRightIcon } from '@heroicons/react/24/solid'
|
import { ArrowRightIcon } from '@heroicons/react/24/solid'
|
||||||
|
import { useGetState } from 'ahooks'
|
||||||
|
import cn from 'classnames'
|
||||||
import SegmentCard from '../completed/SegmentCard'
|
import SegmentCard from '../completed/SegmentCard'
|
||||||
import { FieldInfo } from '../metadata'
|
import { FieldInfo } from '../metadata'
|
||||||
import style from '../completed/style.module.css'
|
import style from '../completed/style.module.css'
|
||||||
@ -19,7 +20,7 @@ import type { FullDocumentDetail, ProcessRuleResponse } from '@/models/datasets'
|
|||||||
import type { CommonResponse } from '@/models/common'
|
import type { CommonResponse } from '@/models/common'
|
||||||
import { asyncRunSafe } from '@/utils'
|
import { asyncRunSafe } from '@/utils'
|
||||||
import { formatNumber } from '@/utils/format'
|
import { formatNumber } from '@/utils/format'
|
||||||
import { fetchIndexingEstimate, fetchProcessRule, pauseDocIndexing, resumeDocIndexing } from '@/service/datasets'
|
import { fetchIndexingStatus as doFetchIndexingStatus, fetchIndexingEstimate, fetchProcessRule, pauseDocIndexing, resumeDocIndexing } from '@/service/datasets'
|
||||||
import DatasetDetailContext from '@/context/dataset-detail'
|
import DatasetDetailContext from '@/context/dataset-detail'
|
||||||
import StopEmbeddingModal from '@/app/components/datasets/create/stop-embedding-modal'
|
import StopEmbeddingModal from '@/app/components/datasets/create/stop-embedding-modal'
|
||||||
|
|
||||||
@ -134,11 +135,15 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [runId, setRunId, getRunId] = useGetState<any>(null)
|
const [runId, setRunId, getRunId] = useGetState<any>(null)
|
||||||
|
|
||||||
|
const stopQueryStatus = () => {
|
||||||
|
clearInterval(getRunId())
|
||||||
|
}
|
||||||
|
|
||||||
const startQueryStatus = () => {
|
const startQueryStatus = () => {
|
||||||
const runId = setInterval(() => {
|
const runId = setInterval(() => {
|
||||||
const indexingStatusDetail = getIndexingStatusDetail()
|
const indexingStatusDetail = getIndexingStatusDetail()
|
||||||
if (indexingStatusDetail?.indexing_status === 'completed') {
|
if (indexingStatusDetail?.indexing_status === 'completed') {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
||||||
stopQueryStatus()
|
stopQueryStatus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -146,9 +151,6 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
|
|||||||
}, 2500)
|
}, 2500)
|
||||||
setRunId(runId)
|
setRunId(runId)
|
||||||
}
|
}
|
||||||
const stopQueryStatus = () => {
|
|
||||||
clearInterval(getRunId())
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchIndexingStatus()
|
fetchIndexingStatus()
|
||||||
@ -235,13 +237,14 @@ const EmbeddingDetail: FC<Props> = ({ detail, stopPosition = 'top', datasetId: d
|
|||||||
key={idx}
|
key={idx}
|
||||||
className={cn(s.progressBgItem, isEmbedding ? 'bg-primary-50' : 'bg-gray-100')}
|
className={cn(s.progressBgItem, isEmbedding ? 'bg-primary-50' : 'bg-gray-100')}
|
||||||
/>)}
|
/>)}
|
||||||
<div className={
|
<div
|
||||||
cn('rounded-l-md',
|
className={cn(
|
||||||
|
'rounded-l-md',
|
||||||
s.progressBar,
|
s.progressBar,
|
||||||
(isEmbedding || isEmbeddingCompleted) && s.barProcessing,
|
(isEmbedding || isEmbeddingCompleted) && s.barProcessing,
|
||||||
(isEmbeddingPaused || isEmbeddingError) && s.barPaused,
|
(isEmbeddingPaused || isEmbeddingError) && s.barPaused,
|
||||||
indexingStatusDetail?.indexing_status === 'completed' && 'rounded-r-md')
|
indexingStatusDetail?.indexing_status === 'completed' && 'rounded-r-md',
|
||||||
}
|
)}
|
||||||
style={{ width: `${percent}%` }}
|
style={{ width: `${percent}%` }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user