feat: #1000 ready to support client-side only

This commit is contained in:
Yidadaa
2023-06-14 00:37:42 +08:00
parent e6b49a60c0
commit 50cd33dbb2
13 changed files with 133 additions and 36 deletions

View File

@@ -24,6 +24,7 @@ import {
import { SideBar } from "./sidebar";
import { useAppConfig } from "../store/config";
import { AuthPage } from "./auth";
import { getClientConfig } from "../config/client";
export function Loading(props: { noLogo?: boolean }) {
return (
@@ -147,6 +148,10 @@ function Screen() {
export function Home() {
useSwitchTheme();
useEffect(() => {
console.log("[Config] got config from build time", getClientConfig());
}, []);
if (!useHasHydrated()) {
return <Loading />;
}

View File

@@ -1,4 +1,4 @@
import { useState, useEffect, useMemo, HTMLProps, useRef } from "react";
import { useState, useEffect, useMemo } from "react";
import styles from "./settings.module.scss";
@@ -45,6 +45,7 @@ import { ErrorBoundary } from "./error";
import { InputRange } from "./input-range";
import { useNavigate } from "react-router-dom";
import { Avatar, AvatarPicker } from "./emoji";
import { getClientConfig } from "../config/client";
function EditPromptModal(props: { id: number; onClose: () => void }) {
const promptStore = usePromptStore();
@@ -541,6 +542,21 @@ export function Settings() {
/>
)}
</ListItem>
{!accessStore.hideUserApiKey ? (
<ListItem
title={Locale.Settings.Endpoint.Title}
subTitle={Locale.Settings.Endpoint.SubTitle}
>
<input
type="text"
value={accessStore.openaiUrl}
onChange={(e) =>
accessStore.updateOpenAiUrl(e.currentTarget.value)
}
></input>
</ListItem>
) : null}
</List>
<List>