feat: close #2192 use /list/models to get model ids

This commit is contained in:
Yidadaa
2023-07-04 23:16:24 +08:00
parent f2d748cfe4
commit 4131fccbe0
12 changed files with 214 additions and 121 deletions

View File

@@ -27,6 +27,7 @@ import { SideBar } from "./sidebar";
import { useAppConfig } from "../store/config";
import { AuthPage } from "./auth";
import { getClientConfig } from "../config/client";
import { api } from "../client/api";
export function Loading(props: { noLogo?: boolean }) {
return (
@@ -152,8 +153,21 @@ function Screen() {
);
}
export function useLoadData() {
const config = useAppConfig();
useEffect(() => {
(async () => {
const models = await api.llm.models();
config.mergeModels(models);
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}
export function Home() {
useSwitchTheme();
useLoadData();
useEffect(() => {
console.log("[Config] got config from build time", getClientConfig());