forked from XiaoMo/ChatGPT-Next-Web
no message
This commit is contained in:
parent
e756506c18
commit
7eff84bf0b
@ -517,19 +517,23 @@ export function ChatActions(props: {
|
||||
}
|
||||
/>
|
||||
|
||||
<ChatAction
|
||||
onClick={props.showPromptHints}
|
||||
text={Locale.Chat.InputActions.Prompt}
|
||||
icon={<PromptIcon />}
|
||||
/>
|
||||
{useAccessStore().openaiApiKey && (
|
||||
<ChatAction
|
||||
onClick={props.showPromptHints}
|
||||
text={Locale.Chat.InputActions.Prompt}
|
||||
icon={<PromptIcon />}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ChatAction
|
||||
onClick={() => {
|
||||
navigate(Path.Masks);
|
||||
}}
|
||||
text={Locale.Chat.InputActions.Masks}
|
||||
icon={<MaskIcon />}
|
||||
/>
|
||||
{useAccessStore().openaiApiKey && (
|
||||
<ChatAction
|
||||
onClick={() => {
|
||||
navigate(Path.Masks);
|
||||
}}
|
||||
text={Locale.Chat.InputActions.Masks}
|
||||
icon={<MaskIcon />}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ChatAction
|
||||
text={Locale.Chat.InputActions.Clear}
|
||||
@ -732,6 +736,11 @@ function _Chat() {
|
||||
};
|
||||
|
||||
const doSubmit = (userInput: string) => {
|
||||
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() {
|
||||
)}
|
||||
<IconButton
|
||||
icon={<SendWhiteIcon />}
|
||||
text={Locale.Chat.Send}
|
||||
text={accessStore.openaiApiKey ? Locale.Chat.Send : "登录"}
|
||||
className={styles["chat-input-send"]}
|
||||
type="primary"
|
||||
onClick={() => doSubmit(userInput)}
|
||||
|
@ -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 }) {
|
||||
>
|
||||
<div className={styles["sidebar-header"]} data-tauri-drag-region>
|
||||
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
||||
NextChat
|
||||
GterIng.Com
|
||||
</div>
|
||||
<div className={styles["sidebar-sub-title"]}>
|
||||
{/* <div className={styles["sidebar-sub-title"]}>
|
||||
Build your own AI assistant.
|
||||
</div>
|
||||
</div> */}
|
||||
<div className={styles["sidebar-logo"] + " no-dark"}>
|
||||
<ChatGptIcon />
|
||||
</div>
|
||||
@ -216,17 +217,25 @@ export function SideBar(props: { className?: string }) {
|
||||
<IconButton icon={<SettingsIcon />} shadow />
|
||||
</Link>
|
||||
</div>
|
||||
<div className={styles["sidebar-action"]}>
|
||||
{/* <div className={styles["sidebar-action"]}>
|
||||
<a href={REPO_URL} target="_blank" rel="noopener noreferrer">
|
||||
<IconButton icon={<GithubIcon />} shadow />
|
||||
</a>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
<div>
|
||||
<IconButton
|
||||
icon={<AddIcon />}
|
||||
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);
|
||||
|
@ -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: "需要密码",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NextChat",
|
||||
"short_name": "NextChat",
|
||||
"name": "魂牵梦萦 fdafa",
|
||||
"short_name": "魂牵梦萦 fdafa",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
|
Loading…
Reference in New Issue
Block a user