fix(app): preserve unknown user parts and native transcript typography

This commit is contained in:
2026-10-21 21:12:50 +01:00
parent 57ba909909
commit 2088d4607e
3 changed files with 56 additions and 5 deletions
@@ -11,7 +11,7 @@ import 'native_disclosure.dart';
typedef ChatMessageTextBuilder = Widget Function(BuildContext, String);
/// One `transcriptRows` row: a user message or one folded agent turn. Parts keep
/// order; reasoning/tool bodies are native disclosures and unknown parts keep raw JSON.
/// order for agent turns; native disclosures retain unknown parts as raw JSON.
class ChatMessageView extends StatelessWidget {
const ChatMessageView({super.key, required this.row, this.textBuilder});
@@ -56,10 +56,7 @@ class ChatMessageView extends StatelessWidget {
(cupertino
? CupertinoTheme.of(context).textTheme.textStyle
: Theme.of(context).textTheme.labelLarge)
?.copyWith(
fontWeight: FontWeight.w600,
color: _secondaryColor(context, cupertino),
);
?.copyWith(color: _secondaryColor(context, cupertino));
Color _secondaryColor(BuildContext context, bool cupertino) => cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
@@ -80,6 +77,11 @@ class ChatMessageView extends StatelessWidget {
final widgets = <Widget>[
if (text.trim().isNotEmpty) SelectableText(text),
for (final part in parts.where(_isFile)) _attachment(context, part),
for (final part in parts)
if (part['type'] != 'text' &&
!_isFile(part) &&
!(part['type'] == null && part['text'] is String))
_unrecognised(part),
];
final client = '${message['client'] ?? ''}'.trim();
if (client.isNotEmpty) {