Compare commits

...

3 Commits

Author SHA1 Message Date
f0c16a3cd1 localStorage follow
All checks were successful
Build static content / build (push) Successful in 3m8s
2024-03-30 11:40:34 +08:00
f54b192616 add follow scroll option 2024-03-30 11:37:19 +08:00
b20de667a4 fix: set logprobs to default false 2024-03-16 18:32:39 +08:00
2 changed files with 28 additions and 3 deletions

View File

@@ -87,7 +87,7 @@ export const newChatStore = (
image_gen_api = "https://api.openai.com/v1/images/generations",
image_gen_key = "",
json_mode = false,
logprobs = true
logprobs = false
): ChatStore => {
return {
chatgpt_api_web_version: CHATGPT_API_WEB_VERSION,
@@ -290,7 +290,7 @@ export function App() {
chatStore.image_gen_api,
chatStore.image_gen_key,
chatStore.json_mode,
chatStore.logprobs
false // logprobs default to false
)
);
setSelectedChatIndex(newKey as number);

View File

@@ -56,11 +56,24 @@ export default function ChatBOX(props: {
const [showAddToolMsg, setShowAddToolMsg] = useState(false);
const [newToolCallID, setNewToolCallID] = useState("");
const [newToolContent, setNewToolContent] = useState("");
let default_follow = localStorage.getItem("follow");
if (default_follow === null) {
default_follow = "true";
}
const [follow, _setFollow] = useState(default_follow === "true");
const mediaRef = createRef();
const setFollow = (follow: boolean) => {
console.log("set follow", follow);
localStorage.setItem("follow", follow.toString());
_setFollow(follow);
};
const messagesEndRef = createRef();
useEffect(() => {
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
if (follow) {
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
}
}, [showRetry, showGenerating, generatingMessage]);
const client = new ChatGPT(chatStore.apiKey);
@@ -804,6 +817,18 @@ export default function ChatBOX(props: {
</div>
)}
{generatingMessage && (
<span
class="p-2 m-2 rounded bg-white dark:text-black dark:bg-white dark:bg-opacity-50 dark:text-black dark:bg-opacity-50"
style={{ textAlign: "right" }}
onClick={() => {
setFollow(!follow);
}}
>
<label>Follow</label>
<input type="checkbox" checked={follow} />
</span>
)}
<div className="flex justify-between">
{(chatStore.model.match("vision") ||
(chatStore.image_gen_api && chatStore.image_gen_key)) && (