Git Product home page Git Product logo

stable-diffusion-webui-chatgpt-utilities's People

Contributors

hallatore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stable-diffusion-webui-chatgpt-utilities's Issues

Please add an option to read API key from environment variables

Currently the only option to set the key is to store it as a plain text in config.json
Would be super useful to add something like this:

openai.api_key = shared.opts.data.get("chatgpt_utilities_api_key", "")
if openai.api_key == "":
openai.api_key = os.getenv("ENVNAME" default="")
if openai.api_key == "":
raise Exception("OpenAI API Key is not set. Please set it in the settings menu.")

extension doesnot work

Hi,
Thanks for ur great work, when I use this extension ,i meet the following question:
I cloned this project to the webui/extensions and I can see this extension in installed column,but I cannot find it in Function bar

image

This error always happens

hello
good extensions, i'm glad to use this
but i can use it just only one time after i install this

and always after restart the colab, this happens

Error loading script: chatgpt_utils.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 3, in
import openai
ModuleNotFoundError: No module named 'openai'

Error loading script: json_utils.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/json_utils.py", line 2, in
import json5
ModuleNotFoundError: No module named 'json5'

Error loading script: prompt_chatgpt.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/prompt_chatgpt.py", line 3, in
import openai
ModuleNotFoundError: No module named 'openai'

what is the problem? im not major in computer and i dont know python so i cannot handle it.. please help

Sorry for asking again

After you answer with my question,

Error loading script: chatgpt_utils.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 3, in
import openai
ModuleNotFoundError: No module named 'openai'

Error loading script: json_utils.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/json_utils.py", line 2, in
import json5
ModuleNotFoundError: No module named 'json5'

Error loading script: prompt_chatgpt.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 229, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/prompt_chatgpt.py", line 3, in
import openai
ModuleNotFoundError: No module named 'openai'

this error happened again after 1day i restart the colab
so i install json5 and openai by using the code

pip uninstall openai
pip install --upgrade pip
pip install openai
pip install json5

but the error

Error loading script: prompt_chatgpt.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 248, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "frozen importlib._bootstrap_external>", line 846, in exec_module
File "frozen importlib._bootstrap_external>", line 983, in get_code
File "frozen importlib._bootstrap_external>", line 913, in source_to_code
File "frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/prompt_chatgpt.py", line 123
match precision_dropdown:
^
SyntaxError: invalid syntax

I erased <

this happened...
i tried to solve it myself.. but it's out of my control, i think
i'm completely blind at python and computer science.. so sorry for asking you to help me again
can you help me?

extension not working

When I tell ChatGPT to create an image, it receives it just fine, but when it finishes creating the image, I got an error.

image image

Please get rid of "ChatGPT answers doesn't match batch count" Exception

Many times I get this error: Exception: ChatGPT answers doesn't match batch count. Got 32 answers, expected 30

Sorry, but this is very annoying error. When it happens user needs to wait few minutes until it times out. I don't really care if it gives me 30 or 32 answers, roughly is okay, just don't make me restart it again 🙈🙈

About add "Custom API Domain"

I have been using ChatGPT in China, but it tends to be very unstable. Is it possible to add an option for a custom API domain? This would be greatly appreciated. Thank you.

ChatGPT query failed. Retrying. Error:

Got this message (also it uses GPT3.5 even if I have GPT4.0):

You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run `openai migrate` to automatically upgrade your codebase to use the 1.0.0 interface.

Alternatively, you can pin your installation to the old version, e.g. `pip install openai==0.28`

A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742

Error: module 'openai' has no attribute 'ChatCompletion'

Hello,

When using the extension, I run into an Attribution error: "module 'openai' has no attribute 'ChatCompletion'". I know ChatGPT ran some updates and Completion is now a legacy function (on their playground). I am not a developer or coder, I hope this issue is solvable since I enjoy the extension very much.
I run SD through google colabs and use the A1111 interface. I tried reinstallation with no success. Full Error message (sorry for the length, ADetailer is turned off but adds a lot of text):

**__ChatGPT request:
I want you to act as a prompt generator. Compose each answer as a visual sentence. Do not write explanations on replies. Format the answers as javascript json arrays with a single string per answer. Return exactly 1 to my question. Answer the questions exactly. Answer the following question:
Make a color description

ChatGPT query failed. Retrying. Error: module 'openai' has no attribute 'ChatCompletion'
ChatGPT request:
I want you to act as a prompt generator. Compose each answer as a visual sentence. Do not write explanations on replies. Format the answers as javascript json arrays with a single string per answer. Return exactly 1 to my question. Answer the questions exactly. Answer the following question:
Make a color description

ChatGPT query failed. Retrying. Error: module 'openai' has no attribute 'ChatCompletion'
ChatGPT request:
I want you to act as a prompt generator. Compose each answer as a visual sentence. Do not write explanations on replies. Format the answers as javascript json arrays with a single string per answer. Return exactly 1 to my question. Answer the questions exactly. Answer the following question:
Make a color description

ChatGPT query failed. Retrying. Error: module 'openai' has no attribute 'ChatCompletion'
ChatGPT request:
I want you to act as a prompt generator. Compose each answer as a visual sentence. Do not write explanations on replies. Format the answers as javascript json arrays with a single string per answer. Return exactly 1 to my question. Answer the questions exactly. Answer the following question:
Make a color description
Return exactly 1 answers to my question.

*** Error completing request
*** Arguments: ('task(cgbd5neqncdemzo)', '', '', [], 36, 'DPM++ 2M SDE Karras', 1, 1, 7, 1280, 1024, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], <gradio.routes.Request object at 0x7f5c9b07fa00>, 5, False, '', 0.8, -1, False, -1, 0, 0, 0, False, {'ad_model': 'face_yolov8n.pt', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'inpaint_global_harmonious', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'inpaint_global_harmonious', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, <scripts.animatediff_ui.AnimateDiffProcess object at 0x7f5c9b0549d0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x7f5c9b00b340>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x7f5c9b0561a0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x7f5c9b0a0250>, None, False, '0', '0', 'inswapper_128.onnx', 'CodeFormer', 1, True, 'None', 1, 1, False, True, 1, 0, 0, False, 0.5, None, False, '0', '/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/models/roop/inswapper_128.onnx', 'CodeFormer', 1, '', 1, 1, False, True, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50, 'Make a color description', 2, 1.0, True, '', '', True, False, False, False) {}
Traceback (most recent call last):
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/modules/call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/modules/call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/modules/txt2img.py", line 52, in txt2img
processed = modules.scripts.scripts_txt2img.run(p, args)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/modules/scripts.py", line 601, in run
processed = script.run(p, script_args)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/prompt_chatgpt.py", line 141, in run
chatgpt_answers = get_chatgpt_answers(chatgpt_prompt, int(chatgpt_batch_count), temperature, original_prompt)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_answers.py", line 30, in get_chatgpt_answers
chatgpt_answers = retry_query_chatgpt(prompt, prompt_count, temperature, 4)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 18, in retry_query_chatgpt
raise e
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 12, in retry_query_chatgpt
chatgpt_answers = query_chatgpt(messages, count, temperature, is_last_retry)
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 39, in query_chatgpt
chat_gpt_response = get_chat_completion([
File "/content/drive/MyDrive/AI_PICS/stable-diffusion-webui/extensions/stable-diffusion-webui-chatgpt-utilities/scripts/chatgpt_utils.py", line 63, in get_chat_completion
completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages, temperature=temperature)
AttributeError: module 'openai' has no attribute 'ChatCom_pletion'_

使用API模式如何调用

我想通过API模式 使用此扩展。可以告诉我在/sdapi/v1/txt2img 中如何传此扩展参数吗。谢谢

Give errors and dont run!

Hi,

I installed it in my stable diffusion and set the api key in the settings but whe i try to generate something give me all this errors!

Chat GPT request:
I want you to act as a prompt generator. Compose each answer as a visual sentence. Do not write explanations on replies. Format the answers as javascript json arrays with a single string per answer. Return exactly 4 to my question. Answer the questions exactly. Answer the following question:
Describe an epic d&d scene using the prompt ""a warlock man with a hero look"" as inspiration. Describe the person, clothing/armor and atmosphere. Don´t use any name or artist names from the original prompt. Give me 8 examples with unique characteristics. Return only a short description.

Error completing request
Arguments: ('task(w7qqill1xjysrzo)', 'a warlock man with a hero look', '', [], 20, 15, False, False, 1, 1, 4.5, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 6, False, True, False, 0, -1, False, '', False, False, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'LoRA', 'None', 1, 1, 'Refresh models', False, True, False, 'none', 'None', 1, None, False, 'Scale to Fit (Inner Fit)', False, False, 64, 64, 64, 0, 1, False, False, 'none', 'None', 1, None, False, 'Scale to Fit (Inner Fit)', False, False, 64, 64, 64, 0, 1, False, False, False, False, False, '1:1,1:2,1:2', '0:0,0:0,0:1', '0.2,0.8,0.8', 20, False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0, None, None, 50, 'Describe an epic d&d scene using the prompt "{prompt}" as inspiration.\nDescribe the person, clothing/armor and atmosphere.\nDon´t use any name or artist names from the original prompt.\nGive me 8 examples with unique characteristics.\nReturn only a short description.', 4.0, False, '', '', False, False, False, 0, 0, 512, 512, False, False, True, True, True, False, False, 1, False, False, 2.5, 4, 0, False, 0, 1, False, False, 'u2net', False, False, False, False) {}
Traceback (most recent call last):
File "F:\SD\stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\chatgpt_utils.py", line 10, in retry_query_chatgpt
chatgpt_answers = query_chatgpt(messages, count)
File "F:\SD\stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\chatgpt_utils.py", line 26, in query_chatgpt
chat_gpt_response = get_chat_completion([
File "F:\SD\stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\chatgpt_utils.py", line 52, in get_chat_completion
completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages, temperature=0.5)
File "F:\SD\stable-diffusion-webui\venv\lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
File "F:\SD\stable-diffusion-webui\venv\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "F:\SD\stable-diffusion-webui\venv\lib\site-packages\openai\api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "F:\SD\stable-diffusion-webui\venv\lib\site-packages\openai\api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "F:\SD\stable-diffusion-webui\venv\lib\site-packages\openai\api_requestor.py", line 679, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:\SD\stable-diffusion-webui\modules\call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "F:\SD\stable-diffusion-webui\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "F:\SD\stable-diffusion-webui\modules\txt2img.py", line 53, in txt2img
processed = modules.scripts.scripts_txt2img.run(p, *args)
File "F:\SD\stable-diffusion-webui\modules\scripts.py", line 376, in run
processed = script.run(p, *script_args)
File "F:\SD\stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\prompt_chatgpt.py", line 110, in run
chatgpt_answers = retry_query_chatgpt(chatgpt_prompt, int(chatgpt_batch_count), 3)
File "F:\SD\stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\chatgpt_utils.py", line 12, in retry_query_chatgpt
if (len(chatgpt_answers) == count):
UnboundLocalError: local variable 'chatgpt_answers' referenced before assignment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.