-
Notifications
You must be signed in to change notification settings - Fork 556
/
Copy pathlex.go
81 lines (69 loc) · 3.45 KB
/
lex.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package events
type LexEvent struct {
MessageVersion string `json:"messageVersion,omitempty"`
InvocationSource string `json:"invocationSource,omitempty"`
UserID string `json:"userId,omitempty"`
InputTranscript string `json:"inputTranscript,omitempty"`
SessionAttributes SessionAttributes `json:"sessionAttributes,omitempty"`
RequestAttributes map[string]string `json:"requestAttributes,omitempty"`
Bot *LexBot `json:"bot,omitempty"`
OutputDialogMode string `json:"outputDialogMode,omitempty"`
CurrentIntent *LexCurrentIntent `json:"currentIntent,omitempty"`
AlternativeIntents []LexAlternativeIntents `json:"alternativeIntents,omitempty"`
// Deprecated: the DialogAction field is never populated by Lex events
DialogAction *LexDialogAction `json:"dialogAction,omitempty"`
}
type LexBot struct {
Name string `json:"name,omitempty"`
Alias string `json:"alias,omitempty"`
Version string `json:"version,omitempty"`
}
type LexCurrentIntent struct {
Name string `json:"name,omitempty"`
NLUIntentConfidenceScore float64 `json:"nluIntentConfidenceScore,omitempty"`
Slots Slots `json:"slots,omitempty"`
SlotDetails map[string]SlotDetail `json:"slotDetails,omitempty"`
ConfirmationStatus string `json:"confirmationStatus,omitempty"`
}
type LexAlternativeIntents struct {
Name string `json:"name,omitempty"`
NLUIntentConfidenceScore float64 `json:"nluIntentConfidenceScore,omitempty"`
Slots Slots `json:"slots,omitempty"`
SlotDetails map[string]SlotDetail `json:"slotDetails,omitempty"`
ConfirmationStatus string `json:"confirmationStatus,omitempty"`
}
type SlotDetail struct {
Resolutions []map[string]string `json:"resolutions,omitempty"`
OriginalValue string `json:"originalValue,omitempty"`
}
type LexDialogAction struct {
Type string `json:"type,omitempty"`
FulfillmentState string `json:"fulfillmentState,omitempty"`
Message map[string]string `json:"message,omitempty"`
IntentName string `json:"intentName,omitempty"`
Slots Slots `json:"slots,omitempty"`
SlotToElicit string `json:"slotToElicit,omitempty"`
ResponseCard *LexResponseCard `json:"responseCard,omitempty"`
}
type SessionAttributes map[string]string
type Slots map[string]*string
type LexResponse struct {
SessionAttributes SessionAttributes `json:"sessionAttributes"`
DialogAction LexDialogAction `json:"dialogAction,omitempty"`
}
type LexResponseCard struct {
Version int64 `json:"version,omitempty"`
ContentType string `json:"contentType,omitempty"`
GenericAttachments []Attachment `json:"genericAttachments,omitempty"`
}
type Attachment struct {
Title string `json:"title,omitempty"`
SubTitle string `json:"subTitle,omitempty"`
ImageURL string `json:"imageUrl,omitempty"`
AttachmentLinkURL string `json:"attachmentLinkUrl,omitempty"`
Buttons []map[string]string `json:"buttons,omitempty"`
}
func (h *LexEvent) Clear() {
h.Bot = nil
h.CurrentIntent = nil
}