chore(web): new lint setup (#30020)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-23 16:58:55 +08:00
committed by GitHub
co-authored by yyh
parent 9701a2994b
commit f2842da397
3356 changed files with 85039 additions and 81271 deletions
+5 -5
View File
@@ -1,8 +1,6 @@
import groupBy from 'lodash-es/groupBy'
import type { MutationOptions } from '@tanstack/react-query'
import { useMutation } from '@tanstack/react-query'
import { createDocument, createFirstDocument, fetchDefaultProcessRule, fetchFileIndexingEstimate } from '../datasets'
import type { IndexingType } from '@/app/components/datasets/create/step-two'
import type { DataSourceProvider, NotionPage } from '@/models/common'
import type {
ChunkingMode,
CrawlOptions,
@@ -10,6 +8,7 @@ import type {
CreateDatasetReq,
CreateDatasetResponse,
CreateDocumentReq,
createDocumentResponse,
CustomFile,
DataSourceType,
FileIndexingEstimateResponse,
@@ -17,10 +16,11 @@ import type {
NotionInfo,
ProcessRule,
ProcessRuleResponse,
createDocumentResponse,
} from '@/models/datasets'
import type { DataSourceProvider, NotionPage } from '@/models/common'
import { useMutation } from '@tanstack/react-query'
import groupBy from 'lodash-es/groupBy'
import { post } from '../base'
import { createDocument, createFirstDocument, fetchDefaultProcessRule, fetchFileIndexingEstimate } from '../datasets'
const NAME_SPACE = 'knowledge/create-dataset'
+12 -12
View File
@@ -1,16 +1,10 @@
import type { MutationOptions } from '@tanstack/react-query'
import {
keepPreviousData,
useInfiniteQuery,
useMutation,
useQuery,
useQueryClient,
} from '@tanstack/react-query'
import qs from 'qs'
import type { ApiKeysListResponse } from '@/models/app'
import type { CommonResponse } from '@/models/common'
import type {
DataSet,
DataSetListResponse,
DatasetListRequest,
DataSetListResponse,
ErrorDocsResponse,
ExternalAPIListResponse,
FetchDatasetsParams,
@@ -20,10 +14,16 @@ import type {
ProcessRuleResponse,
RelatedAppResponse,
} from '@/models/datasets'
import type { ApiKeysListResponse } from '@/models/app'
import {
keepPreviousData,
useInfiniteQuery,
useMutation,
useQuery,
useQueryClient,
} from '@tanstack/react-query'
import qs from 'qs'
import { get, post } from '../base'
import { useInvalid } from '../use-base'
import type { CommonResponse } from '@/models/common'
const NAME_SPACE = 'dataset'
@@ -199,7 +199,7 @@ export const useInvalidateExternalKnowledgeApiList = () => {
export const useDatasetTestingRecords = (
datasetId?: string,
params?: { page: number; limit: number },
params?: { page: number, limit: number },
) => {
return useQuery<HitTestingRecordsResponse>({
queryKey: [NAME_SPACE, 'testing-records', datasetId, params],
+8 -8
View File
@@ -1,15 +1,15 @@
import type { MetadataType, SortType } from '../datasets'
import type { CommonResponse } from '@/models/common'
import type { DocumentDetailResponse, DocumentListResponse, UpdateDocumentBatchParams } from '@/models/datasets'
import {
useMutation,
useQuery,
} from '@tanstack/react-query'
import { del, get, patch } from '../base'
import { useInvalid } from '../use-base'
import type { MetadataType, SortType } from '../datasets'
import { pauseDocIndexing, resumeDocIndexing } from '../datasets'
import type { DocumentDetailResponse, DocumentListResponse, UpdateDocumentBatchParams } from '@/models/datasets'
import { DocumentActionType } from '@/models/datasets'
import type { CommonResponse } from '@/models/common'
import { normalizeStatusForQuery } from '@/app/components/datasets/documents/status-filter'
import { DocumentActionType } from '@/models/datasets'
import { del, get, patch } from '../base'
import { pauseDocIndexing, resumeDocIndexing } from '../datasets'
import { useInvalid } from '../use-base'
const NAME_SPACE = 'knowledge/document'
@@ -22,7 +22,7 @@ export const useDocumentList = (payload: {
limit: number
sort?: SortType
status?: string
},
}
refetchInterval?: number | false
}) => {
const { query, datasetId, refetchInterval } = payload
+2 -2
View File
@@ -1,5 +1,3 @@
import { useMutation, useQuery } from '@tanstack/react-query'
import { useInvalid } from '../use-base'
import type {
ExternalKnowledgeBaseHitTestingRequest,
ExternalKnowledgeBaseHitTestingResponse,
@@ -8,7 +6,9 @@ import type {
HitTestingRequest,
HitTestingResponse,
} from '@/models/datasets'
import { useMutation, useQuery } from '@tanstack/react-query'
import { get, post } from '../base'
import { useInvalid } from '../use-base'
const NAME_SPACE = 'hit-testing'
+1 -1
View File
@@ -1,6 +1,6 @@
import type { DataSourceNotionWorkspace } from '@/models/common'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { get } from '../base'
import type { DataSourceNotionWorkspace } from '@/models/common'
type PreImportNotionPagesParams = {
datasetId: string
+2 -2
View File
@@ -1,6 +1,6 @@
import { DataType } from '@/app/components/datasets/metadata/types'
import { act, renderHook } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { act, renderHook } from '@testing-library/react'
import { DataType } from '@/app/components/datasets/metadata/types'
import { useBatchUpdateDocMetadata } from '@/service/knowledge/use-metadata'
import { useDocumentListKey } from './use-document'
+4 -4
View File
@@ -1,9 +1,9 @@
import type { BuiltInMetadataItem, MetadataBatchEditToServer, MetadataItemWithValueLength } from '@/app/components/datasets/metadata/types'
import { del, get, patch, post } from '../base'
import { useDocumentListKey, useInvalidDocumentList } from './use-document'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useInvalid } from '../use-base'
import type { DocumentDetailResponse } from '@/models/datasets'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { del, get, patch, post } from '../base'
import { useInvalid } from '../use-base'
import { useDocumentListKey, useInvalidDocumentList } from './use-document'
const NAME_SPACE = 'dataset-metadata'
+14 -14
View File
@@ -1,5 +1,3 @@
import { useMutation, useQuery } from '@tanstack/react-query'
import { del, get, patch, post } from '../base'
import type { CommonResponse } from '@/models/common'
import type {
BatchImportResponse,
@@ -7,9 +5,11 @@ import type {
ChildSegmentsResponse,
ChunkingMode,
SegmentDetailModel,
SegmentUpdater,
SegmentsResponse,
SegmentUpdater,
} from '@/models/datasets'
import { useMutation, useQuery } from '@tanstack/react-query'
import { del, get, patch, post } from '../base'
const NAME_SPACE = 'segment'
@@ -45,9 +45,9 @@ export const useSegmentList = (
export const useUpdateSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'update'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentId: string; body: SegmentUpdater }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentId: string, body: SegmentUpdater }) => {
const { datasetId, documentId, segmentId, body } = payload
return patch<{ data: SegmentDetailModel; doc_form: ChunkingMode }>(`/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}`, { body })
return patch<{ data: SegmentDetailModel, doc_form: ChunkingMode }>(`/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}`, { body })
},
})
}
@@ -55,9 +55,9 @@ export const useUpdateSegment = () => {
export const useAddSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'add'],
mutationFn: (payload: { datasetId: string; documentId: string; body: SegmentUpdater }) => {
mutationFn: (payload: { datasetId: string, documentId: string, body: SegmentUpdater }) => {
const { datasetId, documentId, body } = payload
return post<{ data: SegmentDetailModel; doc_form: ChunkingMode }>(`/datasets/${datasetId}/documents/${documentId}/segment`, { body })
return post<{ data: SegmentDetailModel, doc_form: ChunkingMode }>(`/datasets/${datasetId}/documents/${documentId}/segment`, { body })
},
})
}
@@ -65,7 +65,7 @@ export const useAddSegment = () => {
export const useEnableSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'enable'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentIds: string[] }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentIds: string[] }) => {
const { datasetId, documentId, segmentIds } = payload
const query = segmentIds.map(id => `segment_id=${id}`).join('&')
return patch<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/segment/enable?${query}`)
@@ -76,7 +76,7 @@ export const useEnableSegment = () => {
export const useDisableSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'disable'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentIds: string[] }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentIds: string[] }) => {
const { datasetId, documentId, segmentIds } = payload
const query = segmentIds.map(id => `segment_id=${id}`).join('&')
return patch<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/segment/disable?${query}`)
@@ -87,7 +87,7 @@ export const useDisableSegment = () => {
export const useDeleteSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'delete'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentIds: string[] }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentIds: string[] }) => {
const { datasetId, documentId, segmentIds } = payload
const query = segmentIds.map(id => `segment_id=${id}`).join('&')
return del<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/segments?${query}`)
@@ -124,7 +124,7 @@ export const useChildSegmentList = (
export const useDeleteChildSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'childChunk', 'delete'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentId: string; childChunkId: string }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentId: string, childChunkId: string }) => {
const { datasetId, documentId, segmentId, childChunkId } = payload
return del<CommonResponse>(`/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}/child_chunks/${childChunkId}`)
},
@@ -134,7 +134,7 @@ export const useDeleteChildSegment = () => {
export const useAddChildSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'childChunk', 'add'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentId: string; body: { content: string } }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentId: string, body: { content: string } }) => {
const { datasetId, documentId, segmentId, body } = payload
return post<{ data: ChildChunkDetail }>(`/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}/child_chunks`, { body })
},
@@ -144,7 +144,7 @@ export const useAddChildSegment = () => {
export const useUpdateChildSegment = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'childChunk', 'update'],
mutationFn: (payload: { datasetId: string; documentId: string; segmentId: string; childChunkId: string; body: { content: string } }) => {
mutationFn: (payload: { datasetId: string, documentId: string, segmentId: string, childChunkId: string, body: { content: string } }) => {
const { datasetId, documentId, segmentId, childChunkId, body } = payload
return patch<{ data: ChildChunkDetail }>(`/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}/child_chunks/${childChunkId}`, { body })
},
@@ -154,7 +154,7 @@ export const useUpdateChildSegment = () => {
export const useSegmentBatchImport = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'batchImport'],
mutationFn: (payload: { url: string; body: { upload_file_id: string } }) => {
mutationFn: (payload: { url: string, body: { upload_file_id: string } }) => {
const { url, body } = payload
return post<BatchImportResponse>(url, { body })
},