Fix semantic routing for location follow-ups #325
@@ -509,6 +509,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
var effectiveTaskMessage = interactiondomain.StripAssistantVocative(utterance.Content)
|
||||
continuationMessage := ""
|
||||
var previousTask *interaction.HumanUtterance
|
||||
var conversationHistory []interaction.HumanUtterance
|
||||
if request.ConversationID != "" {
|
||||
@@ -530,6 +531,7 @@ func main() {
|
||||
conversationHistory = append(conversationHistory, recentUserHistory...)
|
||||
if continuation := interactiondomain.ContinueLocalSearch(effectiveTaskMessage, conversationHistory); continuation != "" {
|
||||
log.Printf("interaction continuation selected: conversation=%s history=%d", conversation.ID, len(conversationHistory))
|
||||
continuationMessage = continuation
|
||||
effectiveTaskMessage = continuation
|
||||
} else if len(conversationHistory) > 0 {
|
||||
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)
|
||||
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 {
|
||||
previousSemantic, previousErr := interactiondomain.InterpretUtterance(*previousTask, projects, previousFocus, now)
|
||||
if previousErr == nil {
|
||||
|
||||
Reference in New Issue
Block a user