dto.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package coze
  2. import "encoding/json"
  3. // type CozeResponse struct {
  4. // Code int `json:"code"`
  5. // Message string `json:"message"`
  6. // Data CozeConversationData `json:"data"`
  7. // Detail CozeConversationData `json:"detail"`
  8. // }
  9. // type CozeConversationData struct {
  10. // Id string `json:"id"`
  11. // CreatedAt int64 `json:"created_at"`
  12. // MetaData json.RawMessage `json:"meta_data"`
  13. // LastSectionId string `json:"last_section_id"`
  14. // }
  15. // type CozeResponseDetail struct {
  16. // Logid string `json:"logid"`
  17. // }
  18. type CozeError struct {
  19. Code int `json:"code"`
  20. Message string `json:"message"`
  21. }
  22. // type CozeErrorWithStatusCode struct {
  23. // Error CozeError `json:"error"`
  24. // StatusCode int
  25. // LocalError bool
  26. // }
  27. type CozeRequest struct {
  28. BotId string `json:"bot_id,omitempty"`
  29. MetaData json.RawMessage `json:"meta_data,omitempty"`
  30. Messages []CozeEnterMessage `json:"messages,omitempty"`
  31. }
  32. type CozeEnterMessage struct {
  33. Role string `json:"role"`
  34. Type string `json:"type,omitempty"`
  35. Content json.RawMessage `json:"content,omitempty"`
  36. MetaData json.RawMessage `json:"meta_data,omitempty"`
  37. ContentType string `json:"content_type,omitempty"`
  38. }
  39. type CozeChatRequest struct {
  40. BotId string `json:"bot_id"`
  41. UserId string `json:"user_id"`
  42. AdditionalMessages []CozeEnterMessage `json:"additional_messages,omitempty"`
  43. Stream bool `json:"stream,omitempty"`
  44. CustomVariables json.RawMessage `json:"custom_variables,omitempty"`
  45. AutoSaveHistory bool `json:"auto_save_history,omitempty"`
  46. MetaData json.RawMessage `json:"meta_data,omitempty"`
  47. ExtraParams json.RawMessage `json:"extra_params,omitempty"`
  48. ShortcutCommand json.RawMessage `json:"shortcut_command,omitempty"`
  49. Parameters json.RawMessage `json:"parameters,omitempty"`
  50. }
  51. type CozeChatResponse struct {
  52. Code int `json:"code"`
  53. Msg string `json:"msg"`
  54. Data CozeChatResponseData `json:"data"`
  55. }
  56. type CozeChatResponseData struct {
  57. Id string `json:"id"`
  58. ConversationId string `json:"conversation_id"`
  59. BotId string `json:"bot_id"`
  60. CreatedAt int64 `json:"created_at"`
  61. LastError CozeError `json:"last_error"`
  62. Status string `json:"status"`
  63. Usage CozeChatUsage `json:"usage"`
  64. }
  65. type CozeChatUsage struct {
  66. TokenCount int `json:"token_count"`
  67. OutputCount int `json:"output_count"`
  68. InputCount int `json:"input_count"`
  69. }