Keep chat activity stable in one live disclosure and distinguish unread attention

This commit is contained in:
2026-10-28 16:45:05 +00:00
parent e0317574de
commit 7027da4248
22 changed files with 968 additions and 301 deletions
@@ -88,22 +88,29 @@ List<JsonMap> transcriptRows(
final activity = <JsonMap>[];
String? activityKey;
void flush() {
if (activity.isNotEmpty) {
final latest = activity.last;
final compactions = activity
.where((p) => chatActivityKind(p) == 'compaction')
.toList();
final passive = activity
.where((p) => chatActivityKind(p) != 'compaction')
.toList();
if (compactions.isNotEmpty) {
final latest = compactions.last;
rows.add({
'kind': 'activity',
'key': activityKey == null ? '' : 'chat-activity-$activityKey',
'records': List<JsonMap>.of(activity),
'records': compactions,
'label': chatActivityLabel(latest),
'state': chatActivityState(latest).toLowerCase(),
});
}
if (key != null && parts.isNotEmpty) {
if (key != null && (parts.isNotEmpty || passive.isNotEmpty)) {
rows.add({
'kind': 'assistant',
'key': key,
'messageIds': List<String>.of(ids),
'parts': List<JsonMap>.of(parts),
if (passive.isNotEmpty) 'activityRecords': passive,
// The model that answered, as the server recorded it on the reply.
if (model.isNotEmpty) 'model': model,
});