Strip trailing and leading newlines from Bing Chatbot answers
This commit is contained in:
parent
e4f0e17347
commit
dcb724f902
1 changed files with 2 additions and 1 deletions
|
@ -25,8 +25,9 @@ class Message:
|
|||
def from_api(cls, api_msg: dict):
|
||||
'''Create a Message object from API format'''
|
||||
assert type(api_msg) == dict
|
||||
text = api_msg["item"]["messages"][1]["adaptiveCards"][0]["body"][0]["text"].strip("\n")
|
||||
return cls(
|
||||
api_msg["item"]["messages"][1]["adaptiveCards"][0]["body"][0]["text"],
|
||||
text,
|
||||
_role=_Roles.ASSISTANT)
|
||||
|
||||
def to_api(self):
|
||||
|
|
Reference in a new issue