Keep chat activity stable in one live disclosure and distinguish unread attention
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user