Recognize identity from the original question #290
@@ -187,7 +187,11 @@ func selectionObjectiveForMeaning(meaning cognitive.TaskMeaning, message string)
|
||||
|
||||
func builtinAdvisory(request cognitive.GatewayAdvisoryRequest) cognitive.GatewayAdvisoryResponse {
|
||||
text := "Проверю запрос доступным маршрутом и сообщу результат."
|
||||
if request.Meaning.SpeechAct == "QUESTION" && isIdentityInquiry(request.Meaning.RequestedOutcome) {
|
||||
identityText := request.Meaning.RequestedOutcome
|
||||
if identityText == "" {
|
||||
identityText = request.Message
|
||||
}
|
||||
if request.Meaning.SpeechAct == "QUESTION" && isIdentityInquiry(identityText) {
|
||||
text = "Я — Домовой, ваш помощник."
|
||||
}
|
||||
switch request.Meaning.InformationRequestKind {
|
||||
@@ -204,7 +208,7 @@ func builtinAdvisory(request cognitive.GatewayAdvisoryRequest) cognitive.Gateway
|
||||
case "REQUEST_TO_INVESTIGATE":
|
||||
text = "Понял задачу. Проверю доступный путь и сообщу результат."
|
||||
case "QUESTION":
|
||||
if !isIdentityInquiry(request.Meaning.RequestedOutcome) {
|
||||
if !isIdentityInquiry(identityText) {
|
||||
text = "Проверю вопрос доступным источником и отвечу по существу."
|
||||
}
|
||||
case "CONVERSATIONAL":
|
||||
|
||||
@@ -202,6 +202,15 @@ func TestBuiltInAdvisoryIdentityIsNaturalAndDoesNotMentionResponseLength(t *test
|
||||
if strings.Contains(response.AdvisoryText, "коротко") || strings.Contains(response.AdvisoryText, "подробност") {
|
||||
t.Fatalf("identity response contains style meta-text: %q", response.AdvisoryText)
|
||||
}
|
||||
messageResponse := builtinAdvisory(cognitive.GatewayAdvisoryRequest{
|
||||
Version: cognitive.CreatorAdvisoryV1,
|
||||
RequestID: "request-identity-message",
|
||||
Message: "как тебя зовут?",
|
||||
Meaning: cognitive.TaskMeaning{SpeechAct: "QUESTION"},
|
||||
})
|
||||
if messageResponse.AdvisoryText != "Я — Домовой, ваш помощник." {
|
||||
t.Fatalf("unexpected message identity response: %q", messageResponse.AdvisoryText)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoActiveBindingInvokesBuiltInLocalProvider(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user