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.
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
//go:build llm_script
|
|
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
func main() {
|
|
loadSubscriptionImportEnv()
|
|
|
|
var limitPerSource int
|
|
var sourceKey string
|
|
var changesOnly bool
|
|
|
|
flag.IntVar(&limitPerSource, "limit-per-source", 5, "每个 source_key 展示最近多少次记录")
|
|
flag.StringVar(&sourceKey, "source-key", "", "只看单个 source_key")
|
|
flag.BoolVar(&changesOnly, "changes-only", false, "仅展示结构发生变化的记录")
|
|
flag.Parse()
|
|
|
|
if limitPerSource <= 0 {
|
|
fmt.Fprintln(os.Stderr, "limit-per-source 必须大于 0")
|
|
os.Exit(2)
|
|
}
|
|
|
|
db, err := subscriptionImportDB()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "open db: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
defer db.Close()
|
|
|
|
summaries, rows, err := queryOfficialImportSignatureAuditWindow(db, limitPerSource, sourceKey, changesOnly)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "query_official_import_signature_audit: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
renderOfficialImportSignatureAuditReport(os.Stdout, limitPerSource, sourceKey, changesOnly, summaries, rows)
|
|
}
|