diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2023-08-25 18:22:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 18:22:38 +0200 |
commit | b2baf46e3cb2ad27d666217bb14c54d89fbb8c66 (patch) | |
tree | 60052aad3746053eb4aec5b7e44d75404f4d11fe /g4f/Provider/Wewordle.py | |
parent | ~ | Merge pull request #841 (diff) | |
parent | Merge branch 'main' into up (diff) | |
download | gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.gz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.bz2 gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.lz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.xz gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.tar.zst gpt4free-b2baf46e3cb2ad27d666217bb14c54d89fbb8c66.zip |
Diffstat (limited to 'g4f/Provider/Wewordle.py')
-rw-r--r-- | g4f/Provider/Wewordle.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/g4f/Provider/Wewordle.py b/g4f/Provider/Wewordle.py index f7f47ee0..8e106716 100644 --- a/g4f/Provider/Wewordle.py +++ b/g4f/Provider/Wewordle.py @@ -10,22 +10,18 @@ from .base_provider import BaseProvider class Wewordle(BaseProvider): - url = "https://wewordle.org/gptapi/v1/android/turbo" + url = "https://wewordle.org/" working = True supports_gpt_35_turbo = True - @staticmethod + @classmethod def create_completion( + cls, model: str, messages: list[dict[str, str]], stream: bool, **kwargs: Any, ) -> CreateResult: - base = "" - - for message in messages: - base += "%s: %s\n" % (message["role"], message["content"]) - base += "assistant:" # randomize user id and app id _user_id = "".join( random.choices(f"{string.ascii_lowercase}{string.digits}", k=16) @@ -45,7 +41,7 @@ class Wewordle(BaseProvider): } data: dict[str, Any] = { "user": _user_id, - "messages": [{"role": "user", "content": base}], + "messages": messages, "subscriber": { "originalPurchaseDate": None, "originalApplicationVersion": None, @@ -67,8 +63,7 @@ class Wewordle(BaseProvider): }, } - url = "https://wewordle.org/gptapi/v1/android/turbo" - response = requests.post(url, headers=headers, data=json.dumps(data)) + response = requests.post(f"{cls.url}gptapi/v1/android/turbo", headers=headers, data=json.dumps(data)) response.raise_for_status() _json = response.json() if "message" in _json: |