summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Wewordle.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider/Wewordle.py')
-rw-r--r--g4f/Provider/Wewordle.py15
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: