Fix semantic routing for location follow-ups
This commit is contained in:
@@ -509,6 +509,7 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var effectiveTaskMessage = interactiondomain.StripAssistantVocative(utterance.Content)
|
var effectiveTaskMessage = interactiondomain.StripAssistantVocative(utterance.Content)
|
||||||
|
continuationMessage := ""
|
||||||
var previousTask *interaction.HumanUtterance
|
var previousTask *interaction.HumanUtterance
|
||||||
var conversationHistory []interaction.HumanUtterance
|
var conversationHistory []interaction.HumanUtterance
|
||||||
if request.ConversationID != "" {
|
if request.ConversationID != "" {
|
||||||
@@ -530,6 +531,7 @@ func main() {
|
|||||||
conversationHistory = append(conversationHistory, recentUserHistory...)
|
conversationHistory = append(conversationHistory, recentUserHistory...)
|
||||||
if continuation := interactiondomain.ContinueLocalSearch(effectiveTaskMessage, conversationHistory); continuation != "" {
|
if continuation := interactiondomain.ContinueLocalSearch(effectiveTaskMessage, conversationHistory); continuation != "" {
|
||||||
log.Printf("interaction continuation selected: conversation=%s history=%d", conversation.ID, len(conversationHistory))
|
log.Printf("interaction continuation selected: conversation=%s history=%d", conversation.ID, len(conversationHistory))
|
||||||
|
continuationMessage = continuation
|
||||||
effectiveTaskMessage = continuation
|
effectiveTaskMessage = continuation
|
||||||
} else if len(conversationHistory) > 0 {
|
} else if len(conversationHistory) > 0 {
|
||||||
log.Printf("interaction continuation not selected: conversation=%s history=%d", conversation.ID, len(conversationHistory))
|
log.Printf("interaction continuation not selected: conversation=%s history=%d", conversation.ID, len(conversationHistory))
|
||||||
@@ -552,6 +554,16 @@ func main() {
|
|||||||
http.Error(w, "interpret chat message", http.StatusServiceUnavailable)
|
http.Error(w, "interpret chat message", http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if continuationMessage != "" {
|
||||||
|
continuedUtterance := utterance
|
||||||
|
continuedUtterance.Content = continuationMessage
|
||||||
|
continuedSemantic, continuedErr := interactiondomain.InterpretUtterance(continuedUtterance, projects, previousFocus, now)
|
||||||
|
if continuedErr == nil {
|
||||||
|
continuedSemantic.Interpretation.Source = "CONVERSATION_CONTINUATION"
|
||||||
|
continuedSemantic.Interpretation.SelectionReason = "location follow-up completed the previous local-search task"
|
||||||
|
semantic = continuedSemantic
|
||||||
|
}
|
||||||
|
}
|
||||||
if previousTask != nil {
|
if previousTask != nil {
|
||||||
previousSemantic, previousErr := interactiondomain.InterpretUtterance(*previousTask, projects, previousFocus, now)
|
previousSemantic, previousErr := interactiondomain.InterpretUtterance(*previousTask, projects, previousFocus, now)
|
||||||
if previousErr == nil {
|
if previousErr == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user