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
+6
View File
@@ -17,6 +17,7 @@ class AiPersonaItem {
required this.isDefault,
required this.editable,
required this.defaultPrompt,
this.avatar,
});
/// null = 虚拟的「默认」项(内容是服务端代码内置的)
@@ -42,6 +43,10 @@ class AiPersonaItem {
/// 以后改了默认人设,App 不用跟着改版本。
final String? defaultPrompt;
/// 头像**相对路径**(如 `persona/2026/09/29/xxx.jpg`)。
/// 用 [Avatar] 组件显示,它会自己拼 host。null = 用默认头像。
final String? avatar;
/// 用于「显示已选中的是哪一项」的稳定标识。
///
/// 默认项没有 id,用 -1 代替 —— 不能直接用 null 当 map key 去比较。
@@ -58,6 +63,7 @@ class AiPersonaItem {
// 用户项上这个字段是 null —— 不能直接用 asNonEmpty(它要 fallback 参数,
// 而我们恰恰需要保留「null = 没有」这个语义,供「恢复默认」按钮判断)
defaultPrompt: _nullableNonEmpty(json['defaultPrompt']),
avatar: _nullableNonEmpty(json['avatar']),
);
}