mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 11:29:39 +08:00
feat(fe): component for available apis
This commit is contained in:
@@ -212,6 +212,7 @@ export default function BotForm({
|
||||
});
|
||||
setAdapterNameToDynamicConfigMap(adapterNameToDynamicConfigMap);
|
||||
}
|
||||
|
||||
async function getBotConfig(
|
||||
botId: string,
|
||||
): Promise<z.infer<typeof formSchema>> {
|
||||
|
||||
@@ -24,6 +24,7 @@ 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';
|
||||
import KBDoc from '@/app/home/knowledge/components/kb-docs/KBDoc';
|
||||
|
||||
interface KBDetailDialogProps {
|
||||
open: boolean;
|
||||
@@ -48,6 +49,7 @@ 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(() => {
|
||||
@@ -177,7 +179,7 @@ export default function KBDetailDialog({
|
||||
onNewKbCreated={onNewKbCreated}
|
||||
/>
|
||||
)}
|
||||
{activeMenu === 'documents' && <div>documents</div>}
|
||||
{activeMenu === 'documents' && <KBDoc kbId={kbId} />}
|
||||
</div>
|
||||
{activeMenu === 'metadata' && (
|
||||
<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(() => {
|
||||
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 resp = await httpClient.getProviderEmbeddingModels();
|
||||
setEmbeddingModelNameList(
|
||||
|
||||
Reference in New Issue
Block a user