Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set the chat session id once when the chat is opened #1674

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
set the chat session id once when the chat is opened
previously the chat session id would change each time the page was re-rendered causing requests to be blocked due to rate-limiting
  • Loading branch information
JosiasAurel committed May 13, 2024
commit 06ed5a866e09d4bce72c0efa016d3c111b9d4afb
3 changes: 2 additions & 1 deletion src/components/popups-etc/chat-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Signal, useSignal } from "@preact/signals";
import { RiChatDeleteLine } from "react-icons/ri";
import markdown from "@wcj/markdown-to-html";
import { nanoid } from "nanoid";
import { useState } from "preact/hooks";

interface ChatProps {
persistenceState: Signal<PersistenceState>;
Expand Down Expand Up @@ -46,7 +47,7 @@ Answer the questions that follow based on this unless new code is provided.`;
const input = useSignal("");

const info = useSignal("");
const chatSession = nanoid(10);
const [chatSession, _setChatSession] = useState(nanoid(10));
const email = persistenceState?.value?.session?.user.email;

const sendMessage = async (message: string) => {
Expand Down