import { useState, useRef, useEffect } from "react";
import EmojiPicker, { Emoji, Theme as EmojiTheme } from "emoji-picker-react";
import styles from "./settings.module.scss";
import ResetIcon from "../icons/reload.svg";
import CloseIcon from "../icons/close.svg";
import { List, ListItem, Popover } from "./ui-lib";
import { IconButton } from "./button";
import { SubmitKey, useChatStore, Theme } from "../store";
import { Avatar } from "./home";
export function Settings(props: { closeSettings: () => void }) {
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
const [config, updateConfig, resetConfig] = useChatStore((state) => [
state.config,
state.updateConfig,
state.resetConfig,
]);
return (
<>
}
onClick={props.closeSettings}
bordered
title="重置所有选项"
/>
}
onClick={resetConfig}
bordered
title="重置所有选项"
/>
头像
setShowEmojiPicker(false)}
content={
{
updateConfig((config) => (config.avatar = e.unified));
setShowEmojiPicker(false);
}}
/>
}
open={showEmojiPicker}
>
setShowEmojiPicker(true)}
>
发送键
主题
紧凑边框
updateConfig(
(config) => (config.tightBorder = e.currentTarget.checked)
)
}
>
最大上下文消息数
updateConfig(
(config) =>
(config.historyMessageCount = e.target.valueAsNumber)
)
}
>
上下文中包含机器人消息
updateConfig(
(config) => (config.sendBotMessages = e.currentTarget.checked)
)
}
>
>
);
}