Skip to content

Prevent all chats to share one history. #103

Description

@alexomon018

Hey guys,

First off, amazing work on the library/ I've been using it for quite a while in my chat app, and it's been great!

I recently noticed that all chats seem to be sharing the same history when using the following setup:

const getCurrentTime = () => new Date().toLocaleString();

const ragChat = new RAGChat({
  ratelimit,
  debug: true,
  model: openai("gpt-4o-mini", {
    organization: process.env.OPENAI_ORGANIZATION,
  }),
  vector: new Index({
    url: process.env.UPSTASH_VECTOR_REST_URL,
    token: process.env.UPSTASH_VECTOR_REST_TOKEN,
  }),
  redis,
  promptFn: ({ question, chatHistory, context }) => `
---
chat history:
${chatHistory}
---
context:
${context}
---
question:
${question}
`
});

I came across the sessionId option and was considering using it to differentiate between chats. Would that be the recommended approach, or is there a better way to handle this?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions