This commit is contained in:
TactfulBean 2023-03-30 15:01:37 +08:00
parent 0c872090e3
commit 5193df86ae
6 changed files with 5222 additions and 7657 deletions

View File

@ -102,7 +102,7 @@ export function ChatList() {
state.currentSessionIndex, state.currentSessionIndex,
state.selectSession, state.selectSession,
state.removeSession, state.removeSession,
] ],
); );
return ( return (
@ -196,7 +196,7 @@ export function Chat(props: {
setPromptHints(promptStore.search(text)); setPromptHints(promptStore.search(text));
}, },
100, 100,
{ leading: true, trailing: true } { leading: true, trailing: true },
); );
const onPromptSelect = (prompt: Prompt) => { const onPromptSelect = (prompt: Prompt) => {
@ -210,7 +210,7 @@ export function Chat(props: {
if (!dom) return; if (!dom) return;
const paddingBottomNum: number = parseInt( const paddingBottomNum: number = parseInt(
window.getComputedStyle(dom).paddingBottom, window.getComputedStyle(dom).paddingBottom,
10 10,
); );
dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum; dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum;
}; };
@ -300,7 +300,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [] : [],
) )
.concat( .concat(
userInput.length > 0 userInput.length > 0
@ -312,7 +312,7 @@ export function Chat(props: {
preview: true, preview: true,
}, },
] ]
: [] : [],
); );
// auto scroll // auto scroll
@ -340,7 +340,7 @@ export function Chat(props: {
const newTopic = prompt(Locale.Chat.Rename, session.topic); const newTopic = prompt(Locale.Chat.Rename, session.topic);
if (newTopic && newTopic !== session.topic) { if (newTopic && newTopic !== session.topic) {
chatStore.updateCurrentSession( chatStore.updateCurrentSession(
(session) => (session.topic = newTopic!) (session) => (session.topic = newTopic!),
); );
} }
}} }}
@ -585,7 +585,7 @@ export function Home() {
state.newSession, state.newSession,
state.currentSessionIndex, state.currentSessionIndex,
state.removeSession, state.removeSession,
] ],
); );
const loading = !useHasHydrated(); const loading = !useHasHydrated();
const [showSideBar, setShowSideBar] = useState(true); const [showSideBar, setShowSideBar] = useState(true);
@ -612,7 +612,15 @@ export function Home() {
<div className={styles["sidebar-header"]}> <div className={styles["sidebar-header"]}>
<div className={styles["sidebar-title"]}>ChatGPT Next</div> <div className={styles["sidebar-title"]}>ChatGPT Next</div>
<div className={styles["sidebar-sub-title"]}> <div className={styles["sidebar-sub-title"]}>
Build your own AI assistant. <a href="https://vercel.com/">
<img src="https://img.shields.io/badge/Vercel-000000?logo=Vercel" />
</a>
<a href="https://github.com/Yidadaa/ChatGPT-Next-Web/stars">
<img src="https://img.shields.io/github/stars/Yidadaa/ChatGPT-Next-Web?logo=github" />
</a>
<a href="https://github.com/Yidadaa/ChatGPT-Next-Web/fork">
<img src="https://img.shields.io/github/forks/Yidadaa/ChatGPT-Next-Web?logo=github" />
</a>
</div> </div>
<div className={styles["sidebar-logo"]}> <div className={styles["sidebar-logo"]}>
<ChatGptIcon /> <ChatGptIcon />

View File

@ -320,7 +320,7 @@ export function Settings(props: { closeSettings: () => void }) {
> >
<input <input
value={accessStore.accessCode} value={accessStore.accessCode}
type="password" type="text"
placeholder={Locale.Settings.AccessCode.Placeholder} placeholder={Locale.Settings.AccessCode.Placeholder}
onChange={(e) => { onChange={(e) => {
accessStore.updateCode(e.currentTarget.value); accessStore.updateCode(e.currentTarget.value);

View File

@ -1,5 +1,6 @@
import { create } from "zustand"; import { create } from "zustand";
import { persist } from "zustand/middleware"; import { persist } from "zustand/middleware";
import isMobile from "is-mobile";
import { type ChatCompletionResponseMessage } from "openai"; import { type ChatCompletionResponseMessage } from "openai";
import { import {
@ -117,6 +118,11 @@ export function filterConfig(config: ModelConfig): Partial<ModelConfig> {
return config; return config;
} }
let TIGHTBORDER = true;
if (isMobile()) {
TIGHTBORDER = false;
}
const DEFAULT_CONFIG: ChatConfig = { const DEFAULT_CONFIG: ChatConfig = {
historyMessageCount: 4, historyMessageCount: 4,
compressMessageLengthThreshold: 1000, compressMessageLengthThreshold: 1000,
@ -125,7 +131,7 @@ const DEFAULT_CONFIG: ChatConfig = {
avatar: "1f603", avatar: "1f603",
fontSize: 14, fontSize: 14,
theme: Theme.Auto as Theme, theme: Theme.Auto as Theme,
tightBorder: false, tightBorder: TIGHTBORDER,
disablePromptHint: false, disablePromptHint: false,

View File

@ -174,7 +174,6 @@ input[type="range"]::-webkit-slider-thumb:hover {
width: 24px; width: 24px;
} }
input[type="password"],
input[type="number"], input[type="number"],
input[type="text"] { input[type="text"] {
appearance: none; appearance: none;
@ -247,3 +246,10 @@ pre {
} }
} }
} }
@font-face {
font-family: "ZhuZiAWan";
src: url("https://npm.elemecdn.com/anzhiyu-blog@2.0.4/fonts/ZhuZiAWan.woff2");
}
* {
font-family: ZhuZiAWan;
}

View File

@ -17,6 +17,7 @@
"emoji-picker-react": "^4.4.7", "emoji-picker-react": "^4.4.7",
"eventsource-parser": "^0.1.0", "eventsource-parser": "^0.1.0",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"is-mobile": "^4.0.0",
"next": "^13.2.3", "next": "^13.2.3",
"node-fetch": "^3.3.1", "node-fetch": "^3.3.1",
"openai": "^3.2.1", "openai": "^3.2.1",

12836
yarn.lock

File diff suppressed because it is too large Load Diff