| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import 'package:json_annotation/json_annotation.dart';
- part 'chat_item.g.dart';
- @JsonSerializable()
- class ChatItem {
- @JsonKey(name: "id", fromJson: _intToString, toJson: _stringToInt)
- final String id;
- @JsonKey(name: "chatId")
- final String conversationId;
- @JsonKey(name: "role")
- final String role;
- @JsonKey(name: "content")
- String content;
- @JsonKey(name: "createTime")
- final String createTime;
- @JsonKey(name: "talkId")
- String? talkId;
- @JsonKey(name: "title")
- String? talkTitle;
- ChatItem({
- required this.id,
- required this.conversationId,
- required this.role,
- required this.content,
- required this.createTime,
- });
- factory ChatItem.fromJson(Map<String, dynamic> json) => _$ChatItemFromJson(json);
- static String _intToString(int value) => value.toString();
- static int _stringToInt(String value) => int.parse(value);
- }
|