no message
This commit is contained in:
parent
e756506c18
commit
7eff84bf0b
@ -517,19 +517,23 @@ export function ChatActions(props: {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ChatAction
|
{useAccessStore().openaiApiKey && (
|
||||||
onClick={props.showPromptHints}
|
<ChatAction
|
||||||
text={Locale.Chat.InputActions.Prompt}
|
onClick={props.showPromptHints}
|
||||||
icon={<PromptIcon />}
|
text={Locale.Chat.InputActions.Prompt}
|
||||||
/>
|
icon={<PromptIcon />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<ChatAction
|
{useAccessStore().openaiApiKey && (
|
||||||
onClick={() => {
|
<ChatAction
|
||||||
navigate(Path.Masks);
|
onClick={() => {
|
||||||
}}
|
navigate(Path.Masks);
|
||||||
text={Locale.Chat.InputActions.Masks}
|
}}
|
||||||
icon={<MaskIcon />}
|
text={Locale.Chat.InputActions.Masks}
|
||||||
/>
|
icon={<MaskIcon />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<ChatAction
|
<ChatAction
|
||||||
text={Locale.Chat.InputActions.Clear}
|
text={Locale.Chat.InputActions.Clear}
|
||||||
@ -732,6 +736,11 @@ function _Chat() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const doSubmit = (userInput: string) => {
|
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;
|
if (userInput.trim() === "") return;
|
||||||
const matchCommand = chatCommands.match(userInput);
|
const matchCommand = chatCommands.match(userInput);
|
||||||
if (matchCommand.matched) {
|
if (matchCommand.matched) {
|
||||||
@ -1043,15 +1052,14 @@ function _Chat() {
|
|||||||
const payload = JSON.parse(text) as {
|
const payload = JSON.parse(text) as {
|
||||||
key?: string;
|
key?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
|
uin?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("[Command] got settings from url: ", payload);
|
console.log("[Command] got settings from url: ", payload);
|
||||||
|
|
||||||
if (payload.key || payload.url) {
|
if (payload.key || payload.url) {
|
||||||
showConfirm(
|
// var messages = Locale.URLCommand.Settings + `\n${JSON.stringify(payload, null, 4)}`;
|
||||||
Locale.URLCommand.Settings +
|
var messages =
|
||||||
`\n${JSON.stringify(payload, null, 4)}`,
|
"检测到已登录寄托账号(UID:" + payload.uin + "),请确定是否继续登录?";
|
||||||
).then((res) => {
|
showConfirm(messages).then((res) => {
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
if (payload.key) {
|
if (payload.key) {
|
||||||
accessStore.update(
|
accessStore.update(
|
||||||
@ -1431,7 +1439,12 @@ function _Chat() {
|
|||||||
id="chat-input"
|
id="chat-input"
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
className={styles["chat-input"]}
|
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)}
|
onInput={(e) => onInput(e.currentTarget.value)}
|
||||||
value={userInput}
|
value={userInput}
|
||||||
onKeyDown={onInputKeyDown}
|
onKeyDown={onInputKeyDown}
|
||||||
@ -1468,7 +1481,7 @@ function _Chat() {
|
|||||||
)}
|
)}
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<SendWhiteIcon />}
|
icon={<SendWhiteIcon />}
|
||||||
text={Locale.Chat.Send}
|
text={accessStore.openaiApiKey ? Locale.Chat.Send : "登录"}
|
||||||
className={styles["chat-input-send"]}
|
className={styles["chat-input-send"]}
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => doSubmit(userInput)}
|
onClick={() => doSubmit(userInput)}
|
||||||
|
@ -15,7 +15,7 @@ import DragIcon from "../icons/drag.svg";
|
|||||||
|
|
||||||
import Locale from "../locales";
|
import Locale from "../locales";
|
||||||
|
|
||||||
import { useAppConfig, useChatStore } from "../store";
|
import { useAppConfig, useChatStore, useAccessStore } from "../store";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_SIDEBAR_WIDTH,
|
DEFAULT_SIDEBAR_WIDTH,
|
||||||
@ -134,6 +134,7 @@ export function SideBar(props: { className?: string }) {
|
|||||||
// drag side bar
|
// drag side bar
|
||||||
const { onDragStart, shouldNarrow } = useDragSideBar();
|
const { onDragStart, shouldNarrow } = useDragSideBar();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const accessStore = useAccessStore();
|
||||||
const config = useAppConfig();
|
const config = useAppConfig();
|
||||||
const isMobileScreen = useMobileScreen();
|
const isMobileScreen = useMobileScreen();
|
||||||
const isIOSMobile = useMemo(
|
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-header"]} data-tauri-drag-region>
|
||||||
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
<div className={styles["sidebar-title"]} data-tauri-drag-region>
|
||||||
NextChat
|
GterIng.Com
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["sidebar-sub-title"]}>
|
{/* <div className={styles["sidebar-sub-title"]}>
|
||||||
Build your own AI assistant.
|
Build your own AI assistant.
|
||||||
</div>
|
</div> */}
|
||||||
<div className={styles["sidebar-logo"] + " no-dark"}>
|
<div className={styles["sidebar-logo"] + " no-dark"}>
|
||||||
<ChatGptIcon />
|
<ChatGptIcon />
|
||||||
</div>
|
</div>
|
||||||
@ -216,17 +217,25 @@ export function SideBar(props: { className?: string }) {
|
|||||||
<IconButton icon={<SettingsIcon />} shadow />
|
<IconButton icon={<SettingsIcon />} shadow />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["sidebar-action"]}>
|
{/* <div className={styles["sidebar-action"]}>
|
||||||
<a href={REPO_URL} target="_blank" rel="noopener noreferrer">
|
<a href={REPO_URL} target="_blank" rel="noopener noreferrer">
|
||||||
<IconButton icon={<GithubIcon />} shadow />
|
<IconButton icon={<GithubIcon />} shadow />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<AddIcon />}
|
icon={<AddIcon />}
|
||||||
text={shouldNarrow ? undefined : Locale.Home.NewChat}
|
text={shouldNarrow ? undefined : Locale.Home.NewChat}
|
||||||
onClick={() => {
|
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) {
|
if (config.dontShowMaskSplashScreen) {
|
||||||
chatStore.newSession();
|
chatStore.newSession();
|
||||||
navigate(Path.Chat);
|
navigate(Path.Chat);
|
||||||
|
@ -8,7 +8,7 @@ const cn = {
|
|||||||
Error: {
|
Error: {
|
||||||
Unauthorized: isApp
|
Unauthorized: isApp
|
||||||
? "检测到无效 API Key,请前往[设置](/#/settings)页检查 API Key 是否配置正确。"
|
? "检测到无效 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: {
|
Auth: {
|
||||||
Title: "需要密码",
|
Title: "需要密码",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NextChat",
|
"name": "魂牵梦萦 fdafa",
|
||||||
"short_name": "NextChat",
|
"short_name": "魂牵梦萦 fdafa",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/android-chrome-192x192.png",
|
"src": "/android-chrome-192x192.png",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user