summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/not_working/Bestim.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-03-12 02:06:06 +0100
committerGitHub <noreply@github.com>2024-03-12 02:06:06 +0100
commit6ef282de3a3245acbfecd08ae48dba85ff91d031 (patch)
tree0236c9678eea8f9c78ed7c09f3d86eaf3d7c691c /g4f/Provider/not_working/Bestim.py
parentUpdate .gitignore (diff)
downloadgpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.gz
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.bz2
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.lz
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.xz
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.zst
gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/not_working/Bestim.py (renamed from g4f/Provider/Bestim.py)112
1 files changed, 56 insertions, 56 deletions
diff --git a/g4f/Provider/Bestim.py b/g4f/Provider/not_working/Bestim.py
index 323bd713..94a4d32b 100644
--- a/g4f/Provider/Bestim.py
+++ b/g4f/Provider/not_working/Bestim.py
@@ -1,56 +1,56 @@
-from __future__ import annotations
-
-from ..typing import Messages
-from .base_provider import BaseProvider, CreateResult
-from ..requests import get_session_from_browser
-from uuid import uuid4
-
-class Bestim(BaseProvider):
- url = "https://chatgpt.bestim.org"
- supports_gpt_35_turbo = True
- supports_message_history = True
- working = False
- supports_stream = True
-
- @classmethod
- def create_completion(
- cls,
- model: str,
- messages: Messages,
- stream: bool,
- proxy: str = None,
- **kwargs
- ) -> CreateResult:
- session = get_session_from_browser(cls.url, proxy=proxy)
- headers = {
- 'Accept': 'application/json, text/event-stream',
- }
- data = {
- "messagesHistory": [{
- "id": str(uuid4()),
- "content": m["content"],
- "from": "you" if m["role"] == "user" else "bot"
- } for m in messages],
- "type": "chat",
- }
- response = session.post(
- url="https://chatgpt.bestim.org/chat/send2/",
- json=data,
- headers=headers,
- stream=True
- )
- response.raise_for_status()
- for line in response.iter_lines():
- if not line.startswith(b"event: trylimit"):
- yield line.decode().removeprefix("data: ")
-
-
-
-
-
-
-
-
-
-
-
+from __future__ import annotations
+
+from ...typing import Messages
+from ..base_provider import BaseProvider, CreateResult
+from ...requests import get_session_from_browser
+from uuid import uuid4
+
+class Bestim(BaseProvider):
+ url = "https://chatgpt.bestim.org"
+ working = False
+ supports_gpt_35_turbo = True
+ supports_message_history = True
+ supports_stream = True
+
+ @classmethod
+ def create_completion(
+ cls,
+ model: str,
+ messages: Messages,
+ stream: bool,
+ proxy: str = None,
+ **kwargs
+ ) -> CreateResult:
+ session = get_session_from_browser(cls.url, proxy=proxy)
+ headers = {
+ 'Accept': 'application/json, text/event-stream',
+ }
+ data = {
+ "messagesHistory": [{
+ "id": str(uuid4()),
+ "content": m["content"],
+ "from": "you" if m["role"] == "user" else "bot"
+ } for m in messages],
+ "type": "chat",
+ }
+ response = session.post(
+ url="https://chatgpt.bestim.org/chat/send2/",
+ json=data,
+ headers=headers,
+ stream=True
+ )
+ response.raise_for_status()
+ for line in response.iter_lines():
+ if not line.startswith(b"event: trylimit"):
+ yield line.decode().removeprefix("data: ")
+
+
+
+
+
+
+
+
+
+
+