Skip to content

Commit d4d1651

Browse files
committed
feat: Add AsyncLEO class for asynchronous API calls
fix: Remove deprecated init.py file patch: Update get_message function to handle responses directly
1 parent 41831e3 commit d4d1651

File tree

10 files changed

+12
-959
lines changed

10 files changed

+12
-959
lines changed

requirements.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
requests[socks]>=2.31.0
2-
click==8.1.3
1+
requests[socks]>=2.32.3
2+
click==8.1.7
33
rich==13.3.4
44
clipman==3.1.0
55
pyperclip==1.8.2
66
appdirs==1.4.4
7-
webchatgpt==0.3.0
8-
GoogleBard1>=2.1.4
97
colorama==0.4.6
10-
g4f>=0.2.6.1
8+
g4f>=0.3.3.3
119
pyyaml==6.0.1
1210
matplotlib
1311
gpt4all==2.2.0
14-
poe-api-wrapper==1.3.6
12+
poe-api-wrapper==1.7.0
1513
python-dotenv==1.0.0
1614
brotli==1.1.0
17-
Helpingai_T2-fork==0.3.2
15+
Helpingai_T2-fork>=0.3.2
1816
fastapi[all]==0.115.4
1917
python-vlc>=3.0.20
20-
httpx==0.27.2
18+
httpx>=0.27.2
2119
prompt-toolkit==3.0.48

setup.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@
66

77

88
INSTALL_REQUIRE = [
9-
"requests[socks]>=2.31.0",
9+
"requests[socks]>=2.32.3",
1010
"appdirs==1.4.4",
1111
"pyyaml==6.0.1",
12-
"webchatgpt==0.3.0",
13-
"GoogleBard1>=2.1.4",
14-
"poe-api-wrapper==1.3.6",
12+
"poe-api-wrapper==1.7.0",
1513
"brotli==1.1.0",
16-
"g4f>=0.2.6.1",
17-
"Helpingai_T2-fork==0.3.2",
14+
"g4f>=0.3.3.3",
15+
"Helpingai_T2-fork>=0.3.2",
1816
"python-vlc>=3.0.20",
1917
"httpx==0.27.2",
2018
]
2119

2220
cli_reqs = [
23-
"click==8.1.3",
21+
"click==8.1.7",
2422
"rich==13.3.4",
2523
"clipman==3.1.0",
2624
"pyperclip==1.8.2",
2725
"colorama==0.4.6",
28-
"g4f>=0.2.6.1",
2926
"python-dotenv==1.0.0",
3027
"prompt-toolkit==3.0.48",
3128
]
@@ -45,7 +42,7 @@
4542
"termux-all": termux + cli_reqs + api,
4643
"cli": cli_reqs,
4744
"api": api,
48-
"all": ["g4f[all]>=0.2.6.1", "matplotlib", "gpt4all==2.2.0"] + cli_reqs + api,
45+
"all": ["g4f[all]>=0.3.3.3", "matplotlib", "gpt4all==2.2.0"] + cli_reqs + api,
4946
}
5047

5148
DOCS_PATH = Path(__file__).parents[0] / "docs/README.md"

src/pytgpt/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212

1313
tgpt_providers = [
1414
"auto",
15-
"leo",
1615
"openai",
1716
"opengpt",
1817
"koboldai",
19-
"gemini",
2018
"phind",
2119
"llama2",
2220
"blackboxai",
2321
"gpt4all",
24-
"webchatgpt",
2522
"g4fauto",
2623
"poe",
2724
"groq",

src/pytgpt/console.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
from pytgpt.utils import Audio
4040
from pytgpt.utils import suggest_query
4141

42-
from WebChatGPT.console import chat as webchatgpt
43-
4442
# colorama
4543
from colorama import Fore
4644
from colorama import init as init_colorama
@@ -484,26 +482,6 @@ def __init__(
484482
"Consider running 'pytgpt gpt4free test -y' first"
485483
)
486484

487-
elif provider == "leo":
488-
import pytgpt.leo as leo
489-
490-
self.bot = leo.LEO(
491-
is_conversation=disable_conversation,
492-
max_tokens=max_tokens,
493-
temperature=temperature,
494-
top_k=top_k,
495-
top_p=top_p,
496-
model=getOr(model, leo.main.model),
497-
brave_key=getOr(auth, leo.main.key),
498-
timeout=timeout,
499-
intro=intro,
500-
filepath=filepath,
501-
update_file=update_file,
502-
proxies=proxies,
503-
history_offset=history_offset,
504-
act=awesome_prompt,
505-
)
506-
507485
elif provider == "openai":
508486
assert auth, (
509487
"OpenAI's API-key is required. " "Use the flag `--key` or `-k`"
@@ -560,19 +538,6 @@ def __init__(
560538
act=awesome_prompt,
561539
)
562540

563-
elif provider == "gemini":
564-
from pytgpt.gemini import GEMINI
565-
566-
assert auth, (
567-
"Path to gemini.google.com.cookies.json file is required. "
568-
"Use the flag `--key` or `-k`"
569-
)
570-
self.bot = GEMINI(
571-
cookie_file=auth,
572-
proxy=proxies,
573-
timeout=timeout,
574-
)
575-
576541
elif provider == "phind":
577542
import pytgpt.phind.main as phind
578543

@@ -670,35 +635,6 @@ def __init__(
670635
act=awesome_prompt,
671636
)
672637

673-
elif provider == "webchatgpt":
674-
assert auth, (
675-
"Path to `chat.openai.cookies.com.json` is required. "
676-
"Use the flag `--key` or `-k`"
677-
)
678-
679-
from pytgpt.webchatgpt import main
680-
681-
self.bot = main.WEBCHATGPT(
682-
cookie_file=auth,
683-
model=getOr(model, main.default_model),
684-
proxy=proxies,
685-
timeout=timeout,
686-
filepath=filepath,
687-
update_file=update_file,
688-
intro=intro,
689-
act=awesome_prompt,
690-
)
691-
intro_response = self.bot.chat(self.bot.conversation.intro, stream=True)
692-
if not quiet:
693-
this.stream_output(
694-
intro_response,
695-
title="Intro Response",
696-
is_markdown=True,
697-
style=Style(
698-
color="cyan",
699-
),
700-
)
701-
702638
elif provider == "poe":
703639
assert auth, (
704640
"Path to poe.com.cookies.json file or 'p-b' cookie-value is required. "
@@ -2754,10 +2690,6 @@ def clear(content: str, yes: bool):
27542690

27552691
def make_commands():
27562692
"""Make pytgpt chained commands"""
2757-
# webchatgpt
2758-
# Intergration with WebChatGPT https://github.com/Simatwa/WebChatGPT
2759-
EntryGroup.tgpt2_.add_command(webchatgpt, "webchatgpt")
2760-
27612693
# generate
27622694
EntryGroup.tgpt2_.add_command(ChatGenerate.generate)
27632695

src/pytgpt/gemini/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/pytgpt/gemini/main.py

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)