diff --git a/app/components/auth.tsx b/app/components/auth.tsx index 9a5b0c655e61..b82d0e894c7c 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -15,7 +15,8 @@ export function AuthPage() { const access = useAccessStore(); const goHome = () => navigate(Path.Home); - const resetAccessCode = () => access.updateCode(""); // Reset access code to empty string + const goChat = () => navigate(Path.Chat); + const resetAccessCode = () => { access.updateCode(""); access.updateToken(""); }; // Reset access code to empty string useEffect(() => { if (getClientConfig()?.isApp) { @@ -42,17 +43,34 @@ export function AuthPage() { access.updateCode(e.currentTarget.value); }} /> + {!access.hideUserApiKey ? ( + <> + <div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div> + <input + className={styles["auth-input"]} + type="password" + placeholder={Locale.Settings.Token.Placeholder} + value={access.token} + onChange={(e) => { + access.updateToken(e.currentTarget.value); + }} + /> + </> + ) : null} <div className={styles["auth-actions"]}> <IconButton text={Locale.Auth.Confirm} type="primary" - onClick={goHome} + onClick={goChat} + /> + <IconButton + text={Locale.Auth.Later} + onClick={() => { + resetAccessCode(); + goHome(); + }} /> - <IconButton text={Locale.Auth.Later} onClick={() => { - resetAccessCode(); - goHome(); - }} /> </div> </div> ); diff --git a/app/locales/ar.ts b/app/locales/ar.ts index 520cb26356ee..d5844acd6951 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -10,6 +10,7 @@ const ar: PartialLocaleType = { Auth: { Title: "تحتاج إلى رمز الوصول", Tips: "يرجى إدخال رمز الوصول أدناه", + SubTips: "أو أدخل مفتاح واجهة برمجة تطبيقات OpenAI الخاص بك", Input: "رمز الوصول", Confirm: "تأكيد", Later: "لاحقًا", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index 2d2266b3f438..2db132cecc2e 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -10,6 +10,7 @@ const bn: PartialLocaleType = { Auth: { Title: "একটি অ্যাক্সেস কোড প্রয়োজন", Tips: "নীচে অ্যাক্সেস কোড ইনপুট করুন", + SubTips: "অথবা আপনার OpenAI API কী প্রবেশ করুন", Input: "অ্যাক্সেস কোড", Confirm: "নিশ্চিত করুন", Later: "পরে", diff --git a/app/locales/cn.ts b/app/locales/cn.ts index b2afc753457b..8eeef9e013c4 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -13,6 +13,7 @@ const cn = { Auth: { Title: "需要密码", Tips: "管理员开启了密码验证,请在下方填入访问码", + SubTips: "或者输入你的 OpenAI API 密钥", Input: "在此处填写访问码", Confirm: "确认", Later: "稍后再说", diff --git a/app/locales/en.ts b/app/locales/en.ts index 697d09d1f4e6..458d53dd568f 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -15,6 +15,7 @@ const en: LocaleType = { Auth: { Title: "Need Access Code", Tips: "Please enter access code below", + SubTips: "Or enter your OpenAI API Key", Input: "access code", Confirm: "Confirm", Later: "Later", diff --git a/app/locales/id.ts b/app/locales/id.ts index 244c5ade19a9..1036e66b64ef 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -4,12 +4,12 @@ import { PartialLocaleType } from "./index"; const id: PartialLocaleType = { WIP: "Coming Soon...", Error: { - Unauthorized: - "Akses tidak diizinkan. Silakan [otorisasi](/#/auth) dengan memasukkan kode akses.", - }, + Unauthorized: "Akses tidak diizinkan, silakan masukkan kode akses atau masukkan kunci API OpenAI Anda. di halaman [autentikasi](/#/auth) atau di halaman [Pengaturan](/#/settings).", + }, Auth: { Title: "Diperlukan Kode Akses", Tips: "Masukkan kode akses di bawah", + SubTips: "Atau masukkan kunci API OpenAI Anda", Input: "Kode Akses", Confirm: "Konfirmasi", Later: "Nanti",