mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
Knowledge optimization (#3755)
Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: JzoNg <jzongcode@gmail.com>
This commit is contained in:
@ -7,6 +7,7 @@ import type {
|
||||
DataSetListResponse,
|
||||
DocumentDetailResponse,
|
||||
DocumentListResponse,
|
||||
ErrorDocsResponse,
|
||||
FileIndexingEstimateResponse,
|
||||
HitTestingRecordsResponse,
|
||||
HitTestingResponse,
|
||||
@ -49,7 +50,12 @@ export const fetchDatasetDetail: Fetcher<DataSet, string> = (datasetId: string)
|
||||
return get<DataSet>(`/datasets/${datasetId}`)
|
||||
}
|
||||
|
||||
export const updateDatasetSetting: Fetcher<DataSet, { datasetId: string; body: Partial<Pick<DataSet, 'name' | 'description' | 'permission' | 'indexing_technique' | 'retrieval_model'>> }> = ({ datasetId, body }) => {
|
||||
export const updateDatasetSetting: Fetcher<DataSet, {
|
||||
datasetId: string
|
||||
body: Partial<Pick<DataSet,
|
||||
'name' | 'description' | 'permission' | 'indexing_technique' | 'retrieval_model' | 'embedding_model' | 'embedding_model_provider'
|
||||
>>
|
||||
}> = ({ datasetId, body }) => {
|
||||
return patch<DataSet>(`/datasets/${datasetId}`, { body })
|
||||
}
|
||||
|
||||
@ -222,3 +228,11 @@ 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`)
|
||||
}
|
||||
|
||||
export const retryErrorDocs: Fetcher<CommonResponse, { datasetId: string; document_ids: string[] }> = ({ datasetId, document_ids }) => {
|
||||
return post<CommonResponse>(`/datasets/${datasetId}/retry`, { body: { document_ids } })
|
||||
}
|
||||
|
||||
47
web/service/tag.ts
Normal file
47
web/service/tag.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { del, get, patch, post } from './base'
|
||||
import type { Tag } from '@/app/components/base/tag-management/constant'
|
||||
|
||||
export const fetchTagList = (type: string) => {
|
||||
return get<Tag[]>('/tags', { params: { type } })
|
||||
}
|
||||
|
||||
export const createTag = (name: string, type: string) => {
|
||||
return post<Tag>('/tags', {
|
||||
body: {
|
||||
name,
|
||||
type,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const updateTag = (tagID: string, name: string) => {
|
||||
return patch(`/tags/${tagID}`, {
|
||||
body: {
|
||||
name,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteTag = (tagID: string) => {
|
||||
return del(`/tags/${tagID}`)
|
||||
}
|
||||
|
||||
export const bindTag = (tagIDList: string[], targetID: string, type: string) => {
|
||||
return post('/tag-bindings/create', {
|
||||
body: {
|
||||
tag_ids: tagIDList,
|
||||
target_id: targetID,
|
||||
type,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const unBindTag = (tagID: string, targetID: string, type: string) => {
|
||||
return post('/tag-bindings/remove', {
|
||||
body: {
|
||||
tag_id: tagID,
|
||||
target_id: targetID,
|
||||
type,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user