mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-29 05:37:14 +00:00
feat(fe): component for available apis
This commit is contained in:
@@ -212,6 +212,7 @@ export default function BotForm({
|
|||||||
});
|
});
|
||||||
setAdapterNameToDynamicConfigMap(adapterNameToDynamicConfigMap);
|
setAdapterNameToDynamicConfigMap(adapterNameToDynamicConfigMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBotConfig(
|
async function getBotConfig(
|
||||||
botId: string,
|
botId: string,
|
||||||
): Promise<z.infer<typeof formSchema>> {
|
): Promise<z.infer<typeof formSchema>> {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ 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';
|
||||||
|
import KBDoc from '@/app/home/knowledge/components/kb-docs/KBDoc';
|
||||||
|
|
||||||
interface KBDetailDialogProps {
|
interface KBDetailDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -48,6 +49,7 @@ 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(() => {
|
||||||
@@ -177,7 +179,7 @@ export default function KBDetailDialog({
|
|||||||
onNewKbCreated={onNewKbCreated}
|
onNewKbCreated={onNewKbCreated}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{activeMenu === 'documents' && <div>documents</div>}
|
{activeMenu === 'documents' && <KBDoc kbId={kbId} />}
|
||||||
</div>
|
</div>
|
||||||
{activeMenu === 'metadata' && (
|
{activeMenu === 'metadata' && (
|
||||||
<DialogFooter className="px-6 py-4 border-t shrink-0">
|
<DialogFooter className="px-6 py-4 border-t shrink-0">
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
export default function KBDoc({ kbId }: { kbId: string }) {
|
||||||
|
return <div>Documents</div>;
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export default function DocumentCard({
|
||||||
|
kbId,
|
||||||
|
fileId,
|
||||||
|
}: {
|
||||||
|
kbId: string;
|
||||||
|
fileId: string;
|
||||||
|
}) {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
@@ -67,9 +67,31 @@ export default function KBForm({
|
|||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getEmbeddingModelNameList();
|
getEmbeddingModelNameList().then(() => {
|
||||||
|
if (initKbId) {
|
||||||
|
getKbConfig(initKbId).then((val) => {
|
||||||
|
form.setValue('name', val.name);
|
||||||
|
form.setValue('description', val.description);
|
||||||
|
form.setValue('embeddingModelUUID', val.embeddingModelUUID);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const getKbConfig = async (
|
||||||
|
kbId: string,
|
||||||
|
): Promise<z.infer<typeof formSchema>> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
httpClient.getKnowledgeBase(kbId).then((res) => {
|
||||||
|
resolve({
|
||||||
|
name: res.base.name,
|
||||||
|
description: res.base.description,
|
||||||
|
embeddingModelUUID: res.base.embedding_model_uuid,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const getEmbeddingModelNameList = async () => {
|
const getEmbeddingModelNameList = async () => {
|
||||||
const resp = await httpClient.getProviderEmbeddingModels();
|
const resp = await httpClient.getProviderEmbeddingModels();
|
||||||
setEmbeddingModelNameList(
|
setEmbeddingModelNameList(
|
||||||
|
|||||||
Reference in New Issue
Block a user