fix(chat): keep provided reasoning visible during live replies

This commit is contained in:
2026-10-24 01:59:52 +01:00
parent 7f88f14a52
commit fa818341cf
10 changed files with 330 additions and 96 deletions
@@ -124,8 +124,7 @@ void main() {
expect(find.textContaining('"payload": 7'), findsNothing);
expect(find.text('plain future text'), findsOneWidget);
// The answer keeps its own order in the bubble; reasoning and the tool
// calls are two chips in one row below it.
// The answer keeps its own order; reasoning expands inline below it.
double top(String text) => tester.getTopLeft(find.text(text)).dy;
expect(top('First answer'), lessThan(top('Second answer')));
expect(
@@ -140,7 +139,7 @@ void main() {
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
expect(find.text('private reasoning'), findsOneWidget);
await tester.tapAt(const Offset(10, 10));
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
// The chip opens the calls; a call opens to its formatted input.
@@ -162,7 +161,7 @@ void main() {
});
for (final cupertino in [false, true]) {
testWidgets('reasoning and tool chips share one row below the answer '
testWidgets('reasoning disclosure and tool chip follow the answer '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
// The test font draws every glyph as a full square, so the chips need
// more room than real text does on a phone.
@@ -192,10 +191,9 @@ void main() {
reasoning.top,
greaterThan(tester.getRect(find.text('The answer')).bottom),
);
expect(reasoning.center.dy, moreOrLessEquals(tools.center.dy));
expect(reasoning.right, lessThan(tools.left));
expect(reasoning.bottom, lessThan(tools.top));
// Like the tool chip, it opens a sheet with every step.
// The inline disclosure opens with every recorded step.
await tester.tap(find.text('Reasoning · 2 steps'));
await tester.pumpAndSettle();
expect(find.text('first thought'), findsOneWidget);
@@ -298,7 +296,7 @@ void main() {
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
expect(find.text('thought'), findsOneWidget);
await tester.tapAt(const Offset(10, 10));
await tester.tap(find.text('Reasoning'));
await tester.pumpAndSettle();
await tester.tap(find.text('1 tool'));