From be40b2accd15eca9da337b11177eceb8d08bf5b7 Mon Sep 17 00:00:00 2001 From: fluzzi Date: Mon, 31 Jul 2023 12:18:10 -0300 Subject: [PATCH] bug fix chat history in ai --- connpy/_version.py | 2 +- connpy/connapp.py | 10 +++++++--- docs/connpy/index.html | 10 +++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/connpy/_version.py b/connpy/_version.py index 55280a7..e1d7395 100644 --- a/connpy/_version.py +++ b/connpy/_version.py @@ -1,2 +1,2 @@ -__version__ = "3.3.0" +__version__ = "3.3.1" diff --git a/connpy/connapp.py b/connpy/connapp.py index 414b77f..634822a 100755 --- a/connpy/connapp.py +++ b/connpy/connapp.py @@ -598,9 +598,13 @@ class connapp: def _process_input(self, input, history): response = self.myai.ask(input , chat_history = history, dryrun = True) if not response["app_related"]: - if not history: - history = [] - history.extend(response["chat_history"]) + try: + if not history: + history = [] + history.extend(response["chat_history"]) + except: + if not history: + history = None return response["response"], history else: history = None diff --git a/docs/connpy/index.html b/docs/connpy/index.html index deb1ed5..5a3b2bd 100644 --- a/docs/connpy/index.html +++ b/docs/connpy/index.html @@ -2379,9 +2379,13 @@ Categorize the user's request based on the operation they want to perform on def _process_input(self, input, history): response = self.myai.ask(input , chat_history = history, dryrun = True) if not response["app_related"]: - if not history: - history = [] - history.extend(response["chat_history"]) + try: + if not history: + history = [] + history.extend(response["chat_history"]) + except: + if not history: + history = None return response["response"], history else: history = None