AI助手优化-头像和对话功能

This commit is contained in:
2026-09-29 09:45:02 +08:00
parent 80222099ff
commit f4ad2f8612
15 changed files with 990 additions and 37 deletions
+26 -3
View File
@@ -3,12 +3,21 @@ class AuthResponse {
final String? username;
final String? nickname;
const AuthResponse({required this.token, this.username, this.nickname});
/// 头像相对路径。null = 用默认头像
final String? avatar;
const AuthResponse({
required this.token,
this.username,
this.nickname,
this.avatar,
});
factory AuthResponse.fromJson(Map<String, dynamic> json) => AuthResponse(
token: json['token']?.toString() ?? '',
username: json['username']?.toString(),
nickname: json['nickname']?.toString(),
avatar: json['avatar']?.toString(),
);
}
@@ -17,13 +26,27 @@ class UserInfo {
final String username;
final String nickname;
const UserInfo({this.id, required this.username, required this.nickname});
/// 头像相对路径。null = 用默认头像
final String? avatar;
Map<String, dynamic> toJson() => {'id': id, 'username': username, 'nickname': nickname};
const UserInfo({
this.id,
required this.username,
required this.nickname,
this.avatar,
});
Map<String, dynamic> toJson() => {
'id': id,
'username': username,
'nickname': nickname,
'avatar': avatar,
};
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
id: json['id']?.toString(),
username: json['username']?.toString() ?? '',
nickname: json['nickname']?.toString() ?? '',
avatar: json['avatar']?.toString(),
);
}