gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

forefront error (python 3.8.13)

Open AvenCores opened this issue 1 year ago • 3 comments

Traceback (most recent call last):
  File "/home/avencores/Рабочий стол/Данные/Проекты GitHub/free-chatpt4.0-cli/venv/lib64/python3.8/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    token = forefront.Account.create(logging=False)
  File "/home/avencores/Рабочий стол/Данные/Проекты GitHub/free-chatpt4.0-cli/forefront/__init__.py", line 61, in create
    for _ in mail.fetch_inbox():
  File "/home/avencores/Рабочий стол/Данные/Проекты GitHub/free-chatpt4.0-cli/forefront/mail.py", line 50, in fetch_inbox
    return self.client.get(f"https://api.mail.tm/messages").json()["hydra:member"]
  File "/home/avencores/Рабочий стол/Данные/Проекты GitHub/free-chatpt4.0-cli/venv/lib64/python3.8/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

[test.py]

import forefront

token = forefront.Account.create(logging=False)
print(token)

for response in forefront.StreamingCompletion.create(token = token,
    prompt = 'hello world', model='gpt-4'):
    
    print(response.completion.choices[0].text, end = '')
print("")

AvenCores avatar Apr 29 '23 08:04 AvenCores

They changed their key to email link in strategy and also removed the verification code in the email that the method was trying to grep. I think they're also encoding the token in the cookies instead of the response?

I don't really know though as I have almost 0 reverse engineering experience.

I've managed to work around both but can't seem to figure out the stream now. They seemed to have changed the authority urls at the very least.

tilefishpoele avatar Apr 29 '23 13:04 tilefishpoele

Yes

JBX2060 avatar Apr 29 '23 13:04 JBX2060

How did you make it work?

JBX2060 avatar Apr 29 '23 13:04 JBX2060

I copy token from authorization: Bearer xxxx

  1. Press F12
  2. Go to Tab Network
  3. Ask forefront
  4. Back to Tab Network >> chat >> authorization: Bearer xxxx >> Copy xxxx
  5. Replace token = forefront.Account.create(logging=False) >> token = xxxx

No error but return nothing:)

phamxtien avatar Apr 29 '23 23:04 phamxtien

I copy token from authorization: Bearer xxxx

  1. Press F12
  2. Go to Tab Network
  3. Ask forefront
  4. Back to Tab Network >> chat >> authorization: Bearer xxxx >> Copy xxxx
  5. Replace token = forefront.Account.create(logging=False) >> token = xxxx

No error but return nothing:)

The token is different for each chat, so you have to find out the way to generate it.

neo-jujia avatar Apr 30 '23 03:04 neo-jujia