Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit 1742acd

Browse files
committed
add basic support for df messenger chips
1 parent c8a8d2d commit 1742acd

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

flask_assistant/response/base.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,14 @@ def suggest(self, *replies):
134134
for r in replies:
135135
chips.append({"title": r})
136136

137-
# NOTE: both of these formats work in the dialogflow console,
138-
# but only the first (suggestions) appears in actual Google Assistant
139-
140137
# native chips for GA
141138
self._messages.append(
142139
{"platform": "ACTIONS_ON_GOOGLE", "suggestions": {"suggestions": chips}}
143140
)
144141

145-
# # quick replies for other platforms
146-
# self._messages.append(
147-
# {
148-
# "platform": "ACTIONS_ON_GOOGLE",
149-
# "quickReplies": {"title": None, "quickReplies": replies},
150-
# }
151-
# )
142+
if "DIALOGFLOW_MESSENGER" in self._integrations:
143+
chip_resp = df_messenger._build_suggestions(*replies)
144+
self._platform_messages["DIALOGFLOW_MESSENGER"].append(chip_resp)
152145

153146
return self
154147

flask_assistant/response/df_messenger.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,11 @@ def _build_list(title, items):
4646
list_responses.append(item)
4747

4848
return list_responses
49+
50+
51+
def _build_suggestions(*replies):
52+
chips = {"type": "chips", "options": []}
53+
for i in replies:
54+
chips["options"].append({"text": i})
55+
56+
return chips

0 commit comments

Comments
 (0)