fix: linter error

This commit is contained in:
Junyan Qin
2025-07-18 17:52:24 +08:00
parent 4e6782a6b7
commit c98d265a1e
8 changed files with 6 additions and 36 deletions

View File

@@ -127,7 +127,6 @@ export default function BotDetailDialog({
<BotForm
initBotId={undefined}
onFormSubmit={handleFormSubmit}
onFormCancel={handleFormCancel}
onBotDeleted={handleBotDeleted}
onNewBotCreated={handleNewBotCreated}
/>
@@ -198,7 +197,6 @@ export default function BotDetailDialog({
<BotForm
initBotId={botId}
onFormSubmit={handleFormSubmit}
onFormCancel={handleFormCancel}
onBotDeleted={handleBotDeleted}
onNewBotCreated={handleNewBotCreated}
/>

View File

@@ -64,13 +64,11 @@ const getFormSchema = (t: (key: string) => string) =>
export default function BotForm({
initBotId,
onFormSubmit,
onFormCancel,
onBotDeleted,
onNewBotCreated,
}: {
initBotId?: string;
onFormSubmit: (value: z.infer<ReturnType<typeof getFormSchema>>) => void;
onFormCancel: () => void;
onBotDeleted: () => void;
onNewBotCreated: (botId: string) => void;
}) {

View File

@@ -14,7 +14,7 @@ import {
import { Switch } from '@/components/ui/switch';
import { ControllerRenderProps } from 'react-hook-form';
import { Button } from '@/components/ui/button';
import { use, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { httpClient } from '@/app/infra/http/HttpClient';
import { LLMModel } from '@/app/infra/entities/api';
import { KnowledgeBase } from '@/app/infra/entities/api';

View File

@@ -7,7 +7,6 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
DialogDescription,
} from '@/components/ui/dialog';
import {
Sidebar,
@@ -21,7 +20,6 @@ import {
} from '@/components/ui/sidebar';
import { Button } from '@/components/ui/button';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
import { httpClient } from '@/app/infra/http/HttpClient';
// import { KnowledgeBase } from '@/app/infra/entities/api';
import KBForm from '@/app/home/knowledge/components/kb-form/KBForm';
@@ -31,8 +29,6 @@ interface KBDetailDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
kbId?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onFormSubmit: (value: z.infer<any>) => void;
onFormCancel: () => void;
onKbDeleted: () => void;
onNewKbCreated: (kbId: string) => void;
@@ -43,7 +39,6 @@ export default function KBDetailDialog({
open,
onOpenChange,
kbId: propKbId,
onFormSubmit,
onFormCancel,
onKbDeleted,
onNewKbCreated,
@@ -52,7 +47,6 @@ export default function KBDetailDialog({
const { t } = useTranslation();
const [kbId, setKbId] = useState<string | undefined>(propKbId);
const [activeMenu, setActiveMenu] = useState('metadata');
const [fileId, setFileId] = useState<string | undefined>(undefined);
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
useEffect(() => {
@@ -109,9 +103,6 @@ export default function KBDetailDialog({
{activeMenu === 'metadata' && (
<KBForm
initKbId={undefined}
onFormSubmit={onFormSubmit}
onFormCancel={onFormCancel}
onKbDeleted={onKbDeleted}
onNewKbCreated={onNewKbCreated}
onKbUpdated={onKbUpdated}
/>
@@ -184,9 +175,6 @@ export default function KBDetailDialog({
{activeMenu === 'metadata' && (
<KBForm
initKbId={kbId}
onFormSubmit={onFormSubmit}
onFormCancel={onFormCancel}
onKbDeleted={onKbDeleted}
onNewKbCreated={onNewKbCreated}
onKbUpdated={onKbUpdated}
/>

View File

@@ -66,7 +66,7 @@ export default function KBDoc({ kbId }: { kbId: string }) {
onUploadSuccess={handleUploadSuccess}
onUploadError={handleUploadError}
/>
<DataTable columns={columns(handleDelete)} data={documentsList} />
<DataTable columns={columns(handleDelete, t)} data={documentsList} />
</div>
);
}

View File

@@ -8,11 +8,10 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { useTranslation } from 'react-i18next';
import { Badge } from '@/components/ui/badge';
import { TFunction } from 'i18next';
export type DocumentFile = {
uuid: string;
@@ -22,8 +21,8 @@ export type DocumentFile = {
export const columns = (
onDelete: (id: string) => void,
t: TFunction,
): ColumnDef<DocumentFile>[] => {
const { t } = useTranslation();
return [
{
accessorKey: 'name',

View File

@@ -39,17 +39,10 @@ const getFormSchema = (t: (key: string) => string) =>
export default function KBForm({
initKbId,
onFormSubmit,
onFormCancel,
onKbDeleted,
onNewKbCreated,
onKbUpdated,
}: {
initKbId?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onFormSubmit: (value: any) => void;
onFormCancel: () => void;
onKbDeleted: () => void;
onNewKbCreated: (kbId: string) => void;
onKbUpdated: (kbId: string) => void;
}) {
@@ -84,7 +77,7 @@ export default function KBForm({
const getKbConfig = async (
kbId: string,
): Promise<z.infer<typeof formSchema>> => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
httpClient.getKnowledgeBase(kbId).then((res) => {
resolve({
name: res.base.name,

View File

@@ -62,11 +62,6 @@ export default function KnowledgePage() {
setDetailDialogOpen(true);
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleFormSubmit = (value: any) => {
console.log('handleFormSubmit', value);
};
const handleFormCancel = () => {
setDetailDialogOpen(false);
};
@@ -82,7 +77,7 @@ export default function KnowledgePage() {
setDetailDialogOpen(true);
};
const handleKbUpdated = (kbId: string) => {
const handleKbUpdated = () => {
getKnowledgeBaseList();
};
@@ -92,7 +87,6 @@ export default function KnowledgePage() {
open={detailDialogOpen}
onOpenChange={setDetailDialogOpen}
kbId={selectedKbId || undefined}
onFormSubmit={handleFormSubmit}
onFormCancel={handleFormCancel}
onKbDeleted={handleKbDeleted}
onNewKbCreated={handleNewKbCreated}