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

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

Closed
tuffstuff9 opened this issue Jul 13, 2023 · 1 comment

Comments

@tuffstuff9
Copy link

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?

@leerob
Copy link
Member

leerob commented Nov 27, 2023

^ This is a good PR if you want to add the preview functionality: supabase-community#13

@leerob leerob closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants