Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Fix various bard related bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Simatwa committed Jan 16, 2024
1 parent 6726a36 commit 4afc775
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion GPTCLI/__init__.py
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
8 changes: 5 additions & 3 deletions GPTCLI/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'")

Expand Down
3 changes: 2 additions & 1 deletion GPTCLI/bard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 = ""
self.active_link.async_chatbot.choice_id = ""
24 changes: 11 additions & 13 deletions GPTCLI/gptcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,15 @@ 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"""
self.bcolor_dict[line.lower()]
args.background_color = line.lower()
self.apply_color()
self.do__prompt(self.prompt_disp)

@error_handler()
def do__save(self, line):
if gpt4:
Expand All @@ -833,46 +833,44 @@ 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:
chatbot.load(join_list(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):
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">gpt-cli</h1>
<p align="center">
<a href="https://github.com/Simatwa/gpt-cli"><img src="https://img.shields.io/static/v1?logo=Github&label=Github&message=Passing&color=lime" alt="Gihtub"/></a>
<a href="https://pypi.org/project/chatgpt4-cli/"><img src="https://img.shields.io/static/v1?label=Pypi&message=v1.5.8&color=green&logo=pypi" alt="Pypi"/>
<a href="https://pypi.org/project/chatgpt4-cli/"><img src="https://img.shields.io/static/v1?label=Pypi&message=v1.5.9&color=green&logo=pypi" alt="Pypi"/>
<a href="https://wakatime.com/badge/github/Simatwa/gpt-cli"><img src="https://wakatime.com/badge/github/Simatwa/gpt-cli.svg" alt="wakatime"/></a>
<a href="#"><img src="https://img.shields.io/static/v1?label=License&message=MIT&color=green&logo=MIT" alt="license"/></a>
<a href="#"><img src="https://img.shields.io/static/v1?label=Development&message=Beta&color=Orange&logo=progress" alt="Progress"/></a>
Expand Down
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kbd>reset</kbd> action* : *bard*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit 4afc775

Please sign in to comment.