getAIOptions method
List<CometChatMessageComposerAction>
getAIOptions(
- User? user,
- Group? group,
- CometChatTheme theme,
- BuildContext context,
- Map<
String, dynamic> ? id, - AIOptionsStyle? aiOptionStyle,
override
override this to alter attachment options in CometChatMessageComposer
Implementation
@override
List<CometChatMessageComposerAction> getAIOptions(
User? user,
Group? group,
CometChatTheme theme,
BuildContext context,
Map<String, dynamic>? id,
AIOptionsStyle? aiOptionStyle) {
List<CometChatMessageComposerAction> actionList =
super.getAIOptions(user, group, theme, context, id, aiOptionStyle);
if (!(id?.containsKey(IDMapConstants.parentMessageId) ?? false)) {
if (aiBots.isNotEmpty) {
receiverUser = user;
receiverGroup = group;
CometChatMessageComposerAction action = CometChatMessageComposerAction(
id: getId(),
title: aiBots.length == 1
? " ${Translations.of(context).ask} ${aiBots[0].name} ${Translations.of(context).bot}"
: Translations.of(context).askBot,
onItemClick:
(BuildContext context, User? user, Group? group) async {
if (aiBots.length > 1) {
showCometChatAiOptionSheet(
context: context,
theme: theme,
user: user,
group: group,
actionItems: createBotActions());
} else {
showAssistBot(context, aiBots[0], user, group);
}
});
actionList.add(action);
}
}
return actionList;
}