Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#2641 from Yidadaa/bugfix-0815
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Aug 15, 2023
2 parents ffddb7f + ed62c87 commit ada4e3c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
9 changes: 9 additions & 0 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import { useAccessStore } from "../store";
import Locale from "../locales";

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

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

const goHome = () => navigate(Path.Home);

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"]}`}>
Expand Down
6 changes: 3 additions & 3 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1123,9 +1123,9 @@ function _Chat() {
10,
);
chatStore.updateCurrentSession((session) => {
const m = session.messages.find(
(m) => m.id === message.id,
);
const m = session.mask.context
.concat(session.messages)
.find((m) => m.id === message.id);
if (m) {
m.content = newMessage;
}
Expand Down
8 changes: 6 additions & 2 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { getClientConfig } from "../config/client";
import { SubmitKey } from "../store/config";

const isApp = !!getClientConfig()?.isApp;

const cn = {
WIP: "该功能仍在开发中……",
Error: {
Unauthorized:
"访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
Unauthorized: isApp
? "检测到无效 API Key,请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
: "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
},
Auth: {
Title: "需要密码",
Expand Down
8 changes: 6 additions & 2 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { getClientConfig } from "../config/client";
import { SubmitKey } from "../store/config";
import { LocaleType } from "./index";

// if you are adding a new translation, please use PartialLocaleType instead of LocaleType

const isApp = !!getClientConfig()?.isApp;
const en: LocaleType = {
WIP: "Coming Soon...",
Error: {
Unauthorized:
"Unauthorized access, please enter access code in [auth](/#/auth) page.",
Unauthorized: isApp
? "Invalid API Key, please check it in [Settings](/#/settings) page."
: "Unauthorized access, please enter access code in [auth](/#/auth) page, or enter your OpenAI API Key.",
},
Auth: {
Title: "Need Access Code",
Expand Down

0 comments on commit ada4e3c

Please sign in to comment.