channeltest.go 935 B

12345678910111213141516171819202122232425262728293031323334
  1. package model
  2. import (
  3. "time"
  4. "github.com/bytedance/sonic"
  5. "github.com/labring/aiproxy/core/relay/mode"
  6. )
  7. type ChannelTest struct {
  8. TestAt time.Time `json:"test_at"`
  9. Model string `json:"model" gorm:"size:64;primaryKey"`
  10. ActualModel string `json:"actual_model" gorm:"size:64"`
  11. Response string `json:"response" gorm:"type:text"`
  12. ChannelName string `json:"channel_name" gorm:"size:64"`
  13. ChannelType ChannelType `json:"channel_type"`
  14. ChannelID int `json:"channel_id" gorm:"primaryKey"`
  15. Took float64 `json:"took"`
  16. Success bool `json:"success"`
  17. Mode mode.Mode `json:"mode"`
  18. Code int `json:"code"`
  19. }
  20. func (ct *ChannelTest) MarshalJSON() ([]byte, error) {
  21. type Alias ChannelTest
  22. return sonic.Marshal(&struct {
  23. *Alias
  24. TestAt int64 `json:"test_at"`
  25. }{
  26. Alias: (*Alias)(ct),
  27. TestAt: ct.TestAt.UnixMilli(),
  28. })
  29. }