feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+14 -13
View File
@@ -39,18 +39,19 @@ type DetectionRun struct {
}
type DetectionCall struct {
ID string `gorm:"primaryKey;type:varchar(64)"`
RunID string `gorm:"index;type:varchar(64)"`
SecretHash string `gorm:"uniqueIndex;type:varchar(64)"`
ExpiresAt int64
StartedAt int64
FinishedAt int64
State string `gorm:"type:varchar(24)"`
Usage string `gorm:"type:text"`
Sample string `gorm:"type:text"`
Quota int
Available *bool
Error string
FirstTokenMS *int64
ID string `gorm:"primaryKey;type:varchar(64)"`
RunID string `gorm:"index;type:varchar(64)"`
SecretHash string `gorm:"uniqueIndex;type:varchar(64)"`
ExpiresAt int64
StartedAt int64
FinishedAt int64
State string `gorm:"type:varchar(24)"`
Usage string `gorm:"type:text"`
Sample string `gorm:"type:text"`
Quota int
Available *bool
Error string
}
func DetectionSecretHash(secret string) string {
@@ -144,7 +145,7 @@ func FinishDetectionCall(call *DetectionCall) error {
return errors.New("invalid charge")
}
return DB.Model(&DetectionCall{}).Where("id = ? AND state = ?", call.ID, "running").Updates(map[string]any{
"state": "finished", "finished_at": time.Now().Unix(), "usage": call.Usage, "sample": call.Sample, "quota": call.Quota, "available": call.Available, "error": call.Error,
"state": "finished", "finished_at": time.Now().Unix(), "usage": call.Usage, "sample": call.Sample, "quota": call.Quota, "available": call.Available, "error": call.Error, "first_token_ms": call.FirstTokenMS,
}).Error
}