From 4afc77521efbf02664c7a31e62ef665984cc6afb Mon Sep 17 00:00:00 2001 From: Simatwa Date: Wed, 17 Jan 2024 01:25:19 +0300 Subject: [PATCH] Fix various bard related bugs --- GPTCLI/__init__.py | 2 +- GPTCLI/addons.py | 8 +++++--- GPTCLI/bard.py | 3 ++- GPTCLI/gptcli.py | 24 +++++++++++------------- README.md | 2 +- docs/CHANGELOG.md | 7 +++++++ setup.py | 2 +- 7 files changed, 28 insertions(+), 20 deletions(-) diff --git a/GPTCLI/__init__.py b/GPTCLI/__init__.py index 0b1a775..fdc7392 100644 --- a/GPTCLI/__init__.py +++ b/GPTCLI/__init__.py @@ -1,4 +1,4 @@ -__version__ = "1.5.8" +__version__ = "1.5.9" __author__ = "Smartwa Caleb" __repo__ = "https://github.com/Simatwa/gpt-cli" __info__ = "Interact with ChatGPT and Bard at the terminal." diff --git a/GPTCLI/addons.py b/GPTCLI/addons.py index 45c4e24..2d4cd32 100644 --- a/GPTCLI/addons.py +++ b/GPTCLI/addons.py @@ -228,10 +228,12 @@ def main(self) -> None: self.pdf.set_x((210 - self.pdf.get_string_width(__repo__)) / 2) self.pdf.cell(0, 10, __repo__) self.pdf.ln() - self.pdf.set_font('Symbol',size=8) - time_stamp = f'Lastly auto-edited : {datetime.today().strftime("%d-%b-%Y %H:%M:%S %s")}' + self.pdf.set_font("Symbol", size=8) + time_stamp = ( + f'Lastly auto-edited : {datetime.today().strftime("%d-%b-%Y %H:%M:%S %s")}' + ) self.pdf.set_x((210 - self.pdf.get_string_width(time_stamp)) / 2) - self.pdf.cell(0,10,time_stamp) + self.pdf.cell(0, 10, time_stamp) self.pdf.output("all-acts.pdf") logging.info("Contents saved to 'all-acts.pdf'") diff --git a/GPTCLI/bard.py b/GPTCLI/bard.py index 450d5ce..1bbcf98 100644 --- a/GPTCLI/bard.py +++ b/GPTCLI/bard.py @@ -5,6 +5,7 @@ from json import load from time import sleep +logging.getLogger("httpx").setLevel(logging.ERROR) class Bard: def __init__(self, args: object): @@ -60,4 +61,4 @@ def chat(self, prompt: str, stream: bool = True) -> str: def reset(self): self.active_link.async_chatbot.conversation_id = "" self.active_link.async_chatbot.response_id = "" - self.active_link.async_chatbot.choice_id = "" \ No newline at end of file + self.active_link.async_chatbot.choice_id = "" diff --git a/GPTCLI/gptcli.py b/GPTCLI/gptcli.py index 32daac9..bfe11bc 100755 --- a/GPTCLI/gptcli.py +++ b/GPTCLI/gptcli.py @@ -810,7 +810,7 @@ def do__font_color(self, line): else: self.apply_color() self.do__prompt(self.prompt_disp) - + @error_handler() def do__background_color(self, line): """Sets background-color""" @@ -818,7 +818,7 @@ def do__background_color(self, line): args.background_color = line.lower() self.apply_color() self.do__prompt(self.prompt_disp) - + @error_handler() def do__save(self, line): if gpt4: @@ -833,12 +833,12 @@ def do__save(self, line): "presence_penalty", "frequency_penalty", "reply_count", - ) + ) chatbot.save(join_list(line), *all) else: chatbot.save_conversation(join_list(line)) self.do__prompt(self.prompt_disp) - + @error_handler() def do__load(self, line): if gpt4: @@ -846,33 +846,31 @@ def do__load(self, line): else: chatbot.load_conversation(join_list(line)) self.do__prompt(self.prompt_disp) - + @error_handler() def do__rollback(self, line): if line.isdigit(): chatbot.rollback(int(line)) self.do__prompt(self.prompt_disp) - + @error_handler() def do__reset(self, line): - if any([args.bard,'--bard' in line]) and not '--gpt4' in line: + if any([args.bard, "--bard" in line]) and not "--gpt4" in line: self.bard.reset() - chat_gpt = 'Bard' + chat_gpt = "Bard" else: if gpt4: chatbot.reset(system_prompt=args.system_prompt) else: chatbot.reset() - chat_gpt = 'GPT' - logging.info(f'Chat reset successfully - {chat_gpt}') + chat_gpt = "GPT" + logging.info(f"Chat reset successfully - {chat_gpt}") self.do__prompt(self.prompt_disp) def do__help(self, line): from .helper import help - rich_print( - Panel(Markdown(help),title='Help Info') - ) + rich_print(Panel(Markdown(help), title="Help Info")) self.do__prompt(self.prompt_disp) def do__exit(self, line): diff --git a/README.md b/README.md index a4acbdc..92b4275 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

gpt-cli

Gihtub -Pypi +Pypi wakatime license Progress diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 199dc5e..2ba2b22 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -52,3 +52,10 @@ ## v1.5.8 - Bard request error fixed + +## v1.5.9 + +**What's new?** + +- Bug fixed - *low `httpx` logging level* : *bard* +- Bug fixed - *malfunctioning reset action* : *bard* diff --git a/setup.py b/setup.py index 4c32469..1087a15 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup -__version__ = "1.5.8" +__version__ = "1.5.9" __author__ = "Smartwa Caleb" __repo__ = "https://github.com/Simatwa/gpt-cli" __info__ = "Interact with ChatGPT and Bard at the terminal."