clarify steps aside when the next turn is its own request (V-554)
A parked question consumed whatever came next. One act she could not fulfil ate three turns: "выключи свет в спальне" asked "Что сделать?", and "кто изобрёл телефон" was scored as an answer to it, then "как дела" after that. Nothing tested whether the words could be an answer. The test is two offline token checks that already existed for other callers: a question shape, or a capture verb. It fires only where the answer filled nothing, so an answer that closes the gap still lands whatever shape it has, and the retry budget is untouched — the count was never the problem.
This commit is contained in:
@@ -26,6 +26,24 @@ var (
|
||||
captureVerbs = lexicon.CaptureVerbs()
|
||||
)
|
||||
|
||||
// CarriesCaptureVerb reports whether text tells Maven to write something down.
|
||||
// Sibling of IsQuestionShaped and matched over the same tokens, and the two do
|
||||
// not overlap: IsQuestionShaped returns false for anything this returns true
|
||||
// for, because "запиши что я пил воду" is a capture and not a question.
|
||||
//
|
||||
// Both exist together so a caller can ask "is this its own request?" — a
|
||||
// clarify answer that asks a question or orders a capture is not an answer
|
||||
// (Vikunja #554).
|
||||
func CarriesCaptureVerb(text string) bool {
|
||||
toks := planTokens(strings.TrimSpace(text))
|
||||
for _, v := range captureVerbs {
|
||||
if hasTok(toks, v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsQuestionShaped reports whether text asks for something rather than
|
||||
// records it. It is a deterministic offline test over tokens, so it costs
|
||||
// nothing and never depends on the model that produced the routing decision.
|
||||
|
||||
Reference in New Issue
Block a user