<commit_before>require! {
	'../../../models/user': User
	'../../../models/talk-message': TalkMessage
	'../../../models/talk-history': TalkHistory
	'../../../models/utils/get-talk-history-messages'
}

module.exports = (req, res) ->
	get-talk-history-messages req.me.id .then (messages) ->
		if messages? and messages.length > 0message
			promises = messages |> map (message) -> new Promise (resolve, reject) ->
				User.find-by-id message.otherparty-id, (, otherparty) ->
					message .= to-object!
					message.user = otherparty
					resolve message
			Promise.all promises .then (serialized-messages) ->
				serialized-messages .= reverse!
				done serialized-messages
		else
			done null

	function done(messages)<commit_msg>Fix bug<commit_after>require! {
	'../../../models/user': User
	'../../../models/talk-message': TalkMessage
	'../../../models/talk-history': TalkHistory
	'../../../models/utils/get-talk-history-messages'
}

module.exports = (req, res) ->
	get-talk-history-messages req.me.id .then (messages) ->
		if messages? and messages.length > 0message
			promises = messages |> map (message) -> new Promise (resolve, reject) ->
				message .= to-object!
				if message.otherparty-id.to-string! == req.me.id.to-string!
					User.find-by-id message.user-id, (, otherparty) ->
						message.user = otherparty
						resolve message
				else
					User.find-by-id message.otherparty-id, (, otherparty) ->
						message.user = otherparty
						resolve message
			Promise.all promises .then (serialized-messages) ->
				serialized-messages .= reverse!
				done serialized-messages
		else
			done null

	function done(messages)
{'fraction_non_alphanumeric': 0.1696264543784446, 'fraction_numerical': 0.001224739742804654, 'mean_word_length': 2.7736720554272516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '956295', 'n_tokens_mistral': 581, 'n_tokens_neox': 492, 'n_words': 111}