snowby666 / poe-api-wrapper

👾 A Python API wrapper for Poe.com. With this, you will have free access to GPT-4, Claude, Llama, Gemini, Mistral and more! 🚀
https://pypi.org/project/poe-api-wrapper/
GNU General Public License v3.0
678 stars 81 forks source link

Specifying a bot in a parameter has no effect #170

Open xzwthu opened 1 week ago

xzwthu commented 1 week ago

I updated the version to 1.5.7, then sent a message and it replied it's gpt 4.0, later I verified that it seemed like it was always replying the same no matter what Bot I specified. In fact, this is already the case in the earlier version, I made sure tonight that specifying the bot in the parameters does not work. But I don't know what caused it.

from poe_api_wrapper import AsyncPoeApi
import asyncio
tokens = {
    'p-b': 'j9ZnssKP-_Vc6EZ1LfI9Zg%3D%3D',
    'p-lat': "OF9LWK8117Se5KRpwzCaKwcsS%2FrG%2FhtXhJNg%2F6xvQA%3D%3D"
}

async def main():
    client = await AsyncPoeApi(tokens=tokens).create()
    message = "which model are you?"
    async for chunk in client.send_message(bot="gpt3_5", message=message):
        print(chunk["response"], end='', flush=True)

asyncio.run(main())

This is a big problem for me, because sometimes I want some images to generate, but this is completely unusable in the original version

微信截图_20240623224643

snowby666 commented 1 week ago

^^ Can you try deleting cookies then login poe.com again?

xzwthu commented 1 week ago

^^ Can you try deleting cookies then login poe.com again?

Ah, thanks for the warning. I've done that --deleting cookies then login poe.com again, so there won't be a leak, but now the problem is still there, not solved

snowby666 commented 1 week ago

Does this bug only happen with the above token?

Can you try this token

"p-b": "EpIGqnEPatvs0FQ%3D%3D", "p-lat": "2McXqSR8yaylC9ONZewBBh3oV5HIIADarNQ%3D%3D"

xzwthu commented 1 week ago

2McXqSR8yaylC9ONZewBBh5MVN9Ew3oV5HIIADarNQ%3D%3D

The error remains when I try the token above. You can check the chat history in the accout.

snowby666 commented 1 week ago

I've seen my chat history and now i can't revert back to any model than gpt-4. It may a problem with the headers or some post request after sending message. Can you test with new account in versions 1.4.x to see if it returns correct model?

snowby666 commented 1 week ago

This is my ws_data when receiving response from bot. Its kinda strange when the author is still gpt3_5 not gpt-4.

image

snowby666 commented 1 week ago

For my other tokens, they're working normally

snowby666 commented 1 week ago

Can you provide me your headers when making request on poe.com for testing?

xzwthu commented 1 week ago

Can you provide me your headers when making request on poe.com for testing?

I just use the wrapper so I have no idea how to check my headers when I send. What should I do?

snowby666 commented 1 week ago

You can go to poe.com. Open DevTools > Network > Send a message > Look for gql_POST > check its headers

xzwthu commented 1 week ago

You can go to poe.com. Open DevTools > Network > Send a message > Look for gql_POST > check its headers

Here is the headers:

:authority:
poe.com
:method:
POST
:path:
/api/gql_POST
:scheme:
https
Accept:
*/*
Accept-Encoding:
gzip, deflate, br, zstd
Accept-Language:
zh-CN,zh;q=0.9
Content-Length:
200
Content-Type:
application/json
Cookie:
p-b=4TOdvEEvK6t4PpTktJo8Ng%3D%3D; _fbp=fb.1.1719185101769.461448079441337023; _gcl_au=1.1.1019039189.1719185102.1199219635.1719185109.1719185159; p-lat=L0bxpctkvGvk%2B8FxG0YUSPqSpoF9Sz2AaUPHl6zqzg%3D%3D; __cf_bm=f8_joXIFqUSVVc9kiUVAWAcPjFclVu3PawvGF7GdObw-1719280935-1.0.1.1-j6Ds5aLBthKEPauNqMQjChrO7bCaoWGdugQoTqTC3o41gkD9Mj1dBzCcRnl3TfVX5.xhvyFfIN1PQ5p_RDOJjQ; cf_clearance=jwgaEIpbE8KP3Errpin3O3Z246s3cIN1.H6805Ix5lo-1719280936-1.0.1.1-YBBMta_ISzVyiWZiZxBvaQIBsYAPgQTOSv1_NtrxHyW33ZVfifx0jhZ5i5jxCM_tO75u_aigZA8qL6FY0VoDiw; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Jun+25+2024+10%3A02%3A16+GMT%2B0800+(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false; OptanonAlertBoxClosed=2024-06-25T02:02:16.785Z
Origin:
https://poe.com
Poe-Formkey:
b16a4f105006a799ce57977a5e69ed00
Poe-Queryname:
regenerateMessageMutation
Poe-Tag-Id:
d23219c99cfa2349a4af4cdd0388209c
Poe-Tchannel:
poe-chan69-8888-kiuktwlnjwfobatqqdnq
Priority:
u=1, i
Referer:
https://poe.com/chat/3dt7prx914fey7z2vp8
Sec-Ch-Ua:
"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"
Sec-Ch-Ua-Mobile:
?0
Sec-Ch-Ua-Platform:
"Windows"
Sec-Fetch-Dest:
empty
Sec-Fetch-Mode:
cors
Sec-Fetch-Site:
same-origin
User-Agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36