Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

合并 #5187

Closed
wants to merge 8 commits into from
Closed

合并 #5187

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<img src="./docs/images/icon.svg" alt="预览"/>

<h1 align="center">NextChat</h1>
<h1 align="center">BuouChat</h1>

一键免费部署你的私人 ChatGPT 网页应用,支持 GPT3, GPT4 & Gemini Pro 模型。

Expand Down
60 changes: 30 additions & 30 deletions app/components/auth.module.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
.auth-page {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
flex-direction: column;
// .auth-page {
// display: flex;
// justify-content: center;
// align-items: center;
// height: 100%;
// width: 100%;
// flex-direction: column;

.auth-logo {
transform: scale(1.4);
}
// .auth-logo {
// transform: scale(1.4);
// }

.auth-title {
font-size: 24px;
font-weight: bold;
line-height: 2;
}
// .auth-title {
// font-size: 24px;
// font-weight: bold;
// line-height: 2;
// }

.auth-tips {
font-size: 14px;
}
// .auth-tips {
// font-size: 14px;
// }

.auth-input {
margin: 3vh 0;
}
// .auth-input {
// margin: 3vh 0;
// }

.auth-actions {
display: flex;
justify-content: center;
flex-direction: column;
// .auth-actions {
// display: flex;
// justify-content: center;
// flex-direction: column;

button:not(:last-child) {
margin-bottom: 10px;
}
}
}
// button:not(:last-child) {
// margin-bottom: 10px;
// }
// }
// }
176 changes: 88 additions & 88 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,97 +1,97 @@
import styles from "./auth.module.scss";
import { IconButton } from "./button";
// import styles from "./auth.module.scss";
// import { IconButton } from "./button";

import { useNavigate } from "react-router-dom";
import { Path } from "../constant";
import { useAccessStore } from "../store";
import Locale from "../locales";
// import { useNavigate } from "react-router-dom";
// import { Path } from "../constant";
// import { useAccessStore } from "../store";
// import Locale from "../locales";

import BotIcon from "../icons/bot.svg";
import { useEffect } from "react";
import { getClientConfig } from "../config/client";
// import BotIcon from "../icons/bot.svg";
// import { useEffect } from "react";
// import { getClientConfig } from "../config/client";

export function AuthPage() {
const navigate = useNavigate();
const accessStore = useAccessStore();
// export function AuthPage() {
// const navigate = useNavigate();
// const accessStore = useAccessStore();

const goHome = () => navigate(Path.Home);
const goChat = () => navigate(Path.Chat);
const resetAccessCode = () => {
accessStore.update((access) => {
access.openaiApiKey = "";
access.accessCode = "";
});
}; // Reset access code to empty string
// const goHome = () => navigate(Path.Home);
// const goChat = () => navigate(Path.Chat);
// const resetAccessCode = () => {
// accessStore.update((access) => {
// access.openaiApiKey = "";
// access.accessCode = "";
// });
// }; // Reset access code to empty string

useEffect(() => {
if (getClientConfig()?.isApp) {
navigate(Path.Settings);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// useEffect(() => {
// if (getClientConfig()?.isApp) {
// navigate(Path.Settings);
// }
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, []);

return (
<div className={styles["auth-page"]}>
<div className={`no-dark ${styles["auth-logo"]}`}>
<BotIcon />
</div>
// return (
// <div className={styles["auth-page"]}>
// <div className={`no-dark ${styles["auth-logo"]}`}>
// <BotIcon />
// </div>

<div className={styles["auth-title"]}>{Locale.Auth.Title}</div>
<div className={styles["auth-tips"]}>{Locale.Auth.Tips}</div>
// <div className={styles["auth-title"]}>{Locale.Auth.Title}</div>
// <div className={styles["auth-tips"]}>{Locale.Auth.Tips}</div>

<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Auth.Input}
value={accessStore.accessCode}
onChange={(e) => {
accessStore.update(
(access) => (access.accessCode = e.currentTarget.value),
);
}}
/>
{!accessStore.hideUserApiKey ? (
<>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Access.OpenAI.ApiKey.Placeholder}
value={accessStore.openaiApiKey}
onChange={(e) => {
accessStore.update(
(access) => (access.openaiApiKey = e.currentTarget.value),
);
}}
/>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Access.Google.ApiKey.Placeholder}
value={accessStore.googleApiKey}
onChange={(e) => {
accessStore.update(
(access) => (access.googleApiKey = e.currentTarget.value),
);
}}
/>
</>
) : null}
// <input
// className={styles["auth-input"]}
// type="password"
// placeholder={Locale.Auth.Input}
// value={accessStore.accessCode}
// onChange={(e) => {
// accessStore.update(
// (access) => (access.accessCode = e.currentTarget.value),
// );
// }}
// />
// {!accessStore.hideUserApiKey ? (
// <>
// <div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
// <input
// className={styles["auth-input"]}
// type="password"
// placeholder={Locale.Settings.Access.OpenAI.ApiKey.Placeholder}
// value={accessStore.openaiApiKey}
// onChange={(e) => {
// accessStore.update(
// (access) => (access.openaiApiKey = e.currentTarget.value),
// );
// }}
// />
// <input
// className={styles["auth-input"]}
// type="password"
// placeholder={Locale.Settings.Access.Google.ApiKey.Placeholder}
// value={accessStore.googleApiKey}
// onChange={(e) => {
// accessStore.update(
// (access) => (access.googleApiKey = e.currentTarget.value),
// );
// }}
// />
// </>
// ) : null}

<div className={styles["auth-actions"]}>
<IconButton
text={Locale.Auth.Confirm}
type="primary"
onClick={goChat}
/>
<IconButton
text={Locale.Auth.Later}
onClick={() => {
resetAccessCode();
goHome();
}}
/>
</div>
</div>
);
}
// <div className={styles["auth-actions"]}>
// <IconButton
// text={Locale.Auth.Confirm}
// type="primary"
// onClick={goChat}
// />
// <IconButton
// text={Locale.Auth.Later}
// onClick={() => {
// resetAccessCode();
// goHome();
// }}
// />
// </div>
// </div>
// );
// }
2 changes: 1 addition & 1 deletion app/components/exporter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ export function ImagePreviewer(props: {
</div>

<div>
<div className={styles["main-title"]}>NextChat</div>
<div className={styles["main-title"]}>BuouChat</div>
<div className={styles["sub-title"]}>
github.com/Yidadaa/ChatGPT-Next-Web
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/components/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "react-router-dom";
import { SideBar } from "./sidebar";
import { useAppConfig } from "../store/config";
import { AuthPage } from "./auth";
import { AuthPage } from "./login";
import { getClientConfig } from "../config/client";
import { type ClientApi, getClientApi } from "../client/api";
import { useAccessStore } from "../store";
Expand Down Expand Up @@ -126,7 +126,7 @@ function Screen() {
const config = useAppConfig();
const location = useLocation();
const isHome = location.pathname === Path.Home;
const isAuth = location.pathname === Path.Auth;
const isAuth = location.pathname === Path.Login;
const isMobileScreen = useMobileScreen();
const shouldTightBorder =
getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen);
Expand Down
36 changes: 36 additions & 0 deletions app/components/login.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.auth-page {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
flex-direction: column;

.auth-logo {
transform: scale(1.4);
}

.auth-title {
font-size: 24px;
font-weight: bold;
line-height: 2;
}

.auth-tips {
font-size: 14px;
}

.auth-input {
margin: 1vh 0;
}

.auth-actions {
display: flex;
justify-content: center;
flex-direction: column;

button:not(:last-child) {
margin-bottom: 10px;
}
}
}
Loading
Loading