mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-20 19:36:08 +00:00
feat(fe): component for available apis
This commit is contained in:
@@ -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