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

feat(nx-dev): move openai call to edge function #18747

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

mandarini
Copy link
Member

@mandarini mandarini commented Aug 21, 2023

Moved the OpenAI API calls into a Next.js Edge function, so that the API key is not revealed to the client!

test it here: https://nx-dev-git-fork-mandarini-feat-move-openai-call-to-edge-nrwl.vercel.app/ai

@vercel
Copy link

vercel bot commented Aug 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2023 11:20am

@mandarini mandarini self-assigned this Aug 21, 2023
ndcunningham
ndcunningham previously approved these changes Aug 23, 2023
nx-dev/data-access-ai/src/lib/data-access-ai.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ndcunningham ndcunningham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
    "code": "42501",
    "details": null,
    "hint": null,
    "message": "new row violates row-level security policy for table \"user_queries\""
}

I got this error when running the preview.
Is this something we should handle?

@ndcunningham ndcunningham self-requested a review August 23, 2023 15:26
@ndcunningham ndcunningham dismissed their stale review August 23, 2023 15:27

Found an error

Copy link
Contributor

@ndcunningham ndcunningham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle supabase calls as well?
Screenshot 2023-08-23 at 9 32 09 AM

@mandarini
Copy link
Member Author

@ndcunningham RE: supabase: I don't think we need to handle the Supabase stuff, because @FrozenPandaz added the anon key there, which is ok to be revealed?

@mandarini
Copy link
Member Author

@ndcunningham the feedback error is expected, because we changed some things with permissions. Next week I'll work on the new feedback functions, and it will be fixed!

@ndcunningham ndcunningham enabled auto-merge (squash) August 24, 2023 15:20
@mandarini mandarini enabled auto-merge (squash) August 24, 2023 15:50
@mandarini mandarini merged commit bd76b62 into nrwl:master Aug 24, 2023
15 checks passed
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants