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
@@ -7,6 +7,7 @@ import '../../../../core/api_gateway.dart';
import '../sessions/chat_adaptive.dart';
import '../../domain/chat_tool_calls.dart';
import 'chat_tool_calls_view.dart';
import 'chat_reasoning_disclosure.dart';
import 'native_disclosure.dart';
/// Builds an assistant text part; the default keeps the server's text exactly.
@@ -188,8 +189,7 @@ class ChatMessageView extends StatelessWidget {
return widgets;
}
/// The agent turn: the answer in the bubble, then one row with its reasoning
/// and tool-call chips, each opening its own sheet.
/// Reasoning stays in the transcript so an open body follows live deltas.
Widget _agentTurn(BuildContext context, List<Widget> content, Widget bubble) {
final parts = _partsOf(row);
final reasoning = [
@@ -208,13 +208,17 @@ class ChatMessageView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (content.isNotEmpty) bubble,
// Reasoning and tool calls share one quiet row below the answer.
if (reasoning.isNotEmpty || tools.isNotEmpty || model.isNotEmpty)
if (reasoning.isNotEmpty)
ChatReasoningDisclosure(
key: const Key('chat-turn-reasoning'),
steps: reasoning,
streaming: row['streaming'] == true,
),
if (tools.isNotEmpty || model.isNotEmpty)
Wrap(
spacing: 8,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
if (reasoning.isNotEmpty) ChatReasoningChip(steps: reasoning),
if (tools.isNotEmpty) ChatToolCallsChip(calls: tools),
// Which model answered, quietly, after the chips.
if (model.isNotEmpty)