Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 5ead746

Browse files
Add support for ML Kit's Smart Reply feature #1219
1 parent aaa0d38 commit 5ead746

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/mlkit/smartreply/index.ios.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ export function suggestReplies(options: MLKitSmartReplySuggestRepliesOptions): P
55
try {
66
const naturalLanguage = FIRNaturalLanguage.naturalLanguage();
77
const smartReply = naturalLanguage.smartReply();
8-
const conversation: Array<FIRTextMessage> = [];
9-
options.conversation.forEach(m => conversation.push(new FIRTextMessage({
10-
text: m.text,
11-
isLocalUser: m.localUser,
12-
timestamp: m.timestamp,
13-
userID: m.userId
14-
})));
8+
const conversation: NSMutableArray<FIRTextMessage> = NSMutableArray.new();
9+
10+
options.conversation.forEach(m => conversation.addObject(
11+
FIRTextMessage.alloc().initWithTextTimestampUserIDIsLocalUser(m.text, m.timestamp, m.userId, m.localUser)
12+
));
1513

1614
smartReply.suggestRepliesForMessagesCompletion(conversation, (result: FIRSmartReplySuggestionResult, error: NSError) => {
1715
if (error) {

0 commit comments

Comments
 (0)