Optimize the structure and naming of projects (#335)

This commit is contained in:
Archer
2023-09-21 14:49:56 +08:00
committed by GitHub
parent a3c77480f7
commit 823f4b7ad1
97 changed files with 882 additions and 821 deletions

View File

@@ -9,14 +9,14 @@ import React, {
import { useRouter } from 'next/router';
import { Box, Flex, Button, FormControl, IconButton, Input } from '@chakra-ui/react';
import { QuestionOutlineIcon, DeleteIcon } from '@chakra-ui/icons';
import { delKbById, putKbById } from '@/api/plugins/kb';
import { delDatasetById, putDatasetById } from '@/api/core/dataset';
import { useSelectFile } from '@/hooks/useSelectFile';
import { useToast } from '@/hooks/useToast';
import { useDatasetStore } from '@/store/dataset';
import { useConfirm } from '@/hooks/useConfirm';
import { UseFormReturn } from 'react-hook-form';
import { compressImg } from '@/utils/file';
import type { KbItemType } from '@/types/plugin';
import { compressImg } from '@/utils/web/file';
import type { DatasetItemType } from '@/types/core/dataset';
import Avatar from '@/components/Avatar';
import Tag from '@/components/Tag';
import MyTooltip from '@/components/MyTooltip';
@@ -26,7 +26,7 @@ export interface ComponentRef {
}
const Info = (
{ kbId, form }: { kbId: string; form: UseFormReturn<KbItemType, any> },
{ kbId, form }: { kbId: string; form: UseFormReturn<DatasetItemType, any> },
ref: ForwardedRef<ComponentRef>
) => {
const { getValues, formState, setValue, register, handleSubmit } = form;
@@ -53,7 +53,7 @@ const Info = (
const onclickDelKb = useCallback(async () => {
setBtnLoading(true);
try {
await delKbById(kbId);
await delDatasetById(kbId);
toast({
title: '删除成功',
status: 'success'
@@ -70,10 +70,10 @@ const Info = (
}, [setBtnLoading, kbId, toast, router, loadKbList]);
const saveSubmitSuccess = useCallback(
async (data: KbItemType) => {
async (data: DatasetItemType) => {
setBtnLoading(true);
try {
await putKbById({
await putDatasetById({
id: kbId,
...data
});