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

Fix Gemini Proxy Connect call failed #1768

Merged
merged 3 commits into from
Apr 5, 2024
Merged

Fix Gemini Proxy Connect call failed #1768

merged 3 commits into from
Apr 5, 2024

Conversation

HyiKi
Copy link
Contributor

@HyiKi HyiKi commented Mar 30, 2024

The error is as follows:

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lh3.googleusercontent.com:443 ssl:default [Connect call failed ('172.217.163.33', 443)]

fix issue: Gemini.py missing proxy setting at line 141 and 143

Fix ClientConnectorError missing proxy setting
Copy link

Hello,

Thank you for your contribution to the project! Your pull request to fix the Gemini Proxy Connect call issue has been reviewed. Here's the feedback:

Pull Request Review for "Fix Gemini Proxy Connect call failed"

Author: None

File Affected: g4f/Provider/needs_auth/Gemini.py

Lines Modified: 141 and 143

Review Summary:
The proposed changes correctly add the missing proxy settings to the session.get calls for image fetching. This should resolve the ClientConnectorError that was occurring due to the lack of proxy configuration.

Suggestions:

  • Ensure that the proxy variable is defined and accessible within the scope of these changes.
  • Consider adding error handling for potential issues that could arise from the proxy settings, such as connection timeouts or proxy authentication failures.
  • It would be beneficial to include tests that verify the functionality of the proxy settings with various scenarios.

Overall, the changes are well-targeted and address the issue at hand. Great work on identifying and fixing a critical bug!


Once again, thank you for your efforts in improving the project. Your attention to detail and dedication are greatly appreciated!

Best regards,
g4f Copilot

@ebullienc3
Copy link

Does this should fix the problems with using chat and images from Gemeni?
Because I tried it and the bot freezes on "Botname is thinking..."

@HyiKi
Copy link
Contributor Author

HyiKi commented Apr 2, 2024

Does this should fix the problems with using chat and images from Gemeni? Because I tried it and the bot freezes on "Botname is thinking..."

@ebullienc3 The following is my example code. When I configure the proxy to execute this code, there will be errors in the main text. My changes have solved this problem.

client = Client()
response = client.images.generate(
  model="gemini",
  prompt="cute cat"
)
image_url = response.data[0].url

My usage is Gemini image generation. Tell me what your problem function is, and I should be able to help you.

@ebullienc3
Copy link

Does this should fix the problems with using chat and images from Gemeni? Because I tried it and the bot freezes on "Botname is thinking..."

@ebullienc3 The following is my example code. When I configure the proxy to execute this code, there will be errors in the main text. My changes have solved this problem.

client = Client()
response = client.images.generate(
  model="gemini",
  prompt="cute cat"
)
image_url = response.data[0].url

My usage is Gemini image generation. Tell me what your problem function is, and I should be able to help you.

I am using this bot in Discord https://github.com/Zero6992/chatGPT-discord-bot
Whenever I try to use /draw with model Gemeni or Bing I get this: Error Message:Create images failed: we can't create your images right now.

@HyiKi
Copy link
Contributor Author

HyiKi commented Apr 2, 2024

Does this should fix the problems with using chat and images from Gemeni? Because I tried it and the bot freezes on "Botname is thinking..."

@ebullienc3 The following is my example code. When I configure the proxy to execute this code, there will be errors in the main text. My changes have solved this problem.

client = Client()
response = client.images.generate(
  model="gemini",
  prompt="cute cat"
)
image_url = response.data[0].url

My usage is Gemini image generation. Tell me what your problem function is, and I should be able to help you.

I am using this bot in Discord https://github.com/Zero6992/chatGPT-discord-bot Whenever I try to use /draw with model Gemeni or Bing I get this: Error Message:Create images failed: we can't create your images right now.

Okay, your problem is not related to this repository, but I guess it should be a network issue.

@ebullienc3
Copy link

It is indeed for here as the bot is using gpt4free. Anyways, I opened another issue. Thanks :)

@HyiKi
Copy link
Contributor Author

HyiKi commented Apr 2, 2024

It is indeed for here as the bot is using gpt4free. Anyways, I opened another issue. Thanks :)

The same issue here. Zero6992/chatGPT-discord-bot#501

@hlohaus
Copy link
Collaborator

hlohaus commented Apr 2, 2024

Also you could add the get_connector helper for socks proxy support. Then you doesn't need to pass the proxy everywhere.

Gemini. py file adds get_connector to support proxy
@HyiKi
Copy link
Contributor Author

HyiKi commented Apr 3, 2024

Also you could add the get_connector helper for socks proxy support. Then you doesn't need to pass the proxy everywhere.

@hlohaus Okay, updated.

@hlohaus hlohaus merged commit b401b6d into xtekky:main Apr 5, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented Apr 5, 2024

Thank you very much
@HyiKi

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