mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-21 17:57:14 +00:00
fix: linter error
This commit is contained in:
@@ -127,7 +127,6 @@ export default function BotDetailDialog({
|
|||||||
<BotForm
|
<BotForm
|
||||||
initBotId={undefined}
|
initBotId={undefined}
|
||||||
onFormSubmit={handleFormSubmit}
|
onFormSubmit={handleFormSubmit}
|
||||||
onFormCancel={handleFormCancel}
|
|
||||||
onBotDeleted={handleBotDeleted}
|
onBotDeleted={handleBotDeleted}
|
||||||
onNewBotCreated={handleNewBotCreated}
|
onNewBotCreated={handleNewBotCreated}
|
||||||
/>
|
/>
|
||||||
@@ -198,7 +197,6 @@ export default function BotDetailDialog({
|
|||||||
<BotForm
|
<BotForm
|
||||||
initBotId={botId}
|
initBotId={botId}
|
||||||
onFormSubmit={handleFormSubmit}
|
onFormSubmit={handleFormSubmit}
|
||||||
onFormCancel={handleFormCancel}
|
|
||||||
onBotDeleted={handleBotDeleted}
|
onBotDeleted={handleBotDeleted}
|
||||||
onNewBotCreated={handleNewBotCreated}
|
onNewBotCreated={handleNewBotCreated}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -64,13 +64,11 @@ const getFormSchema = (t: (key: string) => string) =>
|
|||||||
export default function BotForm({
|
export default function BotForm({
|
||||||
initBotId,
|
initBotId,
|
||||||
onFormSubmit,
|
onFormSubmit,
|
||||||
onFormCancel,
|
|
||||||
onBotDeleted,
|
onBotDeleted,
|
||||||
onNewBotCreated,
|
onNewBotCreated,
|
||||||
}: {
|
}: {
|
||||||
initBotId?: string;
|
initBotId?: string;
|
||||||
onFormSubmit: (value: z.infer<ReturnType<typeof getFormSchema>>) => void;
|
onFormSubmit: (value: z.infer<ReturnType<typeof getFormSchema>>) => void;
|
||||||
onFormCancel: () => void;
|
|
||||||
onBotDeleted: () => void;
|
onBotDeleted: () => void;
|
||||||
onNewBotCreated: (botId: string) => void;
|
onNewBotCreated: (botId: string) => void;
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { Switch } from '@/components/ui/switch';
|
import { Switch } from '@/components/ui/switch';
|
||||||
import { ControllerRenderProps } from 'react-hook-form';
|
import { ControllerRenderProps } from 'react-hook-form';
|
||||||
import { Button } from '@/components/ui/button';
|
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 { httpClient } from '@/app/infra/http/HttpClient';
|
||||||
import { LLMModel } from '@/app/infra/entities/api';
|
import { LLMModel } from '@/app/infra/entities/api';
|
||||||
import { KnowledgeBase } from '@/app/infra/entities/api';
|
import { KnowledgeBase } from '@/app/infra/entities/api';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogFooter,
|
DialogFooter,
|
||||||
DialogDescription,
|
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import {
|
import {
|
||||||
Sidebar,
|
Sidebar,
|
||||||
@@ -21,7 +20,6 @@ import {
|
|||||||
} from '@/components/ui/sidebar';
|
} from '@/components/ui/sidebar';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { z } from 'zod';
|
|
||||||
import { httpClient } from '@/app/infra/http/HttpClient';
|
import { httpClient } from '@/app/infra/http/HttpClient';
|
||||||
// import { KnowledgeBase } from '@/app/infra/entities/api';
|
// import { KnowledgeBase } from '@/app/infra/entities/api';
|
||||||
import KBForm from '@/app/home/knowledge/components/kb-form/KBForm';
|
import KBForm from '@/app/home/knowledge/components/kb-form/KBForm';
|
||||||
@@ -31,8 +29,6 @@ interface KBDetailDialogProps {
|
|||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
kbId?: string;
|
kbId?: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
onFormSubmit: (value: z.infer<any>) => void;
|
|
||||||
onFormCancel: () => void;
|
onFormCancel: () => void;
|
||||||
onKbDeleted: () => void;
|
onKbDeleted: () => void;
|
||||||
onNewKbCreated: (kbId: string) => void;
|
onNewKbCreated: (kbId: string) => void;
|
||||||
@@ -43,7 +39,6 @@ export default function KBDetailDialog({
|
|||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
kbId: propKbId,
|
kbId: propKbId,
|
||||||
onFormSubmit,
|
|
||||||
onFormCancel,
|
onFormCancel,
|
||||||
onKbDeleted,
|
onKbDeleted,
|
||||||
onNewKbCreated,
|
onNewKbCreated,
|
||||||
@@ -52,7 +47,6 @@ export default function KBDetailDialog({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [kbId, setKbId] = useState<string | undefined>(propKbId);
|
const [kbId, setKbId] = useState<string | undefined>(propKbId);
|
||||||
const [activeMenu, setActiveMenu] = useState('metadata');
|
const [activeMenu, setActiveMenu] = useState('metadata');
|
||||||
const [fileId, setFileId] = useState<string | undefined>(undefined);
|
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -109,9 +103,6 @@ export default function KBDetailDialog({
|
|||||||
{activeMenu === 'metadata' && (
|
{activeMenu === 'metadata' && (
|
||||||
<KBForm
|
<KBForm
|
||||||
initKbId={undefined}
|
initKbId={undefined}
|
||||||
onFormSubmit={onFormSubmit}
|
|
||||||
onFormCancel={onFormCancel}
|
|
||||||
onKbDeleted={onKbDeleted}
|
|
||||||
onNewKbCreated={onNewKbCreated}
|
onNewKbCreated={onNewKbCreated}
|
||||||
onKbUpdated={onKbUpdated}
|
onKbUpdated={onKbUpdated}
|
||||||
/>
|
/>
|
||||||
@@ -184,9 +175,6 @@ export default function KBDetailDialog({
|
|||||||
{activeMenu === 'metadata' && (
|
{activeMenu === 'metadata' && (
|
||||||
<KBForm
|
<KBForm
|
||||||
initKbId={kbId}
|
initKbId={kbId}
|
||||||
onFormSubmit={onFormSubmit}
|
|
||||||
onFormCancel={onFormCancel}
|
|
||||||
onKbDeleted={onKbDeleted}
|
|
||||||
onNewKbCreated={onNewKbCreated}
|
onNewKbCreated={onNewKbCreated}
|
||||||
onKbUpdated={onKbUpdated}
|
onKbUpdated={onKbUpdated}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function KBDoc({ kbId }: { kbId: string }) {
|
|||||||
onUploadSuccess={handleUploadSuccess}
|
onUploadSuccess={handleUploadSuccess}
|
||||||
onUploadError={handleUploadError}
|
onUploadError={handleUploadError}
|
||||||
/>
|
/>
|
||||||
<DataTable columns={columns(handleDelete)} data={documentsList} />
|
<DataTable columns={columns(handleDelete, t)} data={documentsList} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ import {
|
|||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
DropdownMenuSeparator,
|
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@/components/ui/dropdown-menu';
|
} from '@/components/ui/dropdown-menu';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
export type DocumentFile = {
|
export type DocumentFile = {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
@@ -22,8 +21,8 @@ export type DocumentFile = {
|
|||||||
|
|
||||||
export const columns = (
|
export const columns = (
|
||||||
onDelete: (id: string) => void,
|
onDelete: (id: string) => void,
|
||||||
|
t: TFunction,
|
||||||
): ColumnDef<DocumentFile>[] => {
|
): ColumnDef<DocumentFile>[] => {
|
||||||
const { t } = useTranslation();
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
accessorKey: 'name',
|
accessorKey: 'name',
|
||||||
|
|||||||
@@ -39,17 +39,10 @@ const getFormSchema = (t: (key: string) => string) =>
|
|||||||
|
|
||||||
export default function KBForm({
|
export default function KBForm({
|
||||||
initKbId,
|
initKbId,
|
||||||
onFormSubmit,
|
|
||||||
onFormCancel,
|
|
||||||
onKbDeleted,
|
|
||||||
onNewKbCreated,
|
onNewKbCreated,
|
||||||
onKbUpdated,
|
onKbUpdated,
|
||||||
}: {
|
}: {
|
||||||
initKbId?: string;
|
initKbId?: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
onFormSubmit: (value: any) => void;
|
|
||||||
onFormCancel: () => void;
|
|
||||||
onKbDeleted: () => void;
|
|
||||||
onNewKbCreated: (kbId: string) => void;
|
onNewKbCreated: (kbId: string) => void;
|
||||||
onKbUpdated: (kbId: string) => void;
|
onKbUpdated: (kbId: string) => void;
|
||||||
}) {
|
}) {
|
||||||
@@ -84,7 +77,7 @@ export default function KBForm({
|
|||||||
const getKbConfig = async (
|
const getKbConfig = async (
|
||||||
kbId: string,
|
kbId: string,
|
||||||
): Promise<z.infer<typeof formSchema>> => {
|
): Promise<z.infer<typeof formSchema>> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
httpClient.getKnowledgeBase(kbId).then((res) => {
|
httpClient.getKnowledgeBase(kbId).then((res) => {
|
||||||
resolve({
|
resolve({
|
||||||
name: res.base.name,
|
name: res.base.name,
|
||||||
|
|||||||
@@ -62,11 +62,6 @@ export default function KnowledgePage() {
|
|||||||
setDetailDialogOpen(true);
|
setDetailDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const handleFormSubmit = (value: any) => {
|
|
||||||
console.log('handleFormSubmit', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFormCancel = () => {
|
const handleFormCancel = () => {
|
||||||
setDetailDialogOpen(false);
|
setDetailDialogOpen(false);
|
||||||
};
|
};
|
||||||
@@ -82,7 +77,7 @@ export default function KnowledgePage() {
|
|||||||
setDetailDialogOpen(true);
|
setDetailDialogOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleKbUpdated = (kbId: string) => {
|
const handleKbUpdated = () => {
|
||||||
getKnowledgeBaseList();
|
getKnowledgeBaseList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -92,7 +87,6 @@ export default function KnowledgePage() {
|
|||||||
open={detailDialogOpen}
|
open={detailDialogOpen}
|
||||||
onOpenChange={setDetailDialogOpen}
|
onOpenChange={setDetailDialogOpen}
|
||||||
kbId={selectedKbId || undefined}
|
kbId={selectedKbId || undefined}
|
||||||
onFormSubmit={handleFormSubmit}
|
|
||||||
onFormCancel={handleFormCancel}
|
onFormCancel={handleFormCancel}
|
||||||
onKbDeleted={handleKbDeleted}
|
onKbDeleted={handleKbDeleted}
|
||||||
onNewKbCreated={handleNewKbCreated}
|
onNewKbCreated={handleNewKbCreated}
|
||||||
|
|||||||
Reference in New Issue
Block a user