feat: Optimize MCP configuration logic

This commit is contained in:
Kadxy
2025-01-15 16:52:54 +08:00
parent ce13cf61a7
commit 8aa9a500fd
14 changed files with 766 additions and 653 deletions

View File

@@ -29,6 +29,8 @@ import { getClientConfig } from "../config/client";
import { type ClientApi, getClientApi } from "../client/api";
import { useAccessStore } from "../store";
import clsx from "clsx";
import { initializeMcpSystem } from "../mcp/actions";
import { showToast } from "./ui-lib";
export function Loading(props: { noLogo?: boolean }) {
return (
@@ -243,6 +245,14 @@ export function Home() {
useAccessStore.getState().fetch();
}, []);
useEffect(() => {
// 初始化 MCP 系统
initializeMcpSystem().catch((error) => {
console.error("Failed to initialize MCP system:", error);
showToast("Failed to initialize MCP system");
});
}, []);
if (!useHasHydrated()) {
return <Loading />;
}