Output the returned answer from ai to log

This commit is contained in:
OK 2023-04-12 20:18:14 +02:00
parent 6b70292040
commit 7c029038f6

View File

@ -176,6 +176,7 @@ class AIResponder(object):
answer = result['choices'][0]['message'] answer = result['choices'][0]['message']
if type(answer) != dict: if type(answer) != dict:
answer = answer.to_dict() answer = answer.to_dict()
logging.info(f"generated response: {repr(answer)}")
return answer, limit return answer, limit
except openai.error.InvalidRequestError as err: except openai.error.InvalidRequestError as err:
if 'maximum context length is' in str(err) and limit > 4: if 'maximum context length is' in str(err) and limit > 4: