summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/Opchatgpts.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-18 04:38:31 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-18 04:38:31 +0100
commitcadc507fad2fee59b23d1d8e73c472c077f468fc (patch)
tree42b1c0c0ccf5e3aa7a843a3766d4d19b6a7ade8e /g4f/Provider/Opchatgpts.py
parentImprove providers (diff)
downloadgpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar.gz
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar.bz2
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar.lz
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar.xz
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.tar.zst
gpt4free-cadc507fad2fee59b23d1d8e73c472c077f468fc.zip
Diffstat (limited to 'g4f/Provider/Opchatgpts.py')
-rw-r--r--g4f/Provider/Opchatgpts.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/g4f/Provider/Opchatgpts.py b/g4f/Provider/Opchatgpts.py
index c77acb22..8abdf39b 100644
--- a/g4f/Provider/Opchatgpts.py
+++ b/g4f/Provider/Opchatgpts.py
@@ -5,7 +5,7 @@ from aiohttp import ClientSession
from ..typing import Messages, AsyncResult
from .base_provider import AsyncGeneratorProvider
-
+from .helper import get_random_string
class Opchatgpts(AsyncGeneratorProvider):
url = "https://opchatgpts.net"
@@ -36,7 +36,7 @@ class Opchatgpts(AsyncGeneratorProvider):
) as session:
data = {
"botId": "default",
- "chatId": random_string(),
+ "chatId": get_random_string(),
"contextId": 28,
"customId": None,
"messages": messages,
@@ -68,7 +68,4 @@ class Opchatgpts(AsyncGeneratorProvider):
("proxy", "str"),
]
param = ", ".join([": ".join(p) for p in params])
- return f"g4f.provider.{cls.__name__} supports: ({param})"
-
-def random_string(length: int = 10):
- return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) \ No newline at end of file
+ return f"g4f.provider.{cls.__name__} supports: ({param})" \ No newline at end of file