fix(app): preserve unknown user parts and native transcript typography
This commit is contained in:
@@ -11,7 +11,7 @@ import 'native_disclosure.dart';
|
|||||||
typedef ChatMessageTextBuilder = Widget Function(BuildContext, String);
|
typedef ChatMessageTextBuilder = Widget Function(BuildContext, String);
|
||||||
|
|
||||||
/// One `transcriptRows` row: a user message or one folded agent turn. Parts keep
|
/// 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 {
|
class ChatMessageView extends StatelessWidget {
|
||||||
const ChatMessageView({super.key, required this.row, this.textBuilder});
|
const ChatMessageView({super.key, required this.row, this.textBuilder});
|
||||||
|
|
||||||
@@ -56,10 +56,7 @@ class ChatMessageView extends StatelessWidget {
|
|||||||
(cupertino
|
(cupertino
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
? CupertinoTheme.of(context).textTheme.textStyle
|
||||||
: Theme.of(context).textTheme.labelLarge)
|
: Theme.of(context).textTheme.labelLarge)
|
||||||
?.copyWith(
|
?.copyWith(color: _secondaryColor(context, cupertino));
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: _secondaryColor(context, cupertino),
|
|
||||||
);
|
|
||||||
|
|
||||||
Color _secondaryColor(BuildContext context, bool cupertino) => cupertino
|
Color _secondaryColor(BuildContext context, bool cupertino) => cupertino
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||||
@@ -80,6 +77,11 @@ class ChatMessageView extends StatelessWidget {
|
|||||||
final widgets = <Widget>[
|
final widgets = <Widget>[
|
||||||
if (text.trim().isNotEmpty) SelectableText(text),
|
if (text.trim().isNotEmpty) SelectableText(text),
|
||||||
for (final part in parts.where(_isFile)) _attachment(context, part),
|
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();
|
final client = '${message['client'] ?? ''}'.trim();
|
||||||
if (client.isNotEmpty) {
|
if (client.isNotEmpty) {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# C2 message — one native transcript row
|
# C2 message — one native transcript row
|
||||||
|
|
||||||
|
Manager integration follow-up: role labels keep the host's own weight rather
|
||||||
|
than forcing w600. Unknown user parts now also retain a native raw disclosure;
|
||||||
|
they are not silently dropped while assistant unknown parts remain available.
|
||||||
|
The added focused regression checks native label weight and exact unknown user
|
||||||
|
data after opening its disclosure. Full conversation integration remains separate.
|
||||||
|
|
||||||
The first transcript slice renders one row already produced by
|
The first transcript slice renders one row already produced by
|
||||||
`transcriptRows` (`lib/features/chat/domain/chat_transcript.dart`). It is a pure
|
`transcriptRows` (`lib/features/chat/domain/chat_transcript.dart`). It is a pure
|
||||||
widget with no gateway, history, network, composer, shell or chat-screen wiring.
|
widget with no gateway, history, network, composer, shell or chat-screen wiring.
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_view.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets(
|
||||||
|
'unknown user parts remain available without overriding native label weight',
|
||||||
|
(tester) async {
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
body: ChatMessageView(
|
||||||
|
row: {
|
||||||
|
'kind': 'user',
|
||||||
|
'message': {
|
||||||
|
'role': 'user',
|
||||||
|
'parts': [
|
||||||
|
{'type': 'text', 'text': 'Recorded user text'},
|
||||||
|
{
|
||||||
|
'type': 'future-content',
|
||||||
|
'future_value': 'preserved exactly',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
final label = tester.widget<Text>(find.text('User'));
|
||||||
|
expect(
|
||||||
|
label.style!.fontWeight,
|
||||||
|
Theme.of(
|
||||||
|
tester.element(find.byType(ChatMessageView)),
|
||||||
|
).textTheme.labelLarge!.fontWeight,
|
||||||
|
);
|
||||||
|
expect(find.text('Recorded user text'), findsOneWidget);
|
||||||
|
await tester.tap(find.text('Unrecognised part: future-content'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.textContaining('preserved exactly'), findsOneWidget);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user