mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-31 13:03:49 +08:00
Revert "Refactor: dataset / kb API to RESTFul style" (#13646)
Reverts infiniflow/ragflow#13619
This commit is contained in:
@@ -45,7 +45,7 @@ export function ChunkMethodForm() {
|
||||
|
||||
const finalParserId: DocumentParserType = useWatch({
|
||||
control: form.control,
|
||||
name: 'chunk_method',
|
||||
name: 'parser_id',
|
||||
});
|
||||
|
||||
const ConfigurationComponent = useMemo(() => {
|
||||
|
||||
@@ -69,7 +69,7 @@ export function ChunkMethodItem(props: IProps) {
|
||||
return (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={'chunk_method'}
|
||||
name={'parser_id'}
|
||||
render={({ field }) => (
|
||||
<FormItem className=" items-center space-y-1">
|
||||
<div className={line === 1 ? 'flex items-center' : ''}>
|
||||
@@ -121,7 +121,7 @@ export const EmbeddingSelect = ({
|
||||
const { handleChange } = useHandleKbEmbedding();
|
||||
|
||||
const oldValue = useMemo(() => {
|
||||
const embdStr = form.getValues(name || 'embedding_model');
|
||||
const embdStr = form.getValues(name || 'embd_id');
|
||||
return embdStr || '';
|
||||
}, [form]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -165,7 +165,7 @@ export function EmbeddingModelItem({ line = 1, isEdit }: IProps) {
|
||||
<>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={'embedding_model'}
|
||||
name={'embd_id'}
|
||||
render={({ field }) => (
|
||||
<FormItem className={cn(' items-center space-y-0 ')}>
|
||||
<div
|
||||
|
||||
@@ -14,11 +14,11 @@ export const formSchema = z
|
||||
avatar: z.any().nullish(),
|
||||
permission: z.string().optional(),
|
||||
language: z.string().optional(),
|
||||
chunk_method: z.string(),
|
||||
parser_id: z.string(),
|
||||
pipeline_id: z.string().optional(),
|
||||
pipeline_name: z.string().optional(),
|
||||
pipeline_avatar: z.string().optional(),
|
||||
embedding_model: z.string(),
|
||||
embd_id: z.string(),
|
||||
parser_config: z
|
||||
.object({
|
||||
layout_recognize: z.string(),
|
||||
|
||||
@@ -31,7 +31,7 @@ export function useHasParsedDocument(isEdit?: boolean) {
|
||||
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration({
|
||||
isEdit,
|
||||
});
|
||||
return knowledgeDetails.chunk_count > 0;
|
||||
return knowledgeDetails.chunk_num > 0;
|
||||
}
|
||||
|
||||
export const useFetchKnowledgeConfigurationOnMount = (
|
||||
@@ -60,14 +60,14 @@ export const useFetchKnowledgeConfigurationOnMount = (
|
||||
'description',
|
||||
'name',
|
||||
'permission',
|
||||
'embd_id',
|
||||
'parser_id',
|
||||
'language',
|
||||
'parser_config',
|
||||
'connectors',
|
||||
'pagerank',
|
||||
'avatar',
|
||||
]),
|
||||
embedding_model: knowledgeDetails.embd_id,
|
||||
chunk_method: knowledgeDetails.parser_id,
|
||||
} as z.infer<typeof formSchema>;
|
||||
form.reset(formValues);
|
||||
}, [form, knowledgeDetails]);
|
||||
|
||||
@@ -219,7 +219,7 @@ export default function DatasetSettings() {
|
||||
defaultValue: knowledgeDetails.pipeline_id ? 2 : 1,
|
||||
});
|
||||
const selectedTag = useWatch({
|
||||
name: 'chunk_method',
|
||||
name: 'parser_id',
|
||||
control: form.control,
|
||||
});
|
||||
useEffect(() => {
|
||||
|
||||
@@ -16,7 +16,7 @@ export function GeneralSavingButton() {
|
||||
() => form.formState.defaultValues ?? {},
|
||||
[form.formState.defaultValues],
|
||||
);
|
||||
const chunk_method = defaultValues['chunk_method'];
|
||||
const parser_id = defaultValues['parser_id'];
|
||||
|
||||
return (
|
||||
<ButtonLoading
|
||||
@@ -31,7 +31,7 @@ export function GeneralSavingButton() {
|
||||
if (isValidate) {
|
||||
saveKnowledgeConfiguration({
|
||||
kb_id,
|
||||
chunk_method,
|
||||
parser_id,
|
||||
name,
|
||||
description,
|
||||
avatar,
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import message from '@/components/ui/message';
|
||||
import agentService from '@/services/agent-service';
|
||||
import {
|
||||
deletePipelineTask,
|
||||
runGraphRag,
|
||||
runRaptor,
|
||||
traceGraphRag,
|
||||
traceRaptor,
|
||||
} from '@/services/knowledge-service';
|
||||
import kbService, { deletePipelineTask } from '@/services/knowledge-service';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { t } from 'i18next';
|
||||
import { useEffect, useState } from 'react';
|
||||
@@ -59,7 +53,9 @@ export const useTraceGenerate = ({ open }: { open: boolean }) => {
|
||||
retryDelay: 1000,
|
||||
enabled: open,
|
||||
queryFn: async () => {
|
||||
const { data } = await traceGraphRag(id);
|
||||
const { data } = await kbService.traceGraphRag({
|
||||
kb_id: id,
|
||||
});
|
||||
return data?.data || {};
|
||||
},
|
||||
});
|
||||
@@ -74,7 +70,9 @@ export const useTraceGenerate = ({ open }: { open: boolean }) => {
|
||||
retryDelay: 1000,
|
||||
enabled: open,
|
||||
queryFn: async () => {
|
||||
const { data } = await traceRaptor(id);
|
||||
const { data } = await kbService.traceRaptor({
|
||||
kb_id: id,
|
||||
});
|
||||
return data?.data || {};
|
||||
},
|
||||
});
|
||||
@@ -135,8 +133,12 @@ export const useDatasetGenerate = () => {
|
||||
mutationKey: [DatasetKey.generate],
|
||||
mutationFn: async ({ type }: { type: GenerateType }) => {
|
||||
const func =
|
||||
type === GenerateType.KnowledgeGraph ? runGraphRag : runRaptor;
|
||||
const { data } = await func(id);
|
||||
type === GenerateType.KnowledgeGraph
|
||||
? kbService.runGraphRag
|
||||
: kbService.runRaptor;
|
||||
const { data } = await func({
|
||||
kb_id: id,
|
||||
});
|
||||
if (data.code === 0) {
|
||||
message.success(t('message.operated'));
|
||||
queryClient.invalidateQueries({
|
||||
|
||||
Reference in New Issue
Block a user