Skip to content

What is the purpose of previewToken being passed into the POST request's body?Β #101

@tuffstuff9

Description

@tuffstuff9

In app/api/chat.ts, the previewToken is being sent in the request's body, and is then being used here:

  if (previewToken) {
    configuration.apiKey = previewToken;
  }

I modified the code to store the previewKey in the browser's local storage, and send it in the request, assuming that the OpenAIApi config would be updated with the new key in the post request, but that doesn't seem to be happening. The OpenAIApi object is being created outside the post request So I wonder what purpose the above code serves? Would we have to create a new OpenAIApi object inside the post request everytime we wanted to use the a user defined api key that isn't stored in a db?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions