Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
3021f025
Commit
3021f025
authored
Mar 13, 2024
by
crazywoola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add fetch
parent
f8e3ad69
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
9 deletions
+28
-9
index.tsx
web/app/components/base/retry-button/index.tsx
+8
-9
dataset.ts
web/i18n/en-US/dataset.ts
+2
-0
dataset.ts
web/i18n/ja-JP/dataset.ts
+2
-0
dataset.ts
web/i18n/pt-BR/dataset.ts
+2
-0
dataset.ts
web/i18n/uk-UA/dataset.ts
+2
-0
dataset.ts
web/i18n/zh-Hans/dataset.ts
+2
-0
datasets.ts
web/models/datasets.ts
+5
-0
datasets.ts
web/service/datasets.ts
+5
-0
No files found.
web/app/components/base/retry-button/index.tsx
View file @
3021f025
'use client'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
}
from
'react'
import
React
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
classNames
from
'classnames'
import
useSWR
from
'swr'
import
s
from
'./style.module.css'
import
Divider
from
'@/app/components/base/divider'
import
{
get
}
from
'@/service/base
'
import
{
get
ErrorDocs
}
from
'@/service/datasets
'
const
WarningIcon
=
()
=>
<
svg
width=
"12"
height=
"12"
viewBox=
"0 0 12 12"
fill=
"none"
xmlns=
"http://www.w3.org/2000 /svg"
>
...
...
@@ -18,16 +20,13 @@ type Props = {
const
RetryButton
:
FC
<
Props
>
=
(
{
datasetId
},
)
=>
{
useEffect
(()
=>
{
get
(
`/datasets/
${
datasetId
}
/error-docs`
).
then
((
res
)
=>
{
console
.
log
(
res
)
})
},
[])
const
{
t
}
=
useTranslation
()
const
{
data
:
errorDocs
}
=
useSWR
({
datasetId
},
getErrorDocs
)
return
<
div
className=
{
classNames
(
'inline-flex justify-center items-center gap-2'
,
s
.
retryBtn
)
}
>
<
WarningIcon
/>
<
span
className=
'flex shrink-0 text-sm text-gray-500'
>
3 docs embeddings failed
</
span
>
<
span
className=
'flex shrink-0 text-sm text-gray-500'
>
{
errorDocs
?.
total
}
{
t
(
'dataset.docsFailedNotice'
)
}
</
span
>
<
Divider
type=
'vertical'
className=
'!h-4'
/>
<
span
className=
'text-primary-600 font-semibold text-sm'
>
RETRY
</
span
>
<
span
className=
'text-primary-600 font-semibold text-sm'
>
{
t
(
'dataset.retry'
)
}
</
span
>
</
div
>
}
export
default
RetryButton
web/i18n/en-US/dataset.ts
View file @
3021f025
...
...
@@ -42,6 +42,8 @@ const translation = {
change
:
'Change'
,
changeRetrievalMethod
:
'Change retrieval method'
,
},
docsFailedNotice
:
'documents failed to be indexed'
,
retry
:
'Retry'
,
}
export
default
translation
web/i18n/ja-JP/dataset.ts
View file @
3021f025
...
...
@@ -42,6 +42,8 @@ const translation = {
change
:
'変更'
,
changeRetrievalMethod
:
'検索方法の変更'
,
},
docsFailedNotice
:
'ドキュメントのインデックスに失敗しました'
,
retry
:
'再試行'
,
}
export
default
translation
web/i18n/pt-BR/dataset.ts
View file @
3021f025
...
...
@@ -41,6 +41,8 @@ const translation = {
change
:
'Alterar'
,
changeRetrievalMethod
:
'Alterar método de recuperação'
,
},
docsFailedNotice
:
'documentos falharam ao serem indexados'
,
retry
:
'Tentar novamente'
,
}
export
default
translation
web/i18n/uk-UA/dataset.ts
View file @
3021f025
...
...
@@ -42,6 +42,8 @@ const translation = {
change
:
'Змінити'
,
changeRetrievalMethod
:
'Змінити метод пошуку'
,
},
docsFailedNotice
:
'документи не вдалося проіндексувати'
,
retry
:
'Повторити спробу'
,
}
export
default
translation
web/i18n/zh-Hans/dataset.ts
View file @
3021f025
...
...
@@ -42,6 +42,8 @@ const translation = {
change
:
'更改'
,
changeRetrievalMethod
:
'更改检索方法'
,
},
docsFailedNotice
:
'文档无法被索引'
,
retry
:
'重试'
,
}
export
default
translation
web/models/datasets.ts
View file @
3021f025
...
...
@@ -411,3 +411,8 @@ export enum DocForm {
TEXT
=
'text_model'
,
QA
=
'qa_model'
,
}
export
type
ErrorDocsResponse
=
{
data
:
any
[]
total
:
number
}
web/service/datasets.ts
View file @
3021f025
...
...
@@ -7,6 +7,7 @@ import type {
DataSetListResponse
,
DocumentDetailResponse
,
DocumentListResponse
,
ErrorDocsResponse
,
FileIndexingEstimateResponse
,
HitTestingRecordsResponse
,
HitTestingResponse
,
...
...
@@ -227,3 +228,7 @@ type FileTypesRes = {
export
const
fetchSupportFileTypes
:
Fetcher
<
FileTypesRes
,
{
url
:
string
}
>
=
({
url
})
=>
{
return
get
<
FileTypesRes
>
(
url
)
}
export
const
getErrorDocs
:
Fetcher
<
ErrorDocsResponse
,
{
datasetId
:
string
}
>
=
({
datasetId
})
=>
{
return
get
<
ErrorDocsResponse
>
(
`/datasets/
${
datasetId
}
/error-docs`
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment