DEV-000066 prospective response summary resolution #49
@@ -168,7 +168,11 @@ func matchingCandidates(message string, candidates []ResponseCandidate) []Respon
|
|||||||
lower := strings.ToLower(message)
|
lower := strings.ToLower(message)
|
||||||
var matched []ResponseCandidate
|
var matched []ResponseCandidate
|
||||||
for _, candidate := range candidates {
|
for _, candidate := range candidates {
|
||||||
if summaryMatches(lower, candidate.Attention.Summary) {
|
summary := candidate.Attention.Summary
|
||||||
|
if summary == "" {
|
||||||
|
summary = candidate.Prospective.Summary
|
||||||
|
}
|
||||||
|
if summaryMatches(lower, summary) {
|
||||||
matched = append(matched, candidate)
|
matched = append(matched, candidate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,16 @@ func TestInterpretHumanResponseCancelsArmedProspectiveBeforeAttention(t *testing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInterpretHumanResponseResolvesArmedProspectiveByNaturalSummaryReference(t *testing.T) {
|
||||||
|
result := interpretResponseForTest(t, "Отмени встретить курьера", []ResponseCandidate{
|
||||||
|
{Prospective: continuity.ProspectiveItem{ID: "p1", OwnerPrincipalID: "principal-1", ScopeID: "scope-1", Summary: "позвонить врачу", State: continuity.ProspectiveArmed, Revision: 1}},
|
||||||
|
{Prospective: continuity.ProspectiveItem{ID: "p2", OwnerPrincipalID: "principal-1", ScopeID: "scope-1", Summary: "встретить курьера", State: continuity.ProspectiveArmed, Revision: 1}},
|
||||||
|
})
|
||||||
|
if !result.Handled || result.Response.TargetKind != continuity.ResponseTargetProspectiveItem || result.Response.TargetProspectiveID != "p2" || result.Response.Outcome != continuity.ResponseOutcomeCancelled {
|
||||||
|
t.Fatalf("unexpected prospective natural target response: %#v", result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestInterpretHumanResponseAmbiguousTargetAsksClarificationWithoutResolvedMutation(t *testing.T) {
|
func TestInterpretHumanResponseAmbiguousTargetAsksClarificationWithoutResolvedMutation(t *testing.T) {
|
||||||
result := interpretResponseForTest(t, "Готово", []ResponseCandidate{responseCandidate("a1", "p1", "первое"), responseCandidate("a2", "p2", "второе")})
|
result := interpretResponseForTest(t, "Готово", []ResponseCandidate{responseCandidate("a1", "p1", "первое"), responseCandidate("a2", "p2", "второе")})
|
||||||
if !result.Handled || result.Response.ResolutionState != continuity.ResponseAmbiguous || result.Response.Outcome != continuity.ResponseOutcomeClarificationNeeded || !strings.Contains(result.Reply, "несколько") {
|
if !result.Handled || result.Response.ResolutionState != continuity.ResponseAmbiguous || result.Response.Outcome != continuity.ResponseOutcomeClarificationNeeded || !strings.Contains(result.Reply, "несколько") {
|
||||||
|
|||||||
Reference in New Issue
Block a user