feat: Improve SD list data and API integration

This commit is contained in:
licoy
2024-07-03 15:37:34 +08:00
parent 54401162bd
commit a16725ac17
14 changed files with 508 additions and 33 deletions

View File

@@ -1,7 +1,5 @@
"use client";
import { Sd } from "@/app/components/sd";
require("../polyfill");
import { useState, useEffect } from "react";
@@ -32,6 +30,7 @@ import { getClientConfig } from "../config/client";
import { ClientApi } from "../client/api";
import { useAccessStore } from "../store";
import { identifyDefaultClaudeModel } from "../utils/checkers";
import { initDB } from "react-indexed-db-hook";
export function Loading(props: { noLogo?: boolean }) {
return (
@@ -58,6 +57,14 @@ const MaskPage = dynamic(async () => (await import("./mask")).MaskPage, {
loading: () => <Loading noLogo />,
});
const Sd = dynamic(async () => (await import("./sd")).Sd, {
loading: () => <Loading noLogo />,
});
const SdPanel = dynamic(async () => (await import("./sd-panel")).SdPanel, {
loading: () => <Loading noLogo />,
});
export function useSwitchTheme() {
const config = useAppConfig();
@@ -128,7 +135,8 @@ const loadAsyncGoogleFont = () => {
function Screen() {
const config = useAppConfig();
const location = useLocation();
const isHome = location.pathname === Path.Home;
const isHome =
location.pathname === Path.Home || location.pathname === Path.SdPanel;
const isAuth = location.pathname === Path.Auth;
const isMobileScreen = useMobileScreen();
const shouldTightBorder =
@@ -137,7 +145,6 @@ function Screen() {
useEffect(() => {
loadAsyncGoogleFont();
}, []);
return (
<div
className={
@@ -154,7 +161,6 @@ function Screen() {
) : (
<>
<SideBar className={isHome ? styles["sidebar-show"] : ""} />
<div className={styles["window-content"]} id={SlotID.AppBody}>
<Routes>
<Route path={Path.Home} element={<Chat />} />
@@ -162,6 +168,7 @@ function Screen() {
<Route path={Path.Masks} element={<MaskPage />} />
<Route path={Path.Chat} element={<Chat />} />
<Route path={Path.Sd} element={<Sd />} />
<Route path={Path.SdPanel} element={<Sd />} />
<Route path={Path.Settings} element={<Settings />} />
</Routes>
</div>
@@ -173,7 +180,6 @@ function Screen() {
export function useLoadData() {
const config = useAppConfig();
var api: ClientApi;
if (config.modelConfig.model.startsWith("gemini")) {
api = new ClientApi(ModelProvider.GeminiPro);