Remove canned creative fallback content
This commit is contained in:
@@ -665,14 +665,11 @@ func CreativeDeterministicReply(message string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// CreativeFallbackReply keeps a small creative conversation useful when the
|
||||
// cognitive channel is unavailable. It is not used when cognition returns a
|
||||
// completed richer answer.
|
||||
// CreativeFallbackReply intentionally has no canned creative content. The
|
||||
// cognitive route must construct the requested result while preserving all
|
||||
// user attributes; a degraded path must not pretend that a prepared answer
|
||||
// was generated.
|
||||
func CreativeFallbackReply(message string) string {
|
||||
tokens := semanticTokens(message)
|
||||
if IsCreativeRequest(message) && containsStemInTokens(tokens, "сказк", "басн") && containsStemInTokens(tokens, "колоб") {
|
||||
return "Жили-были дед и баба. Испекли они Колобка, а он убежал в лес. Встретил зайца, волка и медведя — от всех укатился, но лису перехитрить не смог. Так Колобок понял: хвастовство и беспечность до добра не доводят."
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -283,8 +282,8 @@ func TestInterpretCreativeRequestDoesNotRequireExternalEvidence(t *testing.T) {
|
||||
if !IsCreativeRequest("расскажи сказку о колобке") {
|
||||
t.Fatal("story request was not recognized as creative")
|
||||
}
|
||||
if got := CreativeFallbackReply("расскажи сказку о колобке"); !strings.Contains(got, "Колоб") {
|
||||
t.Fatalf("story fallback = %q", got)
|
||||
if got := CreativeFallbackReply("расскажи сказку о колобке"); got != "" {
|
||||
t.Fatalf("creative request received canned content = %q", got)
|
||||
}
|
||||
for _, message := range []string{"нарисуй птицу", "нарисуй зеленую птицу", "нарисуй птицу в HD", "нарисуй коня"} {
|
||||
if got := CreativeDeterministicReply(message); got != "" {
|
||||
|
||||
Reference in New Issue
Block a user