-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from busunkim96/use-google-cloud-dialogflow
Use dialogflow types from 'google-cloud-dialogflow' package
- Loading branch information
Showing
5 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import dialogflow_v2beta1 as df | ||
from google.cloud import dialogflow_v2 as df | ||
from google.protobuf.json_format import MessageToDict | ||
|
||
|
||
def build_card( | ||
text, title, img_url=None, img_alt=None, subtitle=None, link=None, link_title=None, | ||
): | ||
|
||
button = df.types.intent_pb2.Intent.Message.Card.Button( | ||
button = df.Intent.Message.Card.Button( | ||
text=link_title, postback=link | ||
) | ||
card = df.types.intent_pb2.Intent.Message.Card(title=title, subtitle=text) | ||
card = df.Intent.Message.Card(title=title, subtitle=text) | ||
card.buttons.append(button) | ||
payload = MessageToDict(card) | ||
payload = df.Intent.Message.Card.to_dict(card) | ||
return {"card": payload, "lang": "en"} | ||
# card_payload = {"card": {"title": title, "subtitle": text, "formattedText": text}} | ||
# return card_payload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters