Skip to content

Commit

Permalink
Add overload exception
Browse files Browse the repository at this point in the history
  • Loading branch information
TheExplainthis committed Mar 20, 2023
1 parent 63fcb64 commit 8cd034e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def handle_text_message(event):
memory.remove(user_id)
if str(e).startswith('Incorrect API key provided'):
msg = TextSendMessage(text='OpenAI API Token 有誤,請重新註冊。')
elif str(e).startswith('That model is currently overloaded with other requests.'):
msg = TextSendMessage(text='已超過負荷,請稍後再試')
else:
msg = TextSendMessage(text=str(e))
line_bot_api.reply_message(event.reply_token, msg)
Expand Down

0 comments on commit 8cd034e

Please sign in to comment.