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

selecting ChatGPT model and regenerate? #9

Closed
d-vyd opened this issue May 13, 2023 · 10 comments
Closed

selecting ChatGPT model and regenerate? #9

d-vyd opened this issue May 13, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@d-vyd
Copy link

d-vyd commented May 13, 2023

Hi. This code works great so far. I have two questions:

(1) I'd like to choose ChatGPT4 sometimes and ChatGPT3.5 other times. When I manually open a new chat with a ChatGPT Plus subscription, I see a model selection dropdown at the top of the page. How can I access that through the object returned by ChatGPT_Client(args.username, args.password) and make the appropriate selection? I'm not proficient in HTML but it doesn't look like a regular dropdown menu to me. Here is the button that allows the user to see the model options:

<button class="relative flex cursor-pointer flex-col rounded-md bg-white py-2 pl-3 pr-10 text-left dark:bg-gray-800 sm:text-sm w-full border border-black/10 focus:border-green-600 focus:outline-none focus:ring-1 focus:ring-green-600 dark:border-white/20" id="headlessui-listbox-button-:r1r:" type="button" aria-haspopup="true" aria-expanded="true" data-headlessui-state="open" aria-labelledby="headlessui-listbox-label-:r1s: headlessui-listbox-button-:r1r:" aria-controls="headlessui-listbox-options-:r2c:"><label class="block text-xs text-gray-700 dark:text-gray-500" id="headlessui-listbox-label-:r1s:" data-headlessui-state="open">Model</label><span class="inline-flex w-full truncate"><span class="flex h-6 items-center gap-1 truncate">GPT-4</span></span><span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 text-gray-400" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><polyline points="6 9 12 15 18 9"></polyline></svg></span></button>

The options are "ChatGPT-3.5", the default, and "ChatGPT-4", which must be selected if desired. Here is the code for that option:

<li class="group relative flex h-[42px] cursor-pointer select-none items-center overflow-hidden border-b border-black/10 pl-3 pr-9 last:border-0 dark:border-white/20 text-gray-900" id="headlessui-listbox-option-:r2h:" role="option" tabindex="-1" aria-selected="false" data-headlessui-state=""><span class="flex items-center gap-1.5 truncate"><span class="flex h-6 items-center gap-1 text-gray-800 dark:text-gray-100">GPT-4</span></span></li>

(2) There are times when I'd prefer to hit the "regenerate" button rather than resubmitting the same question since doing so does not, I believe, contribute to the ChatGPT4 usage limits. How do I access this button?

@d-vyd d-vyd changed the title selecting ChatGPT model? regenerate and selecting ChatGPT model? May 13, 2023
@d-vyd d-vyd changed the title regenerate and selecting ChatGPT model? selecting ChatGPT model and regenerate? May 13, 2023
@ugorsahin
Copy link
Owner

Hello,

The regenerate function is an important feature, you can find regenerate_response() function in the following commit ecfcc17.

I will update here once I have a solution for model selection, I may need your help to verify the functionality.

@d-vyd
Copy link
Author

d-vyd commented May 14, 2023

Wonderful! I'd be happy to test this functionality.

@d-vyd
Copy link
Author

d-vyd commented May 17, 2023

Hi. I just wanted to inform you that ChatGPT has changed the model selection widget. Let me know if you need any HTML info about it.

@ugorsahin ugorsahin added the enhancement New feature or request label May 19, 2023
@ugorsahin
Copy link
Owner

Can you please share a snapshot and html code of this new widget, I can take a look at that now.

@d-vyd
Copy link
Author

d-vyd commented May 19, 2023

Let me know if this helps you:

snapshot: https://pasteboard.co/GrfZGp8fBC7e.png
code: https://pastebin.com/yx6q8tzt

@ugorsahin
Copy link
Owner

Can you please switch to new branch d1a8db3 and check if that works?

@d-vyd
Copy link
Author

d-vyd commented May 22, 2023

Thanks! I will check this later today or early tomorrow.

@d-vyd
Copy link
Author

d-vyd commented May 24, 2023

Hi. I'm using python 3.10.0. I downloaded and uncompressed the code ZIP. I changed the relative "helpers" import into an absolute import by removing the leading period. I opened a terminal, cd'ed into the directory, and typed python .\chatgpt_client.py. This worked in the "main" branch. In the new branch, I received the error:

Traceback (most recent call last):
  File "C:\Users\david\Downloads\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\chatgpt_automation\chatgpt_client.py", line 304, in <module>
    chatgpt = ChatGPT_Client(args.username, args.password)
  File "C:\Users\david\Downloads\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\chatgpt_automation\chatgpt_client.py", line 64, in __init__
    version_main=detect_chrome_version()
  File "C:\Users\david\Downloads\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\ChatGPT_Automation-9-selecting-chatgpt-model-and-regenerate\chatgpt_automation\helpers.py", line 10, in detect_chrome_version
    out = subprocess.check_output(['google-chrome', '--version'])
  File "C:\Program Files\Python310\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Program Files\Python310\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Program Files\Python310\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python310\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

@ugorsahin
Copy link
Owner

  • There is an error in version detection because the code is written for linux, I will provide the detection for windows too. Thanks for letting me know about the bug.
  • You don't need to change the relative error if you install it. Have you tried using it without installing?
  • For now, I am sending a hotfix for version detection ffd2b01, proceed to model switch after instantiating chathead with command ChatGPT_Client.switch_model('GPT-4'). That should work

@d-vyd
Copy link
Author

d-vyd commented Sep 15, 2023

I was pulled onto another project. I apologize for disappearing. I'll be able to report on your recent updates as soon as I get undetected_chromedriver working correctly again on my computer. I've posted my issue here ultrafunkamsterdam/undetected-chromedriver#1563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants