feat(app): a chat names its model (recorded, last reply's, or the agent default) and each reply shows the model that answered

This commit is contained in:
2026-10-23 18:57:36 +01:00
parent 1d9fd08b31
commit 35e343fe40
5 changed files with 102 additions and 2 deletions
@@ -21,8 +21,13 @@ class ChatModelControl extends StatefulWidget {
required this.sessionId,
required this.session,
this.onChanged,
this.answeredBy = '',
});
/// The model the latest reply recorded, shown when the session itself has
/// no model on record.
final String answeredBy;
final ApiGateway gateway;
final String sessionId;
@@ -104,7 +109,12 @@ class _ChatModelControlState extends State<ChatModelControl> {
Widget build(BuildContext context) {
final cupertino =
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
final label = chatModelLabel(_model, _selection);
final backend = '${widget.session['backend'] ?? ''}'.trim();
final label = _model.isNotEmpty
? chatModelLabel(_model, _selection)
: widget.answeredBy.isNotEmpty
? widget.answeredBy
: '${backend.isEmpty ? 'opencode' : backend} default';
final content = Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -683,6 +683,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
sessionId: widget.sessionId,
session: session,
onChanged: widget.onModelChanged,
answeredBy: latestReplyModel(_controller.messages),
),
),
ChatBarAction(