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
957 stars 113 forks source link

[Feature]: OpenAI api supports NextChat #169

Closed Luo-hongyi closed 5 months ago

Luo-hongyi commented 5 months ago

NextChat use OPTIONS but not POST:

127.0.0.1:65392 - - [23/Jun/2024:00:30:40] "OPTIONS /v1/chat/completions" 405 31

snowby666 commented 5 months ago

I've added this in v1.5.7

Luo-hongyi commented 5 months ago

Still doesn't work:

127.0.0.1:56781 - - [23/Jun/2024:22:49:45] "OPTIONS /v1/chat/completions" 422 82

snowby666 commented 5 months ago

can i see your data request?

snowby666 commented 5 months ago

This is my test: image

snowby666 commented 5 months ago

Your response status is 422 so the request data format may be error:

Example Correct:

{
    "stream": true,
    "model": "gpt-3.5-turbo",
    "messages": [
                     {"role": "system", "content": "You are a helpful assistant."},
                     {"role": "user", "content": "Who won the world series in 2020?"}
         ]
}

Invalid:

{
    "stream": true,
    "model": "gpt-3.5-turbo",
    "messages": [
                     {"role": "system", "content": "You are a helpful assistant."},
                     {"role": "user", "content": "Who won the world series in 2020?"},
         ]
}
Luo-hongyi commented 5 months ago

CORS error

/#/:1 Access to fetch at 'http://127.0.0.1:8000/v1/chat/completions' from origin 'https://app.nextchat.dev' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
snowby666 commented 5 months ago

I've updated new version with cors added

Luo-hongyi commented 5 months ago

It works, thank you!

Luo-hongyi commented 5 months ago

image

Each API call generated a new conversation in Poe. Is there any possibility of improvement?

snowby666 commented 5 months ago

For now u can do this instead: image

I'll add custom config in next version