forked from niuniu/llm-intelligence
feat(intraday): monitor DeepSeek official page drift
This commit is contained in:
@@ -46,10 +46,11 @@ func TestLoadIntradayLLMRecordsFromFixture(t *testing.T) {
|
||||
|
||||
func TestNormalizeIntradayCandidatesDedupesEquivalentEvents(t *testing.T) {
|
||||
searchRecords := []intradaySearchRecord{{
|
||||
Title: "OpenAI announces GPT-5.6 preview pricing update",
|
||||
Summary: "Search summary",
|
||||
URL: "https://openai.example.com/news/gpt-5-6-pricing",
|
||||
Provider: "OpenAI",
|
||||
Title: "OpenAI announces GPT-5.6 preview pricing update",
|
||||
Summary: "Search summary",
|
||||
URL: "https://openai.example.com/news/gpt-5-6-pricing",
|
||||
Provider: "OpenAI",
|
||||
PublishedAt: "2026-05-25",
|
||||
}}
|
||||
llmRecords := []intradayLLMRecord{
|
||||
{
|
||||
@@ -80,6 +81,29 @@ func TestNormalizeIntradayCandidatesDedupesEquivalentEvents(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeIntradayCandidatesDropsOutdatedSearchMatches(t *testing.T) {
|
||||
searchRecords := []intradaySearchRecord{{
|
||||
Title: "Old DeepSeek pricing article",
|
||||
Summary: "Yesterday record",
|
||||
URL: "https://deepseek.example.com/pricing",
|
||||
Provider: "DeepSeek",
|
||||
PublishedAt: "2026-05-24",
|
||||
}}
|
||||
llmRecords := []intradayLLMRecord{{
|
||||
EventType: "price_cut",
|
||||
ProviderName: "DeepSeek",
|
||||
ModelName: "DeepSeek-V4-Flash",
|
||||
ProviderCountry: "CN",
|
||||
Title: "DeepSeek V4 Flash price cut",
|
||||
Summary: "Should be dropped because search evidence is stale",
|
||||
CandidateURLs: []string{"https://deepseek.example.com/pricing"},
|
||||
}}
|
||||
candidates := normalizeIntradayCandidates("2026-05-25", searchRecords, llmRecords)
|
||||
if len(candidates) != 0 {
|
||||
t.Fatalf("旧闻搜索结果不应进入候选池, got=%d", len(candidates))
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeIntradayCandidatesDropsURLlessRecords(t *testing.T) {
|
||||
llmRecords := []intradayLLMRecord{{
|
||||
EventType: "promo_campaign",
|
||||
@@ -94,6 +118,13 @@ func TestNormalizeIntradayCandidatesDropsURLlessRecords(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSearchRecordMatchesLocalizedBingDate(t *testing.T) {
|
||||
record := intradaySearchRecord{PublishedAt: "周一, 25 5月 2026 14:08:00 GMT"}
|
||||
if !searchRecordMatchesDate(record, "2026-05-25") {
|
||||
t.Fatal("应识别本地化 Bing pubDate 为当天")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateIntradayProviderConfigRequiresCommandOrURLOrFixture(t *testing.T) {
|
||||
if err := validateIntradayProviderConfig("search", intradayProviderConfig{Mode: "command_json"}); err == nil {
|
||||
t.Fatal("缺少 command 时应报错")
|
||||
|
||||
Reference in New Issue
Block a user