import styles from "./auth.module.scss"; import { IconButton } from "./button"; import { useNavigate } from "react-router-dom"; import { Path, SAAS_CHAT_URL } 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 LeftIcon from "@/app/icons/left.svg"; export function AuthPage() { const navigate = useNavigate(); const accessStore = useAccessStore(); const goHome = () => navigate(Path.Home); const goChat = () => navigate(Path.Chat); const goSaas = () => { window.location.href = SAAS_CHAT_URL; }; 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 }, []); return (
} text={Locale.Auth.Return} onClick={() => navigate(Path.Home)} >
{Locale.Auth.Title}
{Locale.Auth.Tips}
{ accessStore.update( (access) => (access.accessCode = e.currentTarget.value), ); }} /> {!accessStore.hideUserApiKey ? ( <>
{Locale.Auth.SubTips}
{ accessStore.update( (access) => (access.openaiApiKey = e.currentTarget.value), ); }} /> { accessStore.update( (access) => (access.googleApiKey = e.currentTarget.value), ); }} /> ) : null}
{ goSaas(); }} />
); }