feat(intraday): monitor DeepSeek official page drift
This commit is contained in:
@@ -95,6 +95,10 @@ type materializeDailySignalsConfig struct {
|
||||
var signalLogger *slog.Logger
|
||||
|
||||
const signalUSDToCNY = 7.25
|
||||
const defaultDeepSeekNewsSignalURL = "https://api-docs.deepseek.com/news/news250120"
|
||||
const defaultDeepSeekPricingSignalURL = "https://platform.deepseek.com/pricing"
|
||||
const defaultDeepSeekAPIPricingSignalURL = "https://platform.deepseek.com/docs/api-pricing"
|
||||
|
||||
|
||||
func init() {
|
||||
signalLogger = slog.New(slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelInfo}))
|
||||
@@ -373,6 +377,11 @@ func loadSignalModelEvents(db *sql.DB, date string) ([]signalModelEvent, error)
|
||||
return nil, err
|
||||
}
|
||||
events = mergeVerifiedDiscoveryEvents(events, discoveryEvents)
|
||||
deepseekDriftEvents, err := loadDeepSeekNewsDriftSignalEvents(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
events = mergeVerifiedDiscoveryEvents(events, deepseekDriftEvents)
|
||||
|
||||
sort.Slice(events, func(i, j int) bool {
|
||||
if events[i].Priority != events[j].Priority {
|
||||
@@ -954,6 +963,110 @@ func firstString(values []string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func loadDeepSeekNewsDriftSignalEvents(db *sql.DB) ([]signalModelEvent, error) {
|
||||
return loadDeepSeekSignatureSignalEvents(db, []deepseekSignatureEventConfig{
|
||||
{
|
||||
SourceKey: "deepseek_news_signature",
|
||||
ModelName: "DeepSeek 官方新闻页",
|
||||
SourceKindLabel: "官方新闻页结构变化",
|
||||
PrimaryURL: defaultDeepSeekNewsSignalURL,
|
||||
Audience: "适合需要尽快复查 DeepSeek 路线图与默认选型的团队",
|
||||
EvidenceTemplate: "DeepSeek 官方新闻页结构签名发生变化:sha=%s previous=%s",
|
||||
Baseline: "官方新闻页结构漂移",
|
||||
Summary: "DeepSeek 官方新闻页结构发生变化,需优先确认是否出现新发布或路线图更新。",
|
||||
Priority: 117,
|
||||
},
|
||||
{
|
||||
SourceKey: "deepseek_pricing_signature",
|
||||
ModelName: "DeepSeek 官方价格页",
|
||||
SourceKindLabel: "官方价格页结构变化",
|
||||
PrimaryURL: defaultDeepSeekPricingSignalURL,
|
||||
Audience: "适合需要尽快复查 DeepSeek 价格策略与默认成本模型的团队",
|
||||
EvidenceTemplate: "DeepSeek 官方价格页结构签名发生变化:sha=%s previous=%s",
|
||||
Baseline: "官方价格页结构漂移",
|
||||
Summary: "DeepSeek 官方价格页结构发生变化,需优先确认是否出现价格策略更新。",
|
||||
Priority: 116,
|
||||
},
|
||||
{
|
||||
SourceKey: "deepseek_api_pricing_signature",
|
||||
ModelName: "DeepSeek API 定价页",
|
||||
SourceKindLabel: "官方 API 定价页结构变化",
|
||||
PrimaryURL: defaultDeepSeekAPIPricingSignalURL,
|
||||
Audience: "适合需要尽快复查 DeepSeek API 定价与预算预期的团队",
|
||||
EvidenceTemplate: "DeepSeek API 定价页结构签名发生变化:sha=%s previous=%s",
|
||||
Baseline: "官方 API 定价页结构漂移",
|
||||
Summary: "DeepSeek API 定价页结构发生变化,需优先确认是否出现定价或套餐更新。",
|
||||
Priority: 115,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type deepseekSignatureEventConfig struct {
|
||||
SourceKey string
|
||||
ModelName string
|
||||
SourceKindLabel string
|
||||
PrimaryURL string
|
||||
Audience string
|
||||
EvidenceTemplate string
|
||||
Baseline string
|
||||
Summary string
|
||||
Priority int
|
||||
}
|
||||
|
||||
func loadDeepSeekSignatureSignalEvents(db *sql.DB, configs []deepseekSignatureEventConfig) ([]signalModelEvent, error) {
|
||||
if len(configs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
var events []signalModelEvent
|
||||
for _, cfg := range configs {
|
||||
_, rows, err := queryOfficialImportSignatureAuditWindow(db, 5, cfg.SourceKey, false)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), `relation "official_import_signature_audit_recent_view" does not exist`) ||
|
||||
strings.Contains(err.Error(), `relation "official_import_signature_audit" does not exist`) {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
for _, row := range rows {
|
||||
if row.RecentRank != 1 {
|
||||
continue
|
||||
}
|
||||
if event, ok := buildDeepSeekSignatureSignalEvent(row, cfg); ok {
|
||||
events = append(events, event)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return events, nil
|
||||
}
|
||||
|
||||
func buildDeepSeekSignatureSignalEvent(row officialImportSignatureAuditViewRow, cfg deepseekSignatureEventConfig) (signalModelEvent, bool) {
|
||||
if row.SourceKey != cfg.SourceKey || !row.DriftDetected {
|
||||
return signalModelEvent{}, false
|
||||
}
|
||||
updatedAt := row.CheckedAt.Format("2006-01-02 15:04")
|
||||
primarySource := nullStringOrNone(row.SnapshotPath)
|
||||
if primarySource == "none" {
|
||||
primarySource = cfg.PrimaryURL
|
||||
}
|
||||
return signalModelEvent{
|
||||
EventType: "official_release",
|
||||
ModelName: cfg.ModelName,
|
||||
ProviderName: "DeepSeek",
|
||||
OperatorName: "DeepSeek",
|
||||
Audience: cfg.Audience,
|
||||
TrustLabel: "官方来源 / 结构漂移告警",
|
||||
SourceKindLabel: cfg.SourceKindLabel,
|
||||
PrimarySource: primarySource,
|
||||
SourceURL: cfg.PrimaryURL,
|
||||
UpdatedAt: updatedAt,
|
||||
EvidenceDetail: fmt.Sprintf(cfg.EvidenceTemplate, row.StructureSHA256, nullStringOrNone(row.PreviousObservedSHA256)),
|
||||
Baseline: cfg.Baseline,
|
||||
Summary: cfg.Summary,
|
||||
Priority: cfg.Priority,
|
||||
}, true
|
||||
}
|
||||
|
||||
func signalNormalizeIntradayEventType(value string) string {
|
||||
switch strings.TrimSpace(strings.ToLower(value)) {
|
||||
case "price_cut":
|
||||
|
||||
Reference in New Issue
Block a user