feat(questions): make brand questions the primary monitoring & template axis
- add /questions/combination-fill endpoint with AI-driven, IP-region-aware matrix fill - extract ip2region resolver from ops/app into shared/ipregion for cross-service use - thread question_id filter through dashboard composite, citation summary, and collect-now - switch template wizard from keyword inputs to brand-question selection (primary + supplemental) - pass brand_question and supplemental_questions through assist/title/outline prompts - add AiWaitingModal + 45s client timeout and request_timeout error mapping for long AI flows Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestQuestionCombinationRegionTermsFromIPRegion(t *testing.T) {
|
||||
got := questionCombinationRegionTermsFromIPRegion("中国|0|安徽省|合肥市|电信")
|
||||
want := []string{"合肥", "华东"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("region terms = %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildQuestionCombinationFillFallback(t *testing.T) {
|
||||
description := "GEO 与 AI 搜索优化平台"
|
||||
got := buildQuestionCombinationFillFallback(&questionBrandContext{
|
||||
BrandName: "GeoRankly",
|
||||
Description: &description,
|
||||
}, []string{"上海", "华东"}, QuestionCombinationFillRequest{})
|
||||
|
||||
if !reflect.DeepEqual(got.Region, []string{"上海", "华东"}) {
|
||||
t.Fatalf("region = %#v", got.Region)
|
||||
}
|
||||
if len(got.Core) < 3 || got.Core[0] != "GEO" {
|
||||
t.Fatalf("core fallback = %#v", got.Core)
|
||||
}
|
||||
if len(got.Prefix) != 4 || len(got.Industry) != 4 || len(got.Suffix) != 4 {
|
||||
t.Fatalf("expected four hot terms for non-region columns, got %#v", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user