23593222t commited on
Commit
2213246
1 Parent(s): 7e858de

Trim remaining characters

Browse files
Files changed (1) hide show
  1. you/__init__.py +3 -2
you/__init__.py CHANGED
@@ -64,7 +64,8 @@ class Completion:
64
  text = response.text.split('}]}\n\nevent: youChatToken\ndata: {"youChatToken": "')[-1]
65
  text = text.replace('"}\n\nevent: youChatToken\ndata: {"youChatToken": "', '')
66
  text = text.replace('event: done\ndata: I\'m Mr. Meeseeks. Look at me.\n\n', '')
67
-
 
68
  extra = {
69
  'youChatSerpResults' : loads(youChatSerpResults),
70
  #'slots' : loads(slots)
@@ -74,4 +75,4 @@ class Completion:
74
  'response': text,
75
  'links' : loads(thirdPartySearchResults)['search']["third_party_search_results"] if includelinks else None,
76
  'extra' : extra if detailed else None,
77
- }
 
64
  text = response.text.split('}]}\n\nevent: youChatToken\ndata: {"youChatToken": "')[-1]
65
  text = text.replace('"}\n\nevent: youChatToken\ndata: {"youChatToken": "', '')
66
  text = text.replace('event: done\ndata: I\'m Mr. Meeseeks. Look at me.\n\n', '')
67
+ text = text[:-4] # trims '"}', along with the last two remaining newlines
68
+
69
  extra = {
70
  'youChatSerpResults' : loads(youChatSerpResults),
71
  #'slots' : loads(slots)
 
75
  'response': text,
76
  'links' : loads(thirdPartySearchResults)['search']["third_party_search_results"] if includelinks else None,
77
  'extra' : extra if detailed else None,
78
+ }