dto.go 2.8 KB

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