mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-06 10:17:49 +08:00
Fix: Dataset: When configuring the "general chunk method," options such as chunk size and parent-child slicing are unavailable. (#14459)
### What problem does this PR solve? Fix: Dataset: When configuring the "general chunk method," options such as chunk size and parent-child slicing are unavailable. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: balibabu <assassin_cike@163.com>
This commit is contained in:
@ -197,6 +197,8 @@ def get_dataset(dataset_id: str, tenant_id: str):
|
||||
return False, "Invalid Dataset ID"
|
||||
|
||||
response_data = remap_dictionary_keys(kb.to_dict())
|
||||
response_data["size"] = DocumentService.get_total_size_by_kb_id(dataset_id)
|
||||
response_data["connectors"] = list(Connector2KbService.list_connectors(dataset_id))
|
||||
return True, response_data
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { DocumentParserType } from '@/constants/knowledge';
|
||||
import { useFetchKnowledgeList } from '@/hooks/use-knowledge-request';
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { IDataset } from '@/interfaces/database/dataset';
|
||||
import { useBuildQueryVariableOptions } from '@/pages/agent/hooks/use-get-begin-query';
|
||||
import { toLower } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
@ -35,7 +35,7 @@ export function useDisableDifferenceEmbeddingDataset(name: string) {
|
||||
const nextOptions = useMemo(() => {
|
||||
const datasetListMap = datasetListOrigin
|
||||
.filter((x) => x.chunk_method !== DocumentParserType.Tag)
|
||||
.map((item: IKnowledge) => {
|
||||
.map((item: IDataset) => {
|
||||
return {
|
||||
label: item.name,
|
||||
icon: () => (
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
} from '@/hooks/use-document-request';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { IReferenceChunk } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import { cn } from '@/lib/utils';
|
||||
import PdfPreview from '../document-preview/pdf-preview';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '../ui/sheet';
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
IMessage,
|
||||
Message,
|
||||
} from '@/interfaces/database/chat';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { IKnowledgeFile } from '@/interfaces/database/dataset';
|
||||
import { changeLanguageAsync } from '@/locales/config';
|
||||
import api from '@/utils/api';
|
||||
import { getAuthorization } from '@/utils/authorization-util';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import message from '@/components/ui/message';
|
||||
import { PaginationProps } from '@/interfaces/antd-compat';
|
||||
import { ResponseGetType, ResponseType } from '@/interfaces/database/base';
|
||||
import { IChunk, IKnowledgeFile } from '@/interfaces/database/knowledge';
|
||||
import { IChunk, IKnowledgeFile } from '@/interfaces/database/dataset';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useDebounce } from 'ahooks';
|
||||
|
||||
@ -4,11 +4,11 @@ import message from '@/components/ui/message';
|
||||
import { RunningStatus } from '@/constants/knowledge';
|
||||
import { ResponseType } from '@/interfaces/database/base';
|
||||
import { IReferenceChunk } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import {
|
||||
IDocumentInfo,
|
||||
IDocumentInfoFilter,
|
||||
} from '@/interfaces/database/document';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import {
|
||||
IChangeParserConfigRequestBody,
|
||||
IDocumentMetaRequestBody,
|
||||
|
||||
@ -2,14 +2,14 @@ import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-f
|
||||
import message from '@/components/ui/message';
|
||||
import { ParseType } from '@/constants/knowledge';
|
||||
import { ResponsePostType } from '@/interfaces/database/base';
|
||||
import { IDataset, IDatasetListResult } from '@/interfaces/database/dataset';
|
||||
import {
|
||||
IKnowledge,
|
||||
IDataset,
|
||||
IDatasetListResult,
|
||||
IKnowledgeGraph,
|
||||
INextTestingResult,
|
||||
IRenameTag,
|
||||
ITestingResult,
|
||||
} from '@/interfaces/database/knowledge';
|
||||
} from '@/interfaces/database/dataset';
|
||||
import { ITestRetrievalRequestBody } from '@/interfaces/request/knowledge';
|
||||
import i18n from '@/locales/config';
|
||||
import kbService, {
|
||||
@ -328,9 +328,9 @@ export const useFetchKnowledgeBaseConfiguration = (props?: {
|
||||
const [searchParams] = useSearchParams();
|
||||
const knowledgeBaseId = searchParams.get('id') || id;
|
||||
|
||||
const { data, isFetching: loading } = useQuery<IKnowledge>({
|
||||
const { data, isFetching: loading } = useQuery<IDataset>({
|
||||
queryKey: [KnowledgeApiAction.FetchKnowledgeDetail, knowledgeBaseId],
|
||||
initialData: {} as IKnowledge,
|
||||
initialData: {} as IDataset,
|
||||
gcTime: 0,
|
||||
enabled: !!knowledgeBaseId && isEdit,
|
||||
queryFn: async () => {
|
||||
|
||||
@ -2,7 +2,7 @@ import message from '@/components/ui/message';
|
||||
import { Modal } from '@/components/ui/modal/modal';
|
||||
import { ResponseGetType } from '@/interfaces/database/base';
|
||||
import { IToken } from '@/interfaces/database/chat';
|
||||
import { ITenantInfo } from '@/interfaces/database/knowledge';
|
||||
import { ITenantInfo } from '@/interfaces/database/dataset';
|
||||
import { ILangfuseConfig } from '@/interfaces/database/system';
|
||||
import {
|
||||
ITenant,
|
||||
@ -213,6 +213,7 @@ export const useFetchSystemVersion = () => {
|
||||
setLoading(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@ -33,7 +33,7 @@ export interface ISwitchForm {
|
||||
import { AgentCategory } from '@/constants/agent';
|
||||
import { Edge, Node } from '@xyflow/react';
|
||||
import { IReference, Message } from './chat';
|
||||
import { IKnowledge } from './knowledge';
|
||||
import { IDataset } from './dataset';
|
||||
|
||||
export type DSLComponents = Record<string, IOperator>;
|
||||
|
||||
@ -81,7 +81,7 @@ export declare interface IFlow {
|
||||
release?: boolean;
|
||||
release_time?: number;
|
||||
last_publish_time?: number;
|
||||
datasets?: Pick<IKnowledge, 'id' | 'name' | 'avatar'>[];
|
||||
datasets?: Pick<IDataset, 'id' | 'name' | 'avatar'>[];
|
||||
}
|
||||
|
||||
export interface IFlowTemplate {
|
||||
|
||||
@ -1,6 +1,17 @@
|
||||
// for the dataset list
|
||||
// The data structures returned by the `datasets` interface and `/api/v1/datasets/{id}` are inconsistent.
|
||||
|
||||
import { RunningStatus } from '@/constants/knowledge';
|
||||
import { DataSourceKey } from '@/pages/user-setting/data-source/constant';
|
||||
|
||||
export interface IConnector {
|
||||
id: string;
|
||||
name: string;
|
||||
status: RunningStatus;
|
||||
source: DataSourceKey;
|
||||
auto_parse?: '0' | '1';
|
||||
}
|
||||
|
||||
export interface IDataset {
|
||||
avatar?: string;
|
||||
chunk_count: number;
|
||||
@ -11,7 +22,8 @@ export interface IDataset {
|
||||
description?: string;
|
||||
document_count: number;
|
||||
embedding_model: string;
|
||||
graphrag_task_finish_at: null;
|
||||
size?: number;
|
||||
graphrag_task_finish_at: string;
|
||||
graphrag_task_id: Nullable<string>;
|
||||
id: string;
|
||||
language: string;
|
||||
@ -34,6 +46,7 @@ export interface IDataset {
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
vector_similarity_weight: number;
|
||||
connectors: IConnector[];
|
||||
}
|
||||
|
||||
interface Parserconfig {
|
||||
@ -42,14 +55,20 @@ interface Parserconfig {
|
||||
children_delimiter: string;
|
||||
chunk_token_num: number;
|
||||
delimiter: string;
|
||||
from_page?: number;
|
||||
to_page?: number;
|
||||
graphrag: Graphrag;
|
||||
html4excel: boolean;
|
||||
image_context_size: number;
|
||||
layout_recognize: string;
|
||||
llm_id: string;
|
||||
metadata?: any;
|
||||
built_in_metadata?: Array<{ key: string; type: string }>;
|
||||
enable_metadata?: boolean;
|
||||
parent_child: Parentchild;
|
||||
raptor: Raptor;
|
||||
table_context_size: number;
|
||||
tag_kb_ids?: string[];
|
||||
topn_tags: number;
|
||||
}
|
||||
|
||||
@ -77,3 +96,125 @@ export interface IDatasetListResult {
|
||||
kbs: IDataset[];
|
||||
total_datasets: number;
|
||||
}
|
||||
|
||||
// Types migrated from knowledge.ts
|
||||
|
||||
export interface IKnowledgeFileParserConfig {
|
||||
chunk_token_num: number;
|
||||
layout_recognize: boolean;
|
||||
pages: number[][];
|
||||
task_page_size: number;
|
||||
}
|
||||
|
||||
export interface IKnowledgeFile {
|
||||
chunk_num: number;
|
||||
create_date: string;
|
||||
create_time: number;
|
||||
created_by: string;
|
||||
id: string;
|
||||
kb_id: string;
|
||||
location: string;
|
||||
name: string;
|
||||
parser_id: string;
|
||||
process_begin_at?: any;
|
||||
process_duration: number;
|
||||
progress: number; // parsing process
|
||||
progress_msg: string; // parsing log
|
||||
run: RunningStatus; // parsing status
|
||||
size: number;
|
||||
source_type: string;
|
||||
status: string; // enabled
|
||||
thumbnail?: any; // base64
|
||||
token_num: number;
|
||||
type: string;
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
parser_config: IKnowledgeFileParserConfig;
|
||||
}
|
||||
|
||||
export interface ITenantInfo {
|
||||
asr_id: string;
|
||||
embd_id: string;
|
||||
img2txt_id: string;
|
||||
llm_id: string;
|
||||
name: string;
|
||||
parser_ids: string;
|
||||
role: string;
|
||||
tenant_id: string;
|
||||
chat_id: string;
|
||||
speech2text_id: string;
|
||||
rerank_id?: string;
|
||||
tts_id: string;
|
||||
// Tenant model IDs
|
||||
tenant_asr_id?: string;
|
||||
tenant_embd_id?: string;
|
||||
tenant_img2txt_id?: string;
|
||||
tenant_llm_id?: string;
|
||||
tenant_rerank_id?: string;
|
||||
tenant_tts_id?: string;
|
||||
}
|
||||
|
||||
export type ChunkDocType = 'image' | 'table' | 'text';
|
||||
|
||||
export interface IChunk {
|
||||
available_int: number; // Whether to enable, 0: not enabled, 1: enabled
|
||||
chunk_id: string;
|
||||
content_with_weight: string;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
doc_type_kwd?: ChunkDocType;
|
||||
image_id: string;
|
||||
important_kwd?: string[];
|
||||
question_kwd?: string[]; // keywords
|
||||
tag_kwd?: string[];
|
||||
positions: number[][];
|
||||
tag_feas?: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface ITestingChunk {
|
||||
chunk_id: string;
|
||||
content_ltks: string;
|
||||
content_with_weight: string;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
img_id: string;
|
||||
image_id: string;
|
||||
important_kwd: any[];
|
||||
kb_id: string;
|
||||
similarity: number;
|
||||
term_similarity: number;
|
||||
vector: number[];
|
||||
vector_similarity: number;
|
||||
highlight: string;
|
||||
positions: number[][];
|
||||
docnm_kwd: string;
|
||||
doc_type_kwd: string;
|
||||
}
|
||||
|
||||
export interface ITestingDocument {
|
||||
count: number;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
}
|
||||
|
||||
export interface ITestingResult {
|
||||
chunks: ITestingChunk[];
|
||||
documents: ITestingDocument[];
|
||||
total: number;
|
||||
labels?: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface INextTestingResult {
|
||||
chunks: ITestingChunk[];
|
||||
doc_aggs: ITestingDocument[];
|
||||
total: number;
|
||||
labels?: Record<string, number>;
|
||||
isRuned?: boolean;
|
||||
}
|
||||
|
||||
export type IRenameTag = { fromTag: string; toTag: string };
|
||||
|
||||
export interface IKnowledgeGraph {
|
||||
graph: Record<string, any>;
|
||||
mind_map: import('@antv/g6/lib/types').TreeData;
|
||||
}
|
||||
|
||||
@ -1,194 +0,0 @@
|
||||
import { RunningStatus } from '@/constants/knowledge';
|
||||
import { DataSourceKey } from '@/pages/user-setting/data-source/constant';
|
||||
import { TreeData } from '@antv/g6/lib/types';
|
||||
export interface IConnector {
|
||||
id: string;
|
||||
name: string;
|
||||
status: RunningStatus;
|
||||
source: DataSourceKey;
|
||||
auto_parse?: '0' | '1';
|
||||
}
|
||||
// knowledge base detail
|
||||
export interface IKnowledge {
|
||||
avatar?: any;
|
||||
chunk_num: number;
|
||||
create_date: string;
|
||||
create_time: number;
|
||||
created_by: string;
|
||||
description: string;
|
||||
doc_num: number;
|
||||
id: string;
|
||||
name: string;
|
||||
parser_config: ParserConfig;
|
||||
chunk_method: string;
|
||||
pipeline_id: string;
|
||||
pipeline_name: string;
|
||||
pipeline_avatar: string;
|
||||
permission: string;
|
||||
similarity_threshold: number;
|
||||
status: string;
|
||||
tenant_id: string;
|
||||
token_num: number;
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
vector_similarity_weight: number;
|
||||
embedding_model: string;
|
||||
nickname: string;
|
||||
operator_permission: number;
|
||||
size: number;
|
||||
raptor_task_finish_at?: string;
|
||||
raptor_task_id?: string;
|
||||
mindmap_task_finish_at?: string;
|
||||
mindmap_task_id?: string;
|
||||
graphrag_task_finish_at: string;
|
||||
graphrag_task_id: string;
|
||||
connectors: IConnector[];
|
||||
embd_id: string;
|
||||
parser_id: string;
|
||||
}
|
||||
|
||||
export interface IKnowledgeResult {
|
||||
kbs: IKnowledge[];
|
||||
total_datasets: number;
|
||||
}
|
||||
|
||||
export interface Raptor {
|
||||
use_raptor: boolean;
|
||||
}
|
||||
|
||||
export interface ParserConfig {
|
||||
from_page?: number;
|
||||
to_page?: number;
|
||||
auto_keywords?: number;
|
||||
auto_questions?: number;
|
||||
chunk_token_num?: number;
|
||||
delimiter?: string;
|
||||
html4excel?: boolean;
|
||||
layout_recognize?: boolean;
|
||||
raptor?: Raptor;
|
||||
tag_kb_ids?: string[];
|
||||
topn_tags?: number;
|
||||
graphrag?: { use_graphrag?: boolean };
|
||||
enable_metadata?: boolean;
|
||||
metadata?: any;
|
||||
built_in_metadata?: Array<{ key: string; type: string }>;
|
||||
}
|
||||
|
||||
export interface IKnowledgeFileParserConfig {
|
||||
chunk_token_num: number;
|
||||
layout_recognize: boolean;
|
||||
pages: number[][];
|
||||
task_page_size: number;
|
||||
}
|
||||
export interface IKnowledgeFile {
|
||||
chunk_num: number;
|
||||
create_date: string;
|
||||
create_time: number;
|
||||
created_by: string;
|
||||
id: string;
|
||||
kb_id: string;
|
||||
location: string;
|
||||
name: string;
|
||||
parser_id: string;
|
||||
process_begin_at?: any;
|
||||
process_duration: number;
|
||||
progress: number; // parsing process
|
||||
progress_msg: string; // parsing log
|
||||
run: RunningStatus; // parsing status
|
||||
size: number;
|
||||
source_type: string;
|
||||
status: string; // enabled
|
||||
thumbnail?: any; // base64
|
||||
token_num: number;
|
||||
type: string;
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
parser_config: IKnowledgeFileParserConfig;
|
||||
}
|
||||
|
||||
export interface ITenantInfo {
|
||||
asr_id: string;
|
||||
embd_id: string;
|
||||
img2txt_id: string;
|
||||
llm_id: string;
|
||||
name: string;
|
||||
parser_ids: string;
|
||||
role: string;
|
||||
tenant_id: string;
|
||||
chat_id: string;
|
||||
speech2text_id: string;
|
||||
rerank_id?: string;
|
||||
tts_id: string;
|
||||
// Tenant model IDs
|
||||
tenant_asr_id?: string;
|
||||
tenant_embd_id?: string;
|
||||
tenant_img2txt_id?: string;
|
||||
tenant_llm_id?: string;
|
||||
tenant_rerank_id?: string;
|
||||
tenant_tts_id?: string;
|
||||
}
|
||||
|
||||
export type ChunkDocType = 'image' | 'table' | 'text';
|
||||
|
||||
export interface IChunk {
|
||||
available_int: number; // Whether to enable, 0: not enabled, 1: enabled
|
||||
chunk_id: string;
|
||||
content_with_weight: string;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
doc_type_kwd?: ChunkDocType;
|
||||
image_id: string;
|
||||
important_kwd?: string[];
|
||||
question_kwd?: string[]; // keywords
|
||||
tag_kwd?: string[];
|
||||
positions: number[][];
|
||||
tag_feas?: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface ITestingChunk {
|
||||
chunk_id: string;
|
||||
content_ltks: string;
|
||||
content_with_weight: string;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
img_id: string;
|
||||
image_id: string;
|
||||
important_kwd: any[];
|
||||
kb_id: string;
|
||||
similarity: number;
|
||||
term_similarity: number;
|
||||
vector: number[];
|
||||
vector_similarity: number;
|
||||
highlight: string;
|
||||
positions: number[][];
|
||||
docnm_kwd: string;
|
||||
doc_type_kwd: string;
|
||||
}
|
||||
|
||||
export interface ITestingDocument {
|
||||
count: number;
|
||||
doc_id: string;
|
||||
doc_name: string;
|
||||
}
|
||||
|
||||
export interface ITestingResult {
|
||||
chunks: ITestingChunk[];
|
||||
documents: ITestingDocument[];
|
||||
total: number;
|
||||
labels?: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface INextTestingResult {
|
||||
chunks: ITestingChunk[];
|
||||
doc_aggs: ITestingDocument[];
|
||||
total: number;
|
||||
labels?: Record<string, number>;
|
||||
isRuned?: boolean;
|
||||
}
|
||||
|
||||
export type IRenameTag = { fromTag: string; toTag: string };
|
||||
|
||||
export interface IKnowledgeGraph {
|
||||
graph: Record<string, any>;
|
||||
mind_map: TreeData;
|
||||
}
|
||||
@ -10,7 +10,7 @@ import {
|
||||
DialogTrigger,
|
||||
} from '@/components/ui/dialog';
|
||||
import { IFlow } from '@/interfaces/database/agent';
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { IDataset } from '@/interfaces/database/dataset';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { BookPlus } from 'lucide-react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
@ -26,7 +26,7 @@ interface PublishConfirmDialogProps {
|
||||
function AssociatedDataset({
|
||||
associatedDatasets,
|
||||
}: {
|
||||
associatedDatasets: Pick<IKnowledge, 'id' | 'name' | 'avatar'>[];
|
||||
associatedDatasets: Pick<IDataset, 'id' | 'name' | 'avatar'>[];
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import Image from '@/components/image';
|
||||
import { useTheme } from '@/components/theme-provider';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
@ -8,7 +7,7 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip';
|
||||
import type { ChunkDocType, IChunk } from '@/interfaces/database/knowledge';
|
||||
import type { ChunkDocType, IChunk } from '@/interfaces/database/dataset';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { CheckedState } from '@radix-ui/react-checkbox';
|
||||
import classNames from 'classnames';
|
||||
@ -44,7 +43,6 @@ const ChunkCard = ({
|
||||
const { t } = useTranslation();
|
||||
const available = Number(item.available_int);
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const { theme } = useTheme();
|
||||
|
||||
const onChange = (checked: boolean) => {
|
||||
setEnabled(checked);
|
||||
|
||||
@ -22,7 +22,7 @@ import { Switch } from '@/components/ui/switch';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { useFetchChunk } from '@/hooks/use-chunk-request';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import type { ChunkDocType } from '@/interfaces/database/knowledge';
|
||||
import type { ChunkDocType } from '@/interfaces/database/dataset';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { FieldValues, FormProvider, useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
useDeleteChunk,
|
||||
useSelectChunkList,
|
||||
} from '@/hooks/use-chunk-request';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import { buildChunkHighlights } from '@/utils/document-util';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { IHighlight } from 'react-pdf-highlighter';
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import Image from '@/components/image';
|
||||
import { useTheme } from '@/components/theme-provider';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
@ -8,7 +7,7 @@ import {
|
||||
PopoverTrigger,
|
||||
} from '@/components/ui/popover';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import { CheckedState } from '@radix-ui/react-checkbox';
|
||||
import classNames from 'classnames';
|
||||
import DOMPurify from 'dompurify';
|
||||
@ -39,7 +38,6 @@ const ChunkCard = ({
|
||||
}: IProps) => {
|
||||
const available = Number(item.available_int);
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const { theme } = useTheme();
|
||||
|
||||
const onChange = (checked: boolean) => {
|
||||
setEnabled(checked);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { IDataset } from '@/interfaces/database/dataset';
|
||||
import React, { createContext, ReactNode, useContext } from 'react';
|
||||
|
||||
interface KnowledgeBaseContextType {
|
||||
knowledgeBase: IKnowledge | null;
|
||||
knowledgeBase: IDataset | null;
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ const KnowledgeBaseContext = createContext<
|
||||
|
||||
export const KnowledgeBaseProvider: React.FC<{
|
||||
children: ReactNode;
|
||||
knowledgeBase: IKnowledge | null;
|
||||
knowledgeBase: IDataset | null;
|
||||
loading: boolean;
|
||||
}> = ({ children, knowledgeBase, loading }) => {
|
||||
return (
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { SearchInput } from '@/components/ui/input';
|
||||
import { Modal } from '@/components/ui/modal/modal';
|
||||
import { IConnector } from '@/interfaces/database/knowledge';
|
||||
import { IConnector } from '@/interfaces/database/dataset';
|
||||
import { useListDataSource } from '@/pages/user-setting/data-source/hooks';
|
||||
import { IDataSourceBase } from '@/pages/user-setting/data-source/interface';
|
||||
import { t } from 'i18next';
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from '@/components/ui/tooltip';
|
||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||
import { IConnector } from '@/interfaces/database/knowledge';
|
||||
import { IConnector } from '@/interfaces/database/dataset';
|
||||
import { delSourceModal } from '@/pages/user-setting/data-source/component/delete-source-modal';
|
||||
import { useDataSourceInfo } from '@/pages/user-setting/data-source/constant';
|
||||
import { useDataSourceRebuild } from '@/pages/user-setting/data-source/hooks';
|
||||
|
||||
@ -31,7 +31,7 @@ export function useHasParsedDocument(isEdit?: boolean) {
|
||||
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration({
|
||||
isEdit,
|
||||
});
|
||||
return knowledgeDetails.chunk_num > 0;
|
||||
return knowledgeDetails.chunk_count > 0;
|
||||
}
|
||||
|
||||
export const useFetchKnowledgeConfigurationOnMount = (
|
||||
@ -66,8 +66,8 @@ export const useFetchKnowledgeConfigurationOnMount = (
|
||||
'pagerank',
|
||||
'avatar',
|
||||
]),
|
||||
embedding_model: knowledgeDetails.embd_id,
|
||||
chunk_method: knowledgeDetails.parser_id,
|
||||
embedding_model: knowledgeDetails.embedding_model,
|
||||
chunk_method: knowledgeDetails.chunk_method,
|
||||
} as z.infer<typeof formSchema>;
|
||||
form.reset(formValues);
|
||||
}, [form, knowledgeDetails]);
|
||||
|
||||
@ -14,7 +14,7 @@ import { Form } from '@/components/ui/form';
|
||||
import { FormLayout } from '@/constants/form';
|
||||
import { DocumentParserType, ParseType } from '@/constants/knowledge';
|
||||
import { PermissionRole } from '@/constants/permission';
|
||||
import { IConnector, IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { IConnector, IDataset } from '@/interfaces/database/dataset';
|
||||
import { useDataSourceInfo } from '@/pages/user-setting/data-source/constant';
|
||||
import { IDataSourceBase } from '@/pages/user-setting/data-source/interface';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
@ -43,8 +43,8 @@ const enum DocumentType {
|
||||
}
|
||||
export const DataSetContext = createContext<{
|
||||
loading: boolean;
|
||||
knowledgeDetails: IKnowledge;
|
||||
}>({ loading: false, knowledgeDetails: {} as IKnowledge });
|
||||
knowledgeDetails: IDataset;
|
||||
}>({ loading: false, knowledgeDetails: {} as IDataset });
|
||||
|
||||
const initialEntityTypes = [
|
||||
'organization',
|
||||
@ -127,7 +127,6 @@ export default function DatasetSettings() {
|
||||
useState<IGenerateLogButtonProps>();
|
||||
|
||||
useEffect(() => {
|
||||
console.log('🚀 ~ DatasetSettings ~ knowledgeDetails:', knowledgeDetails);
|
||||
if (knowledgeDetails) {
|
||||
// const data: IDataPipelineNodeProps = {
|
||||
// id: knowledgeDetails.pipeline_id,
|
||||
@ -137,15 +136,16 @@ export default function DatasetSettings() {
|
||||
// };
|
||||
// setPipelineData(data);
|
||||
|
||||
const source_data: IDataSourceNodeProps[] =
|
||||
knowledgeDetails?.connectors?.map((connector) => {
|
||||
return {
|
||||
...connector,
|
||||
icon:
|
||||
dataSourceInfo[connector.source as keyof typeof dataSourceInfo]
|
||||
?.icon || '',
|
||||
};
|
||||
});
|
||||
const source_data: IDataSourceNodeProps[] = (
|
||||
knowledgeDetails?.connectors ?? []
|
||||
).map((connector: IConnector) => {
|
||||
return {
|
||||
...connector,
|
||||
icon:
|
||||
dataSourceInfo[connector.source as keyof typeof dataSourceInfo]
|
||||
?.icon || '',
|
||||
};
|
||||
});
|
||||
|
||||
setSourceData(source_data);
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ export default function Dataset() {
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
preChildren={<Generate disabled={!(dataSetData.chunk_num > 0)} />}
|
||||
preChildren={<Generate disabled={!(dataSetData.chunk_count > 0)} />}
|
||||
// preChildren={
|
||||
// <Button
|
||||
// variant={'ghost'}
|
||||
|
||||
@ -19,12 +19,12 @@ import { cn, formatBytes } from '@/lib/utils';
|
||||
import { Routes } from '@/routes';
|
||||
import { formatPureDate } from '@/utils/date';
|
||||
|
||||
import { IKnowledge } from '@/interfaces/database/knowledge';
|
||||
import { IDataset } from '@/interfaces/database/dataset';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
type PropType = {
|
||||
refreshCount?: number;
|
||||
dataset: IKnowledge;
|
||||
dataset: IDataset;
|
||||
};
|
||||
|
||||
export function SideBar({ dataset: data }: PropType) {
|
||||
@ -96,9 +96,9 @@ export function SideBar({ dataset: data }: PropType) {
|
||||
>
|
||||
<div className="flex justify-between">
|
||||
<span>
|
||||
{data.doc_num} {t('knowledgeDetails.files')}
|
||||
{data.document_count} {t('knowledgeDetails.files')}
|
||||
</span>
|
||||
<span>{formatBytes(data.size)}</span>
|
||||
<span>{data.size ? formatBytes(data.size) : ''}</span>
|
||||
</div>
|
||||
|
||||
<div className="mt-0.5">
|
||||
|
||||
@ -7,7 +7,7 @@ import { Card } from '@/components/ui/card';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useTestRetrieval } from '@/hooks/use-knowledge-request';
|
||||
import { ITestingChunk } from '@/interfaces/database/knowledge';
|
||||
import { ITestingChunk } from '@/interfaces/database/dataset';
|
||||
import { t } from 'i18next';
|
||||
import camelCase from 'lodash/camelCase';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
} from '@/hooks/use-document-request';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { IReferenceChunk } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
} from '@/hooks/use-knowledge-request';
|
||||
import { ResponsePostType } from '@/interfaces/database/base';
|
||||
import { IAnswer } from '@/interfaces/database/chat';
|
||||
import { ITestingResult } from '@/interfaces/database/knowledge';
|
||||
import { ITestingResult } from '@/interfaces/database/dataset';
|
||||
import { IAskRequestBody } from '@/interfaces/request/chat';
|
||||
import kbService from '@/services/knowledge-service';
|
||||
import chatService from '@/services/next-chat-service';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Authorization } from '@/constants/authorization';
|
||||
import { IRenameTag } from '@/interfaces/database/knowledge';
|
||||
import { IRenameTag } from '@/interfaces/database/dataset';
|
||||
import {
|
||||
IFetchDocumentListRequestBody,
|
||||
IFetchKnowledgeListRequestParams,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Images, SupportedPreviewDocumentTypes } from '@/constants/common';
|
||||
import { UploadFile } from '@/interfaces/antd-compat';
|
||||
import { IReferenceChunk } from '@/interfaces/database/chat';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { IChunk } from '@/interfaces/database/dataset';
|
||||
import { get } from 'lodash';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @deprecated This file will be deprecated. Please use `@web/src/utils/next-request.ts` instead.
|
||||
*/
|
||||
|
||||
import message from '@/components/ui/message';
|
||||
import { Authorization } from '@/constants/authorization';
|
||||
import { ResponseType } from '@/interfaces/database/base';
|
||||
|
||||
Reference in New Issue
Block a user