-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6: Alexa tells when and why gpt is unavailable #18
base: main
Are you sure you want to change the base?
Conversation
chatgpt.reset_chat() | ||
# Uses the session_token to get a new bearer token | ||
chatgpt.refresh_session() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. Looking at the revChatGPT lib Chatbot class, we an see:
class Chatbot:
"""
Initializes the chatbot
See wiki for the configuration json:
https://github.com/acheong08/ChatGPT/wiki/Setup
:param config: The configuration json
:type config: :obj:`json`
:param conversation_id: The conversation ID
:type conversation_id: :obj:`str`, optional
:param parent_id: The parent ID
:type parent_id: :obj:`str`, optional
:param debug: Whether to enable debug mode
:type debug: :obj:`bool`, optional
:param refresh: Whether to refresh the session
:type refresh: :obj:`bool`, optional
:return: None or Exception
"""
(...)
def __init__(self, config, conversation_id=None, parent_id=None, debug=False, refresh=True) -> Exception:
(...)
This is automatically part of the instantiation of the class. So I guess not needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, but looks good 👍
if chat_response: | ||
logger.info("ChatGPT says: " + chat_response) | ||
return chat_response | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Else redundant
Removed default value from response error message fetching Co-authored-by: Malachi Soord <[email protected]>
Using f string instead of string concat Co-authored-by: Malachi Soord <[email protected]>
Trying to handle better possible errors coming from both the ChatGPT service as well as operational errors of the library we are using to communicate with it.