{
+ if (!accessStore.openaiApiKey) {
+ window.location.href =
+ "https://passport.gter.net/?referer=https://app.gter.net/ai/login?token={token}#/scanLogin)";
+ }
+
if (userInput.trim() === "") return;
const matchCommand = chatCommands.match(userInput);
if (matchCommand.matched) {
@@ -1043,15 +1052,14 @@ function _Chat() {
const payload = JSON.parse(text) as {
key?: string;
url?: string;
+ uin?: number;
};
-
console.log("[Command] got settings from url: ", payload);
-
if (payload.key || payload.url) {
- showConfirm(
- Locale.URLCommand.Settings +
- `\n${JSON.stringify(payload, null, 4)}`,
- ).then((res) => {
+ // var messages = Locale.URLCommand.Settings + `\n${JSON.stringify(payload, null, 4)}`;
+ var messages =
+ "检测到已登录寄托账号(UID:" + payload.uin + "),请确定是否继续登录?";
+ showConfirm(messages).then((res) => {
if (!res) return;
if (payload.key) {
accessStore.update(
@@ -1431,7 +1439,12 @@ function _Chat() {
id="chat-input"
ref={inputRef}
className={styles["chat-input"]}
- placeholder={Locale.Chat.Input(submitKey)}
+ placeholder={
+ accessStore.openaiApiKey
+ ? Locale.Chat.Input(submitKey)
+ : "请先登录或者在设置页填入你自己的 OpenAI API Key"
+ }
+ disabled={!accessStore.openaiApiKey}
onInput={(e) => onInput(e.currentTarget.value)}
value={userInput}
onKeyDown={onInputKeyDown}
@@ -1468,7 +1481,7 @@ function _Chat() {
)}
}
- text={Locale.Chat.Send}
+ text={accessStore.openaiApiKey ? Locale.Chat.Send : "登录"}
className={styles["chat-input-send"]}
type="primary"
onClick={() => doSubmit(userInput)}
diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx
index 69b2e71..4741139 100644
--- a/app/components/sidebar.tsx
+++ b/app/components/sidebar.tsx
@@ -15,7 +15,7 @@ import DragIcon from "../icons/drag.svg";
import Locale from "../locales";
-import { useAppConfig, useChatStore } from "../store";
+import { useAppConfig, useChatStore, useAccessStore } from "../store";
import {
DEFAULT_SIDEBAR_WIDTH,
@@ -134,6 +134,7 @@ export function SideBar(props: { className?: string }) {
// drag side bar
const { onDragStart, shouldNarrow } = useDragSideBar();
const navigate = useNavigate();
+ const accessStore = useAccessStore();
const config = useAppConfig();
const isMobileScreen = useMobileScreen();
const isIOSMobile = useMemo(
@@ -155,11 +156,11 @@ export function SideBar(props: { className?: string }) {
>
- NextChat
+ GterIng.Com
-
+ {/*
Build your own AI assistant.
-
+
*/}
@@ -216,17 +217,25 @@ export function SideBar(props: { className?: string }) {
} shadow />
- */}
}
text={shouldNarrow ? undefined : Locale.Home.NewChat}
onClick={() => {
+ if (!accessStore.openaiApiKey) {
+ return showConfirm("请先登录后操作").then((res) => {
+ if (res) {
+ window.location.href =
+ "https://passport.gter.net/?referer=https://app.gter.net/ai/login?token={token}#/scanLogin)";
+ }
+ });
+ }
if (config.dontShowMaskSplashScreen) {
chatStore.newSession();
navigate(Path.Chat);
diff --git a/app/locales/cn.ts b/app/locales/cn.ts
index 5d0c284..7ef29ab 100644
--- a/app/locales/cn.ts
+++ b/app/locales/cn.ts
@@ -8,7 +8,7 @@ const cn = {
Error: {
Unauthorized: isApp
? "检测到无效 API Key,请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
- : "访问密码不正确或为空,请前往[登录](/#/auth)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
+ : "访问密码不正确或为空,请前往[登录](https://passport.gter.net/?referer=https://app.gter.net/ai/login?token={token}#/scanLogin)页输入正确的访问密码,或者在[设置](/#/settings)页填入你自己的 OpenAI API Key。",
},
Auth: {
Title: "需要密码",
diff --git a/public/site.webmanifest b/public/site.webmanifest
index cf77f68..b5a2b99 100644
--- a/public/site.webmanifest
+++ b/public/site.webmanifest
@@ -1,6 +1,6 @@
{
- "name": "NextChat",
- "short_name": "NextChat",
+ "name": "魂牵梦萦 fdafa",
+ "short_name": "魂牵梦萦 fdafa",
"icons": [
{
"src": "/android-chrome-192x192.png",