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

Added stable-diffusion-webui-chat-gpt-prompts.json #390

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

ilian6806
Copy link
Contributor

@ilian6806 ilian6806 commented Nov 28, 2024

Info

https://github.com/ilian6806/stable-diffusion-webui-chat-gpt-prompts

  • Generate SD prompts variations with ChatGPT
  • Optionally translate the prompt from another language with DeepL
  • Optionally use a custom ChatGPT model
  • Optionally use custom ChatGPT instructions
  • UI state is preserved across page reloads

Checklist:

  • I have read the Readme.md
  • The description is written in English.
  • The index.json and extension_template.json have not been modified.
  • The entry is placed in the extensions directory with the .json file extension.

@w-e-w
Copy link
Collaborator

w-e-w commented Dec 21, 2024

sorry for the late review being rather busy recently


issues with current extension

there's no have no documentation / warning about that the user needs to have a API key to open AI to use ChatGPT
there's also no instructions on how to get the API key

since you have no instructions about API keys if the user install your extension and press your button
Nothing will happen the pop-up won't appear as if your extension is broken

this is because you have a line that would throw an error if the user has not assigned an API key yet
https://github.com/ilian6806/stable-diffusion-webui-chat-gpt-prompts/blob/bccb030ab640aa562b57ae2eee6f229e112a0d49/javascript/gptp.core.js#L227
this will be triggered on the first install if the user hasn't pressed added the api key apply setting then reload the webpage
as config file doesn't have the entry the value you're trying to reference is undefined

there is also no need of adding an additional API endpoint /gptp/config.json for getting settings
and since you endpoint is also not authenticated, and your put the API keys in settings, your literary exposing your API key to anyone
you can simply access any setting key using JavaScript by using the global variable opts
for example opts.gptp_deepl_api_key

please remove the custom api because it is unnecessary and for security reasons

addition advantage of using opts
currently if you update your API key you need to reload your web page in order for it to work
because I think you only fetch the settings once during init()
if you use opts the value will be automatically updated without needing a reloading


summary

  1. at sufficient documentation and warning about OpenAI subscription needed and about API key
  1. remove the unsecure API end point and use opts
  2. make sure it works on a new install

since I do not have a OpenAI subscription, I cannot truly test this extension myself
so I would like you to provide a short video of it woring (preferably from a clean install)

@w-e-w w-e-w marked this pull request as draft December 21, 2024 23:23
@ilian6806
Copy link
Contributor Author

Hi @w-e-w!

Thanks for your feedback, really appreciated! I didn't know we have a global opts variable.

I made the following changes:

  • Removed config API route. Replaced with ops global variable.
  • Created wiki pages with docs for getting OpenAI and DeepL API keys
  • Added paid subscription info in the extension description
  • Added a popup when we don't have an OpenAI API key in settings with a link to the wiki pages
  • Created video with extension usage
  • Added YouTube link to the video in the README

Demo video -> https://www.youtube.com/watch?v=zz_pok7smjY

@w-e-w w-e-w marked this pull request as ready for review December 22, 2024 16:19
@w-e-w
Copy link
Collaborator

w-e-w commented Dec 22, 2024

didn't test myself but based on your videos looks like it works fine

just one suggestion about the video
disable grammarly while making the video
someone that doesn't know what grammarly is may think it's a part of your extension

@w-e-w w-e-w merged commit fd96f98 into AUTOMATIC1111:extensions Dec 22, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants