Continue location follow-ups from recent context
This commit is contained in:
@@ -73,8 +73,15 @@ func ContinueLocalSearch(message string, history []interaction.HumanUtterance) s
|
||||
if len(tokens) == 0 || len(tokens) > 3 || (tokens[0] != "в" && tokens[0] != "на" && tokens[0] != "около") {
|
||||
return ""
|
||||
}
|
||||
for index := len(history) - 1; index >= 0; index-- {
|
||||
previous := strings.TrimSpace(StripAssistantVocative(history[index].Content))
|
||||
var latest *interaction.HumanUtterance
|
||||
for index := range history {
|
||||
if latest == nil || history[index].ReceivedAtUnixMillis > latest.ReceivedAtUnixMillis {
|
||||
candidate := history[index]
|
||||
latest = &candidate
|
||||
}
|
||||
}
|
||||
if latest != nil {
|
||||
previous := strings.TrimSpace(StripAssistantVocative(latest.Content))
|
||||
previousTokens := semanticTokens(previous)
|
||||
if containsStemInTokens(previousTokens, "ресторан", "кафе") && containsStemInTokens(previousTokens, "ближ", "рядом") {
|
||||
return strings.TrimSpace(previous + " " + current)
|
||||
|
||||
Reference in New Issue
Block a user