python: Only eval latest message in chat sessions (#1149)

* python: Only eval latest message in chat sessions

* python: version bump
This commit is contained in:
Aaron Miller
2023-07-06 18:02:14 -07:00
committed by GitHub
parent ee73f1ab1d
commit ed470e18b3
2 changed files with 2 additions and 2 deletions

View File

@@ -220,7 +220,7 @@ class GPT4All:
if self._is_chat_session_activated:
self.current_chat_session.append({"role": "user", "content": prompt})
generate_kwargs['prompt'] = self._format_chat_prompt_template(messages=self.current_chat_session)
generate_kwargs['prompt'] = self._format_chat_prompt_template(messages=self.current_chat_session[-1:])
generate_kwargs['reset_context'] = len(self.current_chat_session) == 1
else:
generate_kwargs['reset_context'] = True