chat_item.dart 614 B

12345678910111213141516171819202122232425262728293031
  1. import 'package:json_annotation/json_annotation.dart';
  2. part 'chat_item.g.dart';
  3. @JsonSerializable()
  4. class ChatItem {
  5. @JsonKey(name: "id")
  6. final int id;
  7. @JsonKey(name: "chatId")
  8. final String conversationId;
  9. @JsonKey(name: "role")
  10. final String role;
  11. @JsonKey(name: "content")
  12. String content;
  13. @JsonKey(name: "createTime")
  14. final String createTime;
  15. ChatItem({
  16. required this.id,
  17. required this.conversationId,
  18. required this.role,
  19. required this.content,
  20. required this.createTime,
  21. });
  22. factory ChatItem.fromJson(Map<String, dynamic> json) => _$ChatItemFromJson(json);
  23. }