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

Internal Server Error #51

Closed
welcomeai opened this issue May 28, 2024 · 2 comments
Closed

Internal Server Error #51

welcomeai opened this issue May 28, 2024 · 2 comments

Comments

@welcomeai
Copy link

May I ask what is causing this?
Input: Your 你好,请问你是谁? Here
COOKIES: {'field': 'value'}
History enabled
ERROR:FreeGPT4_Server:Exception on / [GET]
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\asgiref\sync.py", line 254, in call
return call_result.result()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\concurrent\futures_base.py", line 391, in __get_result
raise self._exception
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\asgiref\sync.py", line 331, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "E:\PythonExample\Free-GPT4-WEB-API-main\src\FreeGPT4_Server.py", line 410, in index
await g4f.ChatCompletion.create_async(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\providers\base_provider.py", line 250, in create_async
return "".join([
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\providers\base_provider.py", line 250, in
return "".join([
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\Provider\Bing.py", line 427, in stream_generate
raise e
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\Provider\Bing.py", line 421, in stream_generate
conversation = await create_conversation(session, headers, tone)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\Provider\bing\conversation.py", line 42, in create_conversation
await raise_for_status(response, "Failed to create conversation")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\g4f\requests\raise_for_status.py", line 28, in raise_for_status_async
raise ResponseStatusError(f"Response {response.status}: {message}")
g4f.errors.ResponseStatusError: Response 403: Failed to create conversation
INFO:werkzeug:127.0.0.1 - - [28/May/2024 15:22:42] "�[35m�[1mGET /?text=Your%20你好,请问你是谁?%20Here HTTP/1.1�[0m" 500 -

@aledipa
Copy link
Owner

aledipa commented May 29, 2024

It may be a g4f library related issue, the same happened here

@Allamaris0
Copy link

Allamaris0 commented May 30, 2024

Just try to send request again.

You can use the code something like this:

def send_prompt_to_bing(prompt):
    interval_error = """<!doctype html>"""

    url = # use "https://api.freegpt4.ddns.net/?text={prompt}" or link to your server http://192.168.8.170:5500/?text={prompt}
    response = requests.get(url,timeout=(10, 90)) # or even use higher time to wait for a response
    text = response.text
    print(text)

    if interval_error in text.lower():
        send_prompt_to_bing(prompt)
    else:
        return text

@aledipa aledipa closed this as completed Oct 11, 2024
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

No branches or pull requests

3 participants