feat(app): show attachments in optimistic chat turns

This commit is contained in:
2026-10-22 23:15:24 +01:00
parent 5779e91cfa
commit 2bd2de5f67
2 changed files with 83 additions and 0 deletions
@@ -8,6 +8,7 @@ import '../../../core/api_gateway.dart';
import '../data/chat_repository.dart';
import '../domain/chat_activity_detail.dart';
import '../domain/chat_notice.dart';
import '../domain/chat_attachment_picker.dart';
import '../domain/chat_transcript.dart';
import '../ui/sessions/chat_adaptive.dart';
import '../ui/sessions/session_actions.dart';
@@ -47,6 +48,7 @@ class ChatThreadView extends StatefulWidget {
this.syncToken = 0,
this.drafts,
this.newOperationId,
this.attachmentPicker,
this.scrollPositions,
this.initialNotice,
this.onCreatedSession,
@@ -94,6 +96,9 @@ class ChatThreadView extends StatefulWidget {
/// Test/fixture seam for deterministic operation ids.
final String Function()? newOperationId;
/// Host picker seam for the thread's composer.
final ChatAttachmentPicker? attachmentPicker;
/// The destination's per-conversation scroll store. The screen supplies one
/// that outlives this view, so a conversation opened again returns to where
/// the operator left it. Null keeps the view stateless across visits.
@@ -198,6 +203,13 @@ class _ChatThreadViewState extends State<ChatThreadView> {
'native_message_id': send.nativeMessageId,
'parts': [
{'type': 'text', 'text': send.text},
for (final attachment in send.attachments)
{
'type': 'file',
'name': attachment['name'],
'uri': attachment['name'],
'mime': attachment['mime'],
},
],
});
});
@@ -850,6 +862,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
composer: _composer,
running: _controller.running,
commands: _commandActions(),
picker: widget.attachmentPicker,
),
],
);