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

Open AI toggle now works as expected #541

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

A-4-Atom
Copy link
Contributor

@A-4-Atom A-4-Atom commented Jan 8, 2024

@briangormanly
env variable "OPENAI_TOGGLE" had no effect previously.
I'm just conditionally rendering the div based on if env variable is true or false in file:
client/agora/views/dashboard/partials/topic/topic-view.ejs

let me know if this is the correct implementation, or if I need to make any other changes.
see issue #535

@briangormanly briangormanly self-assigned this Jan 8, 2024
@briangormanly briangormanly added UI / Front end Changes to the UI, Front end JS, CSS, etc AI Any development related to AI integration labels Jan 8, 2024
@briangormanly
Copy link
Collaborator

@A-4-Atom This is a good start, I think to be complete it would need the controllers to abide by the flag as well any time it is going to make a call to openAI.

For example in aiController.js

  • generateAvatar should return a 403 (forbidden) with a message stating the openAI apis are turned off, and in the detail mention the OPENAI_TOGGLE flag.
  • same for callOpenAI

This is what the message / response might look like:
res.set( "x-agora-message-title", "OpenAI API restricted" );
res.set( "x-agora-message-detail", "API is not enabled see OPENAI_TOGGLE flag" );
res.status( 403 ).json( {"error": "OpenAI API restricted"} );

Thanks again!

@A-4-Atom
Copy link
Contributor Author

A-4-Atom commented Jan 9, 2024

@briangormanly
Hi,
I've made the changes to controllers but I could not test it as I have little knowledge of backend.
Can you check if it's correct?

@briangormanly
Copy link
Collaborator

@A-4-Atom Thank you, I was able to test the APIs and verify that they turn on and off as expected.

@briangormanly briangormanly self-requested a review January 10, 2024 16:05
Copy link
Collaborator

@briangormanly briangormanly left a comment

Choose a reason for hiding this comment

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

UI components and API toggle as expected, new AI panel will have to implement this change as well.#530

@briangormanly briangormanly merged commit 2ce8b6d into agorafoundation:main Jan 10, 2024
1 check passed
@A-4-Atom A-4-Atom deleted the fix-openai-toggle branch January 10, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Any development related to AI integration UI / Front end Changes to the UI, Front end JS, CSS, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants