Add snapshot, signature, and drift guard support for Vertex AI, Cloudflare Workers AI, and Perplexity API, backed by a queryable audit table and recent-window view. This commit also wires the audit query layer into daily signal materialization and report generation so structure drift becomes a first-class signal instead of a log-only artifact.
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
//go:build llm_script
|
|
|
|
package main
|
|
|
|
import "testing"
|
|
|
|
func TestSummarizeSignalEventTypes(t *testing.T) {
|
|
events := []signalModelEvent{
|
|
{EventType: "new_model", ModelName: "A"},
|
|
{EventType: "new_model", ModelName: "B"},
|
|
{EventType: "price_cut", ModelName: "C"},
|
|
}
|
|
|
|
counts := summarizeSignalEventTypes(events)
|
|
if counts["new_model"] != 2 {
|
|
t.Fatalf("new_model 计数错误: %d", counts["new_model"])
|
|
}
|
|
if counts["price_cut"] != 1 {
|
|
t.Fatalf("price_cut 计数错误: %d", counts["price_cut"])
|
|
}
|
|
}
|
|
|
|
func TestBuildSignalPageMode(t *testing.T) {
|
|
if got := buildSignalPageMode(signalDailySignals{}, nil); got != "calm" {
|
|
t.Fatalf("平静日 page_mode 错误: %q", got)
|
|
}
|
|
if got := buildSignalPageMode(signalDailySignals{NewModels: 2, PriceChanges: 1}, nil); got != "hot" {
|
|
t.Fatalf("高变化日 page_mode 错误: %q", got)
|
|
}
|
|
if got := buildSignalPageMode(signalDailySignals{}, []signalModelEvent{{EventType: "official_release"}}); got != "hot" {
|
|
t.Fatalf("官方发布日 page_mode 错误: %q", got)
|
|
}
|
|
}
|