mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 01:53:15 +08:00
feat: support compress chat history
This commit is contained in:
@@ -6,6 +6,7 @@ import styles from "./settings.module.scss";
|
||||
|
||||
import ResetIcon from "../icons/reload.svg";
|
||||
import CloseIcon from "../icons/close.svg";
|
||||
import ClearIcon from "../icons/clear.svg";
|
||||
|
||||
import { List, ListItem, Popover } from "./ui-lib";
|
||||
|
||||
@@ -15,10 +16,11 @@ import { Avatar } from "./home";
|
||||
|
||||
export function Settings(props: { closeSettings: () => void }) {
|
||||
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
||||
const [config, updateConfig, resetConfig] = useChatStore((state) => [
|
||||
const [config, updateConfig, resetConfig, clearAllData] = useChatStore((state) => [
|
||||
state.config,
|
||||
state.updateConfig,
|
||||
state.resetConfig,
|
||||
state.clearAllData,
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -31,10 +33,10 @@ export function Settings(props: { closeSettings: () => void }) {
|
||||
<div className={styles["window-actions"]}>
|
||||
<div className={styles["window-action-button"]}>
|
||||
<IconButton
|
||||
icon={<CloseIcon />}
|
||||
onClick={props.closeSettings}
|
||||
icon={<ClearIcon />}
|
||||
onClick={clearAllData}
|
||||
bordered
|
||||
title="重置所有选项"
|
||||
title="清除所有数据"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles["window-action-button"]}>
|
||||
@@ -45,6 +47,14 @@ export function Settings(props: { closeSettings: () => void }) {
|
||||
title="重置所有选项"
|
||||
/>
|
||||
</div>
|
||||
<div className={styles["window-action-button"]}>
|
||||
<IconButton
|
||||
icon={<CloseIcon />}
|
||||
onClick={props.closeSettings}
|
||||
bordered
|
||||
title="关闭"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles["settings"]}>
|
||||
@@ -147,6 +157,24 @@ export function Settings(props: { closeSettings: () => void }) {
|
||||
></input>
|
||||
</ListItem>
|
||||
|
||||
|
||||
<ListItem>
|
||||
<div className={styles["settings-title"]}>
|
||||
历史消息压缩长度阈值
|
||||
</div>
|
||||
<input
|
||||
type="number"
|
||||
min={500}
|
||||
max={4000}
|
||||
value={config.compressMessageLengthThreshold}
|
||||
onChange={(e) =>
|
||||
updateConfig(
|
||||
(config) => (config.compressMessageLengthThreshold = e.currentTarget.valueAsNumber)
|
||||
)
|
||||
}
|
||||
></input>
|
||||
</ListItem>
|
||||
|
||||
<ListItem>
|
||||
<div className={styles["settings-title"]}>
|
||||
上下文中包含机器人消息
|
||||
|
Reference in New Issue
Block a user