dto.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package xunfei
  2. import "one-api/dto"
  3. type XunfeiMessage struct {
  4. Role string `json:"role"`
  5. Content string `json:"content"`
  6. }
  7. type XunfeiChatRequest struct {
  8. Header struct {
  9. AppId string `json:"app_id"`
  10. } `json:"header"`
  11. Parameter struct {
  12. Chat struct {
  13. Domain string `json:"domain,omitempty"`
  14. Temperature *float64 `json:"temperature,omitempty"`
  15. TopK int `json:"top_k,omitempty"`
  16. MaxTokens uint `json:"max_tokens,omitempty"`
  17. Auditing bool `json:"auditing,omitempty"`
  18. } `json:"chat"`
  19. } `json:"parameter"`
  20. Payload struct {
  21. Message struct {
  22. Text []XunfeiMessage `json:"text"`
  23. } `json:"message"`
  24. } `json:"payload"`
  25. }
  26. type XunfeiChatResponseTextItem struct {
  27. Content string `json:"content"`
  28. Role string `json:"role"`
  29. Index int `json:"index"`
  30. }
  31. type XunfeiChatResponse struct {
  32. Header struct {
  33. Code int `json:"code"`
  34. Message string `json:"message"`
  35. Sid string `json:"sid"`
  36. Status int `json:"status"`
  37. } `json:"header"`
  38. Payload struct {
  39. Choices struct {
  40. Status int `json:"status"`
  41. Seq int `json:"seq"`
  42. Text []XunfeiChatResponseTextItem `json:"text"`
  43. } `json:"choices"`
  44. Usage struct {
  45. //Text struct {
  46. // QuestionTokens string `json:"question_tokens"`
  47. // PromptTokens string `json:"prompt_tokens"`
  48. // CompletionTokens string `json:"completion_tokens"`
  49. // TotalTokens string `json:"total_tokens"`
  50. //} `json:"text"`
  51. Text dto.Usage `json:"text"`
  52. } `json:"usage"`
  53. } `json:"payload"`
  54. }