Quieter transcript metadata: day dividers, time-only rows, muted meta rows
- Date once per calendar day: a muted centred divider above each day's
first timed row (chatDayDividers); rows show only their time ("10:16"),
with the full date and time kept in the tooltip and semantics. The user's
time shares the delivery line; a harness notice's time trails its line.
- Activity line and turn chips are secondary: bodyMedium, regular weight,
onSurfaceVariant (error colour kept for failures), a small chevron_right
that turns down while its details are open (replaces expand_less).
- Copy / Read aloud: 18 px muted icons; on pointer devices shown only while
the reply is hovered or an action is focused (also without the gutter);
touch keeps them visible with a full tap target. The time leads the
footer so hidden actions leave no gap.
- Settled questions: the question on one line, the operator's answer in
full on its own line beneath it.
- Meta rows (activity, chips, notices, compaction line) start at the reply
text's leading edge; turn chips sit in their own column under the answer.
- Scroll fixture: ?timestamps=1 spreads messages over two days.
Row keys are unchanged; the divider joins a row without replacing it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,9 +78,10 @@ List<JsonMap> chatRowQuestions(JsonMap row) {
|
||||
];
|
||||
}
|
||||
|
||||
/// The collapsed line for one settled question: the question and its outcome,
|
||||
/// `Which database? · Postgres`, `… · +1 more` when several were answered.
|
||||
String chatQuestionSummary(JsonMap form) {
|
||||
/// One settled question's two lines: the question, and its outcome (the
|
||||
/// operator's answer, `Postgres · +1 more` when several were answered, or
|
||||
/// `Expired`, `Closed`, `Answered`).
|
||||
({String question, String outcome}) chatQuestionSummaryParts(JsonMap form) {
|
||||
final fields = chatFormFields(form);
|
||||
final answers = form['answers'] is Map
|
||||
? Map<String, dynamic>.from(form['answers'] as Map)
|
||||
@@ -93,25 +94,38 @@ String chatQuestionSummary(JsonMap form) {
|
||||
'${fields.first['key'] ?? ''}'.trim(),
|
||||
);
|
||||
}
|
||||
if (form['cancelled'] == true) return '$question · Expired';
|
||||
if (form['cancelled'] == true) {
|
||||
return (question: question, outcome: 'Expired');
|
||||
}
|
||||
final answered = [
|
||||
for (final field in fields)
|
||||
if (answers.containsKey('${field['key'] ?? ''}'.trim())) field,
|
||||
];
|
||||
if (answered.isEmpty) {
|
||||
return answers.isEmpty ? '$question · Closed' : '$question · Answered';
|
||||
final outcome = answers.isEmpty ? 'Closed' : 'Answered';
|
||||
return (question: question, outcome: outcome);
|
||||
}
|
||||
final first = answered.first;
|
||||
final key = '${first['key'] ?? ''}'.trim();
|
||||
final more = answers.length - 1;
|
||||
return [
|
||||
chatQuestionFieldLabel(first, key),
|
||||
chatQuestionAnswerText(first, answers[key]),
|
||||
if (more > 0) '+$more more',
|
||||
].join(' · ');
|
||||
return (
|
||||
question: chatQuestionFieldLabel(first, key),
|
||||
outcome: [
|
||||
chatQuestionAnswerText(first, answers[key]),
|
||||
if (more > 0) '+$more more',
|
||||
].join(' · '),
|
||||
);
|
||||
}
|
||||
|
||||
/// One settled question as the quiet chip a turn's tools use. It opens a
|
||||
/// One settled question on one line, `Which database? · Postgres`: the
|
||||
/// chip's accessible name.
|
||||
String chatQuestionSummary(JsonMap form) {
|
||||
final parts = chatQuestionSummaryParts(form);
|
||||
return '${parts.question} · ${parts.outcome}';
|
||||
}
|
||||
|
||||
/// One settled question as the quiet chip a turn's tools use: the question
|
||||
/// on one line and the operator's answer in full beneath it. It opens a
|
||||
/// native sheet with the full question and the recorded answers.
|
||||
class ChatQuestionChip extends StatelessWidget {
|
||||
const ChatQuestionChip({super.key, required this.form});
|
||||
@@ -120,16 +134,25 @@ class ChatQuestionChip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final theme = Theme.of(context);
|
||||
final color = theme.colorScheme.onSurfaceVariant;
|
||||
final parts = chatQuestionSummaryParts(form);
|
||||
final label = chatQuestionSummary(form);
|
||||
return ChatTurnChip(
|
||||
chipKey: ValueKey<String>('chat-question-chip-${form['id']}'),
|
||||
leading: Icon(Icons.help_outline, size: 14, color: color),
|
||||
label: label,
|
||||
label: parts.question,
|
||||
color: color,
|
||||
ellipsizeLabel: true,
|
||||
semanticsLabel: 'Question: $label, expand for details',
|
||||
sheet: _QuestionSheet(form: form),
|
||||
detail: Text(
|
||||
parts.outcome,
|
||||
key: ValueKey<String>('chat-question-answer-${form['id']}'),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ import '../ui/sessions/chat_adaptive.dart';
|
||||
import '../ui/transcript/chat_markdown_view.dart';
|
||||
import '../ui/transcript/chat_message_bubble.dart';
|
||||
import '../ui/transcript/chat_message_view.dart';
|
||||
import '../ui/transcript/chat_message_timestamp.dart';
|
||||
import '../ui/transcript/chat_turn_activity_view.dart';
|
||||
import '../domain/chat_transcript_days.dart';
|
||||
import '../ui/transcript/chat_transcript_selection.dart';
|
||||
import '../ui/transcript/chat_injected_rows.dart';
|
||||
import '../ui/transcript/shown/chat_shown_card.dart';
|
||||
@@ -1271,6 +1274,9 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
// other row keeps to the column by insetting past it.
|
||||
final gutter = chatCopyGutter(constraints.maxWidth);
|
||||
final media = MediaQuery.paddingOf(context);
|
||||
// The date shows once per calendar day, above that day's
|
||||
// first row; each row itself shows only its time.
|
||||
final days = chatDayDividers(rows);
|
||||
final transcript = [
|
||||
for (var index = 0; index < rows.length; index++)
|
||||
Padding(
|
||||
@@ -1286,25 +1292,33 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
// Slivers mount only visible rows. Defer constructing
|
||||
// their chips and checking cached widgets until then,
|
||||
// rather than visiting the entire history per delta.
|
||||
child: ChatTranscriptRowSelection(
|
||||
child: ChatCopyGutter(
|
||||
width: rows[index]['kind'] == 'assistant'
|
||||
? gutter
|
||||
: 0,
|
||||
child: Builder(
|
||||
builder: (_) => _entering(
|
||||
rows[index],
|
||||
_transcriptRow(
|
||||
child: ChatDayDivided(
|
||||
day: days[index],
|
||||
// An answer row starts at the gutter; the divider
|
||||
// keeps to the reading column.
|
||||
inset: rows[index]['kind'] == 'assistant'
|
||||
? gutter
|
||||
: 0,
|
||||
child: ChatTranscriptRowSelection(
|
||||
child: ChatCopyGutter(
|
||||
width: rows[index]['kind'] == 'assistant'
|
||||
? gutter
|
||||
: 0,
|
||||
child: Builder(
|
||||
builder: (_) => _entering(
|
||||
rows[index],
|
||||
keys[index],
|
||||
onDismissCompaction:
|
||||
compactionNotice != null &&
|
||||
chatNoticeActivityCondition(
|
||||
rows[index],
|
||||
) ==
|
||||
compactionNotice.condition
|
||||
? () => _dismiss(compactionNotice)
|
||||
: null,
|
||||
_transcriptRow(
|
||||
rows[index],
|
||||
keys[index],
|
||||
onDismissCompaction:
|
||||
compactionNotice != null &&
|
||||
chatNoticeActivityCondition(
|
||||
rows[index],
|
||||
) ==
|
||||
compactionNotice.condition
|
||||
? () => _dismiss(compactionNotice)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -2249,8 +2263,13 @@ class _ChatActivityLineState extends State<_ChatActivityLine> {
|
||||
? Icons.check_circle_outline
|
||||
: Icons.circle_outlined;
|
||||
final label = '${widget.row['label'] ?? ''}'.trim();
|
||||
// The icon starts at the reply text's edge, like the turn's activity line.
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: chatAgentContentInset,
|
||||
top: 6,
|
||||
bottom: 6,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import '../../../core/api_gateway.dart';
|
||||
import 'chat_transcript.dart';
|
||||
|
||||
/// When a transcript row was recorded, in epoch milliseconds, or null when it
|
||||
/// carries no valid time (cards, grouped chips, local rows).
|
||||
///
|
||||
/// An agent turn records its first message's time on the row; a user turn, a
|
||||
/// notice or a report carries it on its `message`; a run of grouped notices
|
||||
/// takes its first notice's.
|
||||
int? chatRowCreatedAt(JsonMap row) {
|
||||
final own = chatMessageCreatedAt(row);
|
||||
if (own != null) return own;
|
||||
final message = row['message'];
|
||||
if (message is Map) {
|
||||
return chatMessageCreatedAt(Map<String, dynamic>.from(message));
|
||||
}
|
||||
final messages = row['messages'];
|
||||
if (messages is List) {
|
||||
for (final message in messages) {
|
||||
if (message is! Map) continue;
|
||||
final time = chatMessageCreatedAt(Map<String, dynamic>.from(message));
|
||||
if (time != null) return time;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// The local calendar day of epoch milliseconds [createdAt].
|
||||
DateTime chatLocalDay(int createdAt) {
|
||||
final local = DateTime.fromMillisecondsSinceEpoch(
|
||||
createdAt,
|
||||
isUtc: true,
|
||||
).toLocal();
|
||||
return DateTime(local.year, local.month, local.day);
|
||||
}
|
||||
|
||||
/// For each of [rows], the local day a date divider above it names, or null.
|
||||
///
|
||||
/// The first timed row of each calendar day gets its day, so a transcript
|
||||
/// shows the date once per day and each row only its time. Rows without a
|
||||
/// time never start a day and never break one.
|
||||
List<DateTime?> chatDayDividers(List<JsonMap> rows) {
|
||||
DateTime? current;
|
||||
return [
|
||||
for (final row in rows)
|
||||
switch (chatRowCreatedAt(row)) {
|
||||
null => null,
|
||||
final time when chatLocalDay(time) == current => null,
|
||||
final time => current = chatLocalDay(time),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -3,6 +3,8 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'chat_hover_actions.dart';
|
||||
|
||||
/// The accessible name of a reply's copy control, and its name just after a
|
||||
/// copy succeeded.
|
||||
const String chatCopyLabel = 'Copy';
|
||||
@@ -67,6 +69,7 @@ class _ChatCopyButtonState extends State<ChatCopyButton> {
|
||||
}
|
||||
return IconButton(
|
||||
key: const Key('chat-message-copy'),
|
||||
style: chatMessageActionStyle(context),
|
||||
tooltip: label,
|
||||
onPressed: _copy,
|
||||
icon: Icon(_copied ? Icons.check : Icons.copy_outlined),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/platform.dart';
|
||||
import 'chat_hover_actions.dart';
|
||||
|
||||
/// The width of the strip left of the reading column that an answer row
|
||||
/// draws its Copy button in (`chatCopyGutter`); 0 when there is no room, and
|
||||
@@ -45,7 +45,7 @@ List<Widget> chatCopyGutterInset(
|
||||
/// pointer is over the answer or the button has focus; it stays in the
|
||||
/// focus order and the semantics tree when hidden. Touch platforms always
|
||||
/// show it.
|
||||
class ChatCopyGutterRow extends StatefulWidget {
|
||||
class ChatCopyGutterRow extends StatelessWidget {
|
||||
const ChatCopyGutterRow({
|
||||
super.key,
|
||||
required this.width,
|
||||
@@ -63,54 +63,31 @@ class ChatCopyGutterRow extends StatefulWidget {
|
||||
/// Keeps the buttons shown without hover (while the reply reads aloud).
|
||||
final bool pinned;
|
||||
|
||||
@override
|
||||
State<ChatCopyGutterRow> createState() => _ChatCopyGutterRowState();
|
||||
}
|
||||
|
||||
class _ChatCopyGutterRowState extends State<ChatCopyGutterRow> {
|
||||
bool _hovered = false;
|
||||
bool _focused = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hover = prefersCompactHitTargets(context);
|
||||
final copy = widget.copy;
|
||||
final row = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
key: const Key('chat-copy-gutter'),
|
||||
width: widget.width,
|
||||
child: copy == null
|
||||
? null
|
||||
: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Focus(
|
||||
canRequestFocus: false,
|
||||
skipTraversal: true,
|
||||
onFocusChange: (focused) =>
|
||||
setState(() => _focused = focused),
|
||||
child: AnimatedOpacity(
|
||||
key: const Key('chat-copy-gutter-visibility'),
|
||||
opacity: !hover || widget.pinned || _hovered || _focused
|
||||
? 1
|
||||
: 0,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
alwaysIncludeSemantics: true,
|
||||
final copy = this.copy;
|
||||
return ChatHoverRegion(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
key: const Key('chat-copy-gutter'),
|
||||
width: width,
|
||||
child: copy == null
|
||||
? null
|
||||
: Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: ChatHoverReveal(
|
||||
visibilityKey: const Key('chat-copy-gutter-visibility'),
|
||||
pinned: pinned,
|
||||
child: copy,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(child: widget.child),
|
||||
],
|
||||
);
|
||||
if (!hover || copy == null) return row;
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: row,
|
||||
),
|
||||
Flexible(child: child),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/platform.dart';
|
||||
|
||||
/// The area whose hover reveals a message's actions ([ChatHoverReveal]). On a
|
||||
/// touch device it is the bare [child]: there is no hover and the actions
|
||||
/// always show.
|
||||
class ChatHoverRegion extends StatefulWidget {
|
||||
const ChatHoverRegion({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<ChatHoverRegion> createState() => _ChatHoverRegionState();
|
||||
}
|
||||
|
||||
class _ChatHoverRegionState extends State<ChatHoverRegion> {
|
||||
bool _hovered = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!prefersCompactHitTargets(context)) return widget.child;
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: _ChatHoverScope(hovered: _hovered, child: widget.child),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ChatHoverScope extends InheritedWidget {
|
||||
const _ChatHoverScope({required this.hovered, required super.child});
|
||||
|
||||
final bool hovered;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(_ChatHoverScope oldWidget) =>
|
||||
hovered != oldWidget.hovered;
|
||||
}
|
||||
|
||||
/// A message's action buttons, shown on a pointer device only while the
|
||||
/// enclosing [ChatHoverRegion] is hovered, one of them has focus, or [pinned]
|
||||
/// (a reply reading aloud). Hidden actions stay in the focus order and the
|
||||
/// semantics tree, so keyboard and assistive users still reach them. Touch
|
||||
/// devices always show them.
|
||||
class ChatHoverReveal extends StatefulWidget {
|
||||
const ChatHoverReveal({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.pinned = false,
|
||||
this.visibilityKey,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final bool pinned;
|
||||
|
||||
/// The key of the fading widget, for tests.
|
||||
final Key? visibilityKey;
|
||||
|
||||
@override
|
||||
State<ChatHoverReveal> createState() => _ChatHoverRevealState();
|
||||
}
|
||||
|
||||
class _ChatHoverRevealState extends State<ChatHoverReveal> {
|
||||
bool _focused = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hoverDevice = prefersCompactHitTargets(context);
|
||||
final hovered =
|
||||
context
|
||||
.dependOnInheritedWidgetOfExactType<_ChatHoverScope>()
|
||||
?.hovered ??
|
||||
false;
|
||||
final shown = !hoverDevice || widget.pinned || hovered || _focused;
|
||||
return Focus(
|
||||
canRequestFocus: false,
|
||||
skipTraversal: true,
|
||||
onFocusChange: (focused) => setState(() => _focused = focused),
|
||||
child: AnimatedOpacity(
|
||||
key: widget.visibilityKey,
|
||||
opacity: shown ? 1 : 0,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
alwaysIncludeSemantics: true,
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The compact, muted style of a message's icon actions (Copy, Read aloud):
|
||||
/// smaller than the text they follow. Touch devices keep a full-size tap
|
||||
/// target around the small icon.
|
||||
ButtonStyle chatMessageActionStyle(BuildContext context) {
|
||||
final compact = prefersCompactHitTargets(context);
|
||||
return IconButton.styleFrom(
|
||||
foregroundColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
iconSize: 18,
|
||||
padding: const EdgeInsets.all(8),
|
||||
minimumSize: const Size.square(34),
|
||||
tapTargetSize: compact
|
||||
? MaterialTapTargetSize.shrinkWrap
|
||||
: MaterialTapTargetSize.padded,
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core/api_gateway.dart';
|
||||
import '../../domain/chat_transcript_days.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import 'chat_message_timestamp.dart';
|
||||
import 'chat_message_view.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
|
||||
/// Content the harness delivered into the session, drawn on the agent's side:
|
||||
/// an `agent_report` row (a delegated agent's report) and a `system_notice`
|
||||
@@ -162,28 +165,50 @@ class ChatSystemNoticeLine extends StatelessWidget {
|
||||
if (text.isEmpty) return const SizedBox.shrink();
|
||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final style = Theme.of(context).textTheme.bodySmall?.copyWith(color: color);
|
||||
return Semantics(
|
||||
container: true,
|
||||
label: 'System notice',
|
||||
value: text,
|
||||
child: ExcludeSemantics(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(end: 8),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: style?.fontSize == null ? 16 : style!.fontSize! * 1.2,
|
||||
color: color,
|
||||
final time = chatRowCreatedAt(row);
|
||||
// The icon starts at the reply text's edge, like the turn's activity line.
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
chatAgentContentInset,
|
||||
6,
|
||||
chatAgentContentInset,
|
||||
6,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Semantics(
|
||||
container: true,
|
||||
label: 'System notice',
|
||||
value: text,
|
||||
child: ExcludeSemantics(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(end: 8),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: style?.fontSize == null
|
||||
? 16
|
||||
: style!.fontSize! * 1.2,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
Expanded(child: Text(text, style: style)),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: Text(text, style: style)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Its time trails on the same line, as an answer's does.
|
||||
if (time != null)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(start: 8),
|
||||
child: ChatMessageTimestamp(createdAt: time),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The small, non-selectable metadata line for a recorded chat message time.
|
||||
/// The visible value includes a local date so messages from different days are
|
||||
/// not ambiguous; the tooltip and semantics expose the full localized value.
|
||||
/// The local date as the transcript's day divider names it: `25 November 2026`.
|
||||
String chatDayLabel(BuildContext context, DateTime day) =>
|
||||
'${day.day} ${MaterialLocalizations.of(context).formatMonthYear(day)}';
|
||||
|
||||
/// The small, non-selectable time of a recorded chat message: `10:16`. The
|
||||
/// date is named once per day by [ChatDayDivider]; the tooltip and semantics
|
||||
/// still carry the full localized date and time.
|
||||
class ChatMessageTimestamp extends StatelessWidget {
|
||||
const ChatMessageTimestamp({super.key, required this.createdAt});
|
||||
|
||||
@@ -23,23 +27,92 @@ class ChatMessageTimestamp extends StatelessWidget {
|
||||
TimeOfDay.fromDateTime(instant),
|
||||
alwaysUse24HourFormat: true,
|
||||
);
|
||||
final date = '${instant.day} ${material.formatMonthYear(instant)}';
|
||||
final full = '$date, $time';
|
||||
final style = (Theme.of(context).textTheme.bodySmall ?? const TextStyle())
|
||||
.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
);
|
||||
final label = 'Sent $full';
|
||||
final text = Text('$date · $time', style: style);
|
||||
final full = '${chatDayLabel(context, instant)}, $time';
|
||||
final style = chatMetaTextStyle(context);
|
||||
return SelectionContainer.disabled(
|
||||
child: Tooltip(
|
||||
message: full,
|
||||
child: Semantics(
|
||||
container: true,
|
||||
label: label,
|
||||
label: 'Sent $full',
|
||||
excludeSemantics: true,
|
||||
child: text,
|
||||
child: Text(time, style: style),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The muted small text of transcript metadata (times, the answering model).
|
||||
TextStyle? chatMetaTextStyle(BuildContext context) => Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant);
|
||||
|
||||
/// A transcript row with the [ChatDayDivider] for [day] above it when the row
|
||||
/// starts a calendar day. The row keeps its element whether or not a divider
|
||||
/// joins or leaves above it (an older page arriving moves the day's start).
|
||||
class ChatDayDivided extends StatelessWidget {
|
||||
const ChatDayDivided({
|
||||
super.key,
|
||||
required this.day,
|
||||
required this.child,
|
||||
this.inset = 0,
|
||||
});
|
||||
|
||||
final DateTime? day;
|
||||
|
||||
/// Leading space before the divider, so it keeps to the reading column.
|
||||
final double inset;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final day = this.day;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (day != null)
|
||||
Padding(
|
||||
key: const ValueKey<String>('chat-day-divider'),
|
||||
padding: EdgeInsetsDirectional.only(start: inset),
|
||||
child: ChatDayDivider(day: day),
|
||||
),
|
||||
KeyedSubtree(key: const ValueKey<String>('chat-day-row'), child: child),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A quiet centred date between two thin rules, above the first message of
|
||||
/// each calendar day in the transcript.
|
||||
class ChatDayDivider extends StatelessWidget {
|
||||
const ChatDayDivider({super.key, required this.day});
|
||||
|
||||
final DateTime day;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final label = chatDayLabel(context, day);
|
||||
return SelectionContainer.disabled(
|
||||
child: Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
label: label,
|
||||
excludeSemantics: true,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Expanded(child: Divider()),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Text(label, style: chatMetaTextStyle(context)),
|
||||
),
|
||||
const Expanded(child: Divider()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import '../../domain/chat_tool_calls.dart';
|
||||
import '../../domain/chat_transcript.dart';
|
||||
import 'chat_copy_button.dart';
|
||||
import 'chat_copy_gutter.dart';
|
||||
import 'chat_hover_actions.dart';
|
||||
import 'chat_link_text.dart';
|
||||
import 'chat_message_bubble.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
@@ -55,7 +56,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
final role = user ? 'User' : 'Assistant';
|
||||
final content = user ? _userParts(context) : _agentParts(context);
|
||||
// A wide window draws an answer's Copy in the gutter left of the reading
|
||||
// column; without room it stays at the start of the answer's footer.
|
||||
// column; without room it trails the time in the answer's footer.
|
||||
final gutter = user ? 0.0 : ChatCopyGutter.of(context);
|
||||
// No visible role label: side and surface say who spoke and the row's
|
||||
// semantics label names the role. The operator's turn is a neutral bubble
|
||||
@@ -139,17 +140,17 @@ class ChatMessageView extends StatelessWidget {
|
||||
const SizedBox(height: 6),
|
||||
if (content.isNotEmpty || thumbnails.isEmpty)
|
||||
ChatUserBubble(child: body),
|
||||
if (footer.isNotEmpty) ...[
|
||||
// The delivery line and the time share one line under the bubble.
|
||||
if (footer.isNotEmpty || hasTimestamp) ...[
|
||||
const SizedBox(height: 2),
|
||||
Wrap(
|
||||
key: const Key('chat-message-footer'),
|
||||
spacing: 8,
|
||||
alignment: WrapAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: footer,
|
||||
children: [...footer, if (hasTimestamp) timestamp],
|
||||
),
|
||||
],
|
||||
if (hasTimestamp) ...[const SizedBox(height: 2), timestamp],
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -179,7 +180,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// The answer, with its Copy button in the [gutter] to its left when there
|
||||
/// is one, or else first in its footer.
|
||||
/// is one, or else after the time in its footer.
|
||||
Widget _agentRow(
|
||||
BuildContext context,
|
||||
List<Widget> content,
|
||||
@@ -207,7 +208,23 @@ class ChatMessageView extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
if (gutter <= 0) {
|
||||
return _agentTurn(context, content, answer, actions(Axis.horizontal));
|
||||
// Without a gutter the actions trail the footer line; a pointer device
|
||||
// shows them while the answer is hovered or one has focus.
|
||||
final row = actions(Axis.horizontal);
|
||||
final reveal = row == null
|
||||
? null
|
||||
: ListenableBuilder(
|
||||
listenable: speechController,
|
||||
child: row,
|
||||
builder: (context, child) => ChatHoverReveal(
|
||||
visibilityKey: const Key('chat-message-actions-visibility'),
|
||||
pinned: speechController.messageId == id,
|
||||
child: child!,
|
||||
),
|
||||
);
|
||||
return ChatHoverRegion(
|
||||
child: _agentTurn(context, content, answer, reveal),
|
||||
);
|
||||
}
|
||||
// The gutter is one button wide: Read aloud stacks above Copy, and stays
|
||||
// shown on a desktop while this reply reads.
|
||||
@@ -244,14 +261,14 @@ class ChatMessageView extends StatelessWidget {
|
||||
if (isChatToolPart(part)) part,
|
||||
];
|
||||
final model = '${row['model'] ?? ''}'.trim();
|
||||
final footer = <Widget>[
|
||||
?copy,
|
||||
...this.footer,
|
||||
// The metadata line: the model that answered and the time, muted; the
|
||||
// actions (when not in the gutter) trail it.
|
||||
final meta = <Widget>[
|
||||
if (model.isNotEmpty)
|
||||
Text(
|
||||
model,
|
||||
key: const Key('chat-reply-model'),
|
||||
style: TextStyle(fontSize: 12, color: _secondaryColor(context)),
|
||||
style: chatMetaTextStyle(context),
|
||||
),
|
||||
if (chatMessageCreatedAt(row) case final time?)
|
||||
ChatMessageTimestamp(createdAt: time),
|
||||
@@ -276,24 +293,37 @@ class ChatMessageView extends StatelessWidget {
|
||||
),
|
||||
// A little air between the one-line turn status and the answer.
|
||||
if (content.isNotEmpty) const SizedBox(height: 6),
|
||||
if (content.isNotEmpty || footer.isNotEmpty)
|
||||
if (content.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: chatAgentContentInset,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (content.isNotEmpty) answer,
|
||||
if (footer.isNotEmpty)
|
||||
Wrap(
|
||||
key: const Key('chat-message-footer'),
|
||||
spacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: footer,
|
||||
),
|
||||
],
|
||||
child: answer,
|
||||
),
|
||||
// Settled permissions, questions and changes: meta rows that, like
|
||||
// the activity line, sit at the row edge with their content inset to
|
||||
// the answer's text.
|
||||
if (footer.isNotEmpty)
|
||||
Column(
|
||||
key: const Key('chat-turn-chips'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: footer,
|
||||
),
|
||||
if (copy != null || meta.isNotEmpty)
|
||||
Padding(
|
||||
// The time starts at the answer's text edge and the actions
|
||||
// trail it, so hidden actions leave no gap before it. Without
|
||||
// metadata the buttons' own inset aligns their icons instead.
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: meta.isEmpty ? 0 : chatAgentContentInset,
|
||||
end: chatAgentContentInset,
|
||||
),
|
||||
child: Wrap(
|
||||
key: const Key('chat-message-footer'),
|
||||
spacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [...meta, ?copy],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../speech/speech.dart';
|
||||
import 'chat_hover_actions.dart';
|
||||
|
||||
const chatReadAloudLabel = 'Read aloud';
|
||||
const chatPauseReadingLabel = 'Pause reading';
|
||||
@@ -33,9 +34,11 @@ class ChatReadAloudButton extends StatelessWidget {
|
||||
return ListenableBuilder(
|
||||
listenable: speech,
|
||||
builder: (context, _) {
|
||||
final style = chatMessageActionStyle(context);
|
||||
if (speech.messageId != messageId) {
|
||||
return IconButton(
|
||||
key: const Key('chat-message-read-aloud'),
|
||||
style: style,
|
||||
tooltip: chatReadAloudLabel,
|
||||
onPressed: () => unawaited(speech.read(messageId, parts)),
|
||||
icon: const Icon(Icons.volume_up_outlined),
|
||||
@@ -48,6 +51,7 @@ class ChatReadAloudButton extends StatelessWidget {
|
||||
children: [
|
||||
IconButton(
|
||||
key: const Key('chat-message-read-aloud-pause'),
|
||||
style: style,
|
||||
tooltip: paused ? chatResumeReadingLabel : chatPauseReadingLabel,
|
||||
onPressed: () =>
|
||||
unawaited(paused ? speech.resume() : speech.pause()),
|
||||
@@ -57,6 +61,7 @@ class ChatReadAloudButton extends StatelessWidget {
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('chat-message-read-aloud-stop'),
|
||||
style: style,
|
||||
tooltip: chatStopReadingLabel,
|
||||
onPressed: () => unawaited(speech.stop()),
|
||||
icon: const Icon(Icons.stop_outlined),
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../../domain/chat_turn_activity.dart';
|
||||
import '../../../../ui/adaptive/platform.dart';
|
||||
import 'chat_response_pending.dart';
|
||||
import 'chat_turn_activity_details.dart';
|
||||
import 'chat_turn_chip.dart';
|
||||
|
||||
/// The activity control's content inset is shared with the rest of the reply.
|
||||
const chatAgentContentInset = 8.0;
|
||||
@@ -82,10 +83,10 @@ class _ChatTurnActivityViewState extends State<ChatTurnActivityView> {
|
||||
}
|
||||
|
||||
final route = DialogRoute<void>(context: context, builder: dialog);
|
||||
_modal = route;
|
||||
setState(() => _modal = route);
|
||||
Navigator.of(context, rootNavigator: true).push(route);
|
||||
route.completed.then((_) {
|
||||
if (_modal == route) _modal = null;
|
||||
if (_modal == route && mounted) setState(() => _modal = null);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,11 +141,15 @@ class _ChatTurnActivityViewState extends State<ChatTurnActivityView> {
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: color),
|
||||
style: chatTurnChipTextStyle(context, color),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.chevron_right, color: color),
|
||||
const SizedBox(width: 2),
|
||||
AnimatedRotation(
|
||||
turns: _modal != null ? 0.25 : 0,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Icon(Icons.chevron_right, size: 18, color: color),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/app_popups.dart';
|
||||
import 'chat_turn_activity_view.dart';
|
||||
|
||||
/// The quiet chip under an agent turn (its tools, its permissions) and the
|
||||
/// native sheet it opens.
|
||||
class ChatTurnChip extends StatelessWidget {
|
||||
///
|
||||
/// Its leading icon starts at the reply text's edge: the chip sits at the
|
||||
/// row's edge with the same inset as the turn's activity line. Its chevron is
|
||||
/// the transcript's expand affordance and turns down while the sheet is open.
|
||||
class ChatTurnChip extends StatefulWidget {
|
||||
const ChatTurnChip({
|
||||
super.key,
|
||||
required this.chipKey,
|
||||
@@ -16,6 +21,7 @@ class ChatTurnChip extends StatelessWidget {
|
||||
this.open,
|
||||
this.ellipsizeLabel = false,
|
||||
this.labelSpans,
|
||||
this.detail,
|
||||
}) : assert(sheet != null || open != null);
|
||||
|
||||
final Key chipKey;
|
||||
@@ -38,35 +44,72 @@ class ChatTurnChip extends StatelessWidget {
|
||||
/// plain text. Pieces without their own style inherit the chip's style.
|
||||
final List<InlineSpan> Function(BuildContext context)? labelSpans;
|
||||
|
||||
/// A second line under the label, shown in full (a question's answer).
|
||||
final Widget? detail;
|
||||
|
||||
@override
|
||||
State<ChatTurnChip> createState() => _ChatTurnChipState();
|
||||
}
|
||||
|
||||
class _ChatTurnChipState extends State<ChatTurnChip> {
|
||||
bool _open = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = Row(
|
||||
final labelRow = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
leading,
|
||||
const SizedBox(width: 6),
|
||||
if (ellipsizeLabel)
|
||||
if (widget.ellipsizeLabel || widget.detail != null)
|
||||
Flexible(child: _label(maxLines: 1, overflow: TextOverflow.ellipsis))
|
||||
else
|
||||
_label(),
|
||||
Icon(Icons.expand_less, size: 14, color: color),
|
||||
const SizedBox(width: 2),
|
||||
AnimatedRotation(
|
||||
turns: _open ? 0.25 : 0,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
child: Icon(Icons.chevron_right, size: 18, color: widget.color),
|
||||
),
|
||||
],
|
||||
);
|
||||
final content = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(top: 2),
|
||||
child: widget.leading,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: widget.detail == null
|
||||
? labelRow
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [labelRow, widget.detail!],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
return Semantics(
|
||||
button: true,
|
||||
expanded: _open,
|
||||
// The child's own action is excluded with its label, so the node
|
||||
// carries the activation for assistive technology.
|
||||
onTap: () => _open(context),
|
||||
label: semanticsLabel,
|
||||
onTap: _show,
|
||||
label: widget.semanticsLabel,
|
||||
excludeSemantics: true,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: InkWell(
|
||||
key: chipKey,
|
||||
key: widget.chipKey,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () => _open(context),
|
||||
onTap: _show,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: chatAgentContentInset,
|
||||
vertical: 6,
|
||||
),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
@@ -75,10 +118,15 @@ class ChatTurnChip extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _label({int? maxLines, TextOverflow? overflow}) {
|
||||
final style = TextStyle(color: color, fontSize: 13);
|
||||
final spans = labelSpans;
|
||||
final style = chatTurnChipTextStyle(context, widget.color);
|
||||
final spans = widget.labelSpans;
|
||||
if (spans == null) {
|
||||
return Text(label, maxLines: maxLines, overflow: overflow, style: style);
|
||||
return Text(
|
||||
widget.label,
|
||||
maxLines: maxLines,
|
||||
overflow: overflow,
|
||||
style: style,
|
||||
);
|
||||
}
|
||||
return Builder(
|
||||
builder: (context) => Text.rich(
|
||||
@@ -90,12 +138,27 @@ class ChatTurnChip extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _open(BuildContext context) {
|
||||
if (open case final open?) return open(context);
|
||||
return showChatTurnSheet(context, sheet!);
|
||||
Future<void> _show() async {
|
||||
if (_open) return;
|
||||
setState(() => _open = true);
|
||||
try {
|
||||
if (widget.open case final open?) {
|
||||
await open(context);
|
||||
} else {
|
||||
await showChatTurnSheet(context, widget.sheet!);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) setState(() => _open = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The secondary text of a turn's meta rows (chips, the activity line):
|
||||
/// smaller and quieter than the reply's prose.
|
||||
TextStyle? chatTurnChipTextStyle(BuildContext context, Color color) => Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(color: color, fontWeight: FontWeight.w400);
|
||||
|
||||
/// The detail surface a turn chip opens: a dialog on desktop and a bottom
|
||||
/// sheet on a phone.
|
||||
Future<void> showChatTurnSheet(BuildContext context, Widget sheet) {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_timestamp.dart';
|
||||
|
||||
import '../shell/chat_shell_fixtures.dart';
|
||||
|
||||
JsonMap _message(String id, String role, DateTime at) => {
|
||||
'id': id,
|
||||
'role': role,
|
||||
'created_at': at.millisecondsSinceEpoch,
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'Text of $id'},
|
||||
],
|
||||
};
|
||||
|
||||
void main() {
|
||||
testWidgets('the transcript dates each day once and each row by its time', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(900, 2400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final gateway = ShellGateway()
|
||||
..messages = [
|
||||
_message('u1', 'user', DateTime(2026, 11, 24, 9, 5)),
|
||||
_message('a1', 'assistant', DateTime(2026, 11, 24, 9, 6)),
|
||||
_message('u2', 'user', DateTime(2026, 11, 24, 17, 40)),
|
||||
_message('a2', 'assistant', DateTime(2026, 11, 24, 17, 41)),
|
||||
_message('u3', 'user', DateTime(2026, 11, 25, 10, 16)),
|
||||
_message('a3', 'assistant', DateTime(2026, 11, 25, 10, 17)),
|
||||
];
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final dividers = find.byType(ChatDayDivider);
|
||||
expect(dividers, findsNWidgets(2));
|
||||
expect(find.text('24 November 2026'), findsOneWidget);
|
||||
expect(find.text('25 November 2026'), findsOneWidget);
|
||||
// The first day's divider precedes its first message; the second day's
|
||||
// sits between the last message of the 24th and the first of the 25th.
|
||||
final first = tester.getRect(find.text('24 November 2026'));
|
||||
final second = tester.getRect(find.text('25 November 2026'));
|
||||
expect(first.bottom, lessThan(tester.getRect(find.text('Text of u1')).top));
|
||||
expect(
|
||||
second.top,
|
||||
greaterThan(tester.getRect(find.text('Text of a2')).top),
|
||||
);
|
||||
expect(
|
||||
second.bottom,
|
||||
lessThan(tester.getRect(find.text('Text of u3')).top),
|
||||
);
|
||||
|
||||
// Every row shows its time alone; no row repeats the date.
|
||||
expect(find.byType(ChatMessageTimestamp), findsNWidgets(6));
|
||||
for (final time in ['09:05', '09:06', '17:40', '17:41', '10:16', '10:17']) {
|
||||
expect(find.text(time), findsOneWidget);
|
||||
}
|
||||
expect(find.textContaining('November 2026 ·'), findsNothing);
|
||||
// The divider names its day for assistive technology as a heading.
|
||||
expect(
|
||||
tester.getSemantics(dividers.first),
|
||||
isSemantics(label: '24 November 2026', isHeader: true),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
|
||||
import '../shell/chat_shell_fixtures.dart';
|
||||
|
||||
const _reply = 'The reply text';
|
||||
|
||||
final List<JsonMap> _messages = [
|
||||
{
|
||||
'id': 'u1',
|
||||
'role': 'user',
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'Question'},
|
||||
],
|
||||
},
|
||||
{
|
||||
'id': 'a1',
|
||||
'role': 'assistant',
|
||||
'parts': [
|
||||
{'type': 'reasoning', 'text': 'Thinking it over.'},
|
||||
{
|
||||
'type': 'tool',
|
||||
'id': 't1',
|
||||
'name': 'read',
|
||||
'state': 'completed',
|
||||
'input': {'path': 'lib/main.dart'},
|
||||
},
|
||||
{'type': 'text', 'text': _reply},
|
||||
],
|
||||
},
|
||||
{
|
||||
'id': 'n1',
|
||||
'role': 'user',
|
||||
'kind': 'notice',
|
||||
'parts': [
|
||||
{'type': 'text', 'text': 'The harness compacted the context.'},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
void main() {
|
||||
for (final width in [390.0, 1400.0]) {
|
||||
testWidgets('at ${width.toInt()} px every meta row starts at the reply '
|
||||
'text\'s edge', (tester) async {
|
||||
tester.view.physicalSize = Size(width, 1200);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final gateway = ShellGateway()..messages = _messages;
|
||||
addTearDown(gateway.close);
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final text = tester.getRect(find.text(_reply)).left;
|
||||
// The activity line's label.
|
||||
final activity = find.descendant(
|
||||
of: find.byKey(const Key('chat-turn-activity')),
|
||||
matching: find.byType(Text),
|
||||
);
|
||||
expect(tester.getRect(activity.first).left, text);
|
||||
// The harness notice's icon.
|
||||
expect(tester.getRect(find.byIcon(Icons.info_outline)).left, text);
|
||||
|
||||
// The activity label is secondary: smaller than the reply, regular
|
||||
// weight, in the muted colour.
|
||||
final label = tester.widget<Text>(activity.first);
|
||||
final context = tester.element(activity.first);
|
||||
final theme = Theme.of(context);
|
||||
expect(label.style?.color, theme.colorScheme.onSurfaceVariant);
|
||||
expect(label.style?.fontWeight, FontWeight.w400);
|
||||
expect(
|
||||
label.style?.fontSize,
|
||||
lessThan(theme.textTheme.bodyLarge!.fontSize!),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,9 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
// The answered question leaves the card list (chat_question_group_test).
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Colour · Red · +1 more'), findsOneWidget);
|
||||
// Collapsed: the question on one line, the answer in full on its own.
|
||||
expect(find.text('Colour'), findsOneWidget);
|
||||
expect(find.text('Red · +1 more'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a refused question keeps the card open with the server reason', (
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_question_group.dart';
|
||||
|
||||
const _answer =
|
||||
'Postgres 16 on the managed cluster, with read replicas in both regions '
|
||||
'and nightly backups kept for thirty days';
|
||||
|
||||
JsonMap _form() => {
|
||||
'id': 'form-1',
|
||||
'title': 'Database',
|
||||
'resolved': true,
|
||||
'answers': {'q0': _answer},
|
||||
'fields': [
|
||||
{
|
||||
'key': 'q0',
|
||||
'title': 'Which database should the release use?',
|
||||
'type': 'string',
|
||||
'custom': true,
|
||||
'options': [
|
||||
{'value': 'Postgres', 'label': 'Postgres'},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
final _chip = find.byKey(const ValueKey('chat-question-chip-form-1'));
|
||||
final _answerLine = find.byKey(const ValueKey('chat-question-answer-form-1'));
|
||||
|
||||
Future<void> _pump(WidgetTester tester) async {
|
||||
await tester.binding.setSurfaceSize(const Size(390, 844));
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
alignment: AlignmentDirectional.topStart,
|
||||
child: ChatQuestionChip(form: _form()),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('the summary splits into the question and its outcome', () {
|
||||
final parts = chatQuestionSummaryParts(_form());
|
||||
expect(parts.question, 'Which database should the release use?');
|
||||
expect(parts.outcome, _answer);
|
||||
expect(
|
||||
chatQuestionSummary(_form()),
|
||||
'Which database should the release use? · $_answer',
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('a settled question shows its whole answer on its own line', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester);
|
||||
final question = find.text('Which database should the release use?');
|
||||
expect(question, findsOneWidget);
|
||||
expect(find.text(_answer), findsOneWidget);
|
||||
// The answer wraps in full rather than ellipsizing on the question's line.
|
||||
final answer = tester.widget<Text>(_answerLine);
|
||||
expect(answer.maxLines, isNull);
|
||||
expect(answer.overflow, isNot(TextOverflow.ellipsis));
|
||||
final line = tester.getRect(question);
|
||||
final rect = tester.getRect(_answerLine);
|
||||
expect(rect.top, greaterThanOrEqualTo(line.bottom));
|
||||
expect(rect.height, greaterThan(line.height * 1.5));
|
||||
// Both lines start together, after the leading icon.
|
||||
expect(rect.left, line.left);
|
||||
// It is emphasised above the muted question.
|
||||
final context = tester.element(_answerLine);
|
||||
expect(answer.style?.color, Theme.of(context).colorScheme.onSurface);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('its chevron is the expand affordance and turns while open', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester);
|
||||
expect(find.byIcon(Icons.expand_less), findsNothing);
|
||||
expect(
|
||||
find.descendant(of: _chip, matching: find.byIcon(Icons.chevron_right)),
|
||||
findsOneWidget,
|
||||
);
|
||||
double turns() => tester
|
||||
.widget<AnimatedRotation>(
|
||||
find.descendant(of: _chip, matching: find.byType(AnimatedRotation)),
|
||||
)
|
||||
.turns;
|
||||
expect(turns(), 0);
|
||||
await tester.tap(_chip);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-question-sheet')), findsOneWidget);
|
||||
expect(turns(), 0.25);
|
||||
Navigator.of(
|
||||
tester.element(find.byKey(const Key('chat-question-sheet'))),
|
||||
).pop();
|
||||
await tester.pumpAndSettle();
|
||||
expect(turns(), 0);
|
||||
});
|
||||
}
|
||||
@@ -55,6 +55,13 @@ JsonMap _form({String id = 'form-1'}) => {
|
||||
|
||||
const _chip = 'Which database? · Postgres';
|
||||
|
||||
/// One line of the settled question's chip: the question, or the recorded
|
||||
/// outcome on its own line beneath it.
|
||||
Finder _settledLine(String text) => find.descendant(
|
||||
of: find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
matching: find.text(text),
|
||||
);
|
||||
|
||||
/// A chat whose agent turn `a1` is the one the question arrives during.
|
||||
Future<FakeChatGateway> _open(WidgetTester tester, Size size) async {
|
||||
await tester.binding.setSurfaceSize(size);
|
||||
@@ -97,12 +104,13 @@ void _expectCollapsed() {
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text(chatQuestionSubmit), findsNothing);
|
||||
expect(find.text(chatQuestionAnswered), findsNothing);
|
||||
expect(find.text(_chip), findsOneWidget);
|
||||
// The chip sits in its turn's footer, under the turn that asked.
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Postgres'), findsOneWidget);
|
||||
// The chip sits among its turn's chips, under the turn that asked.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.text(_chip),
|
||||
of: find.byKey(const Key('chat-turn-chips')),
|
||||
matching: find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
@@ -194,12 +202,15 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
_expectCollapsed();
|
||||
|
||||
await tester.tap(find.text(_chip));
|
||||
await tester.tap(find.byKey(const ValueKey('chat-question-chip-form-1')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-question-sheet')), findsOneWidget);
|
||||
expect(find.text('Which database?'), findsOneWidget);
|
||||
expect(find.text('Postgres'), findsOneWidget);
|
||||
expect(find.text(chatQuestionAnswered), findsOneWidget);
|
||||
final sheet = find.byKey(const Key('chat-question-sheet'));
|
||||
expect(sheet, findsOneWidget);
|
||||
Finder inSheet(String text) =>
|
||||
find.descendant(of: sheet, matching: find.text(text));
|
||||
expect(inSheet('Which database?'), findsOneWidget);
|
||||
expect(inSheet('Postgres'), findsOneWidget);
|
||||
expect(inSheet(chatQuestionAnswered), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -213,7 +224,10 @@ void main() {
|
||||
expect(find.textContaining('no longer awaiting'), findsOneWidget);
|
||||
expect(find.text(chatQuestionWaiting), findsOneWidget);
|
||||
expect(find.text(chatQuestionSubmit), findsOneWidget);
|
||||
expect(find.text(_chip), findsNothing);
|
||||
expect(
|
||||
find.byKey(const ValueKey('chat-question-chip-form-1')),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -227,7 +241,8 @@ void main() {
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Which database? · Closed'), findsOneWidget);
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Closed'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a cancelled question collapses as expired', (tester) async {
|
||||
@@ -239,7 +254,8 @@ void main() {
|
||||
});
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(chatQuestionWaiting), findsNothing);
|
||||
expect(find.text('Which database? · Expired'), findsOneWidget);
|
||||
expect(_settledLine('Which database?'), findsOneWidget);
|
||||
expect(_settledLine('Expired'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('OpenCode: ack then form.replied leaves one collapsed row', (
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/domain/chat_transcript_days.dart';
|
||||
|
||||
int _at(int day, int hour) =>
|
||||
DateTime(2026, 11, day, hour).millisecondsSinceEpoch;
|
||||
|
||||
JsonMap _user(int? time) => {
|
||||
'kind': 'user',
|
||||
'message': {'created_at': ?time},
|
||||
};
|
||||
|
||||
JsonMap _turn(int? time) => {'kind': 'assistant', 'created_at': ?time};
|
||||
|
||||
void main() {
|
||||
test('a row takes its own, its message\'s or its first notice\'s time', () {
|
||||
expect(chatRowCreatedAt(_turn(_at(24, 9))), _at(24, 9));
|
||||
expect(chatRowCreatedAt(_user(_at(24, 10))), _at(24, 10));
|
||||
expect(
|
||||
chatRowCreatedAt({
|
||||
'kind': 'task_notices',
|
||||
'messages': [
|
||||
{'created_at': 'bad'},
|
||||
{'created_at': _at(25, 8)},
|
||||
],
|
||||
}),
|
||||
_at(25, 8),
|
||||
);
|
||||
expect(chatRowCreatedAt({'kind': 'question', 'form': {}}), isNull);
|
||||
});
|
||||
|
||||
test('one divider per calendar day, at that day\'s first timed row', () {
|
||||
final rows = [
|
||||
_turn(null), // an untimed row neither starts nor breaks a day
|
||||
_user(_at(24, 9)),
|
||||
_turn(_at(24, 9)),
|
||||
{'kind': 'questions'},
|
||||
_user(_at(24, 23)),
|
||||
_turn(_at(25, 0)),
|
||||
_user(null),
|
||||
_user(_at(25, 10)),
|
||||
_turn(_at(26, 7)),
|
||||
];
|
||||
expect(chatDayDividers(rows), [
|
||||
null,
|
||||
DateTime(2026, 11, 24),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DateTime(2026, 11, 25),
|
||||
null,
|
||||
null,
|
||||
DateTime(2026, 11, 26),
|
||||
]);
|
||||
});
|
||||
|
||||
test('no times, no dividers', () {
|
||||
expect(chatDayDividers([_turn(null), _user(null)]), [null, null]);
|
||||
});
|
||||
}
|
||||
@@ -82,10 +82,10 @@ void main() {
|
||||
expect(card(), findsNothing);
|
||||
expect(chip, findsOneWidget);
|
||||
expect(find.text('2 commands'), findsOneWidget);
|
||||
// The chip is in the second answer's footer, beside its other chips.
|
||||
// The chip is among the second answer's chips, beside its other chips.
|
||||
final footer = find.ancestor(
|
||||
of: chip,
|
||||
matching: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.byKey(const Key('chat-turn-chips')),
|
||||
);
|
||||
expect(footer, findsOneWidget);
|
||||
final message = find.ancestor(
|
||||
@@ -111,7 +111,7 @@ void main() {
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: chip,
|
||||
matching: find.byKey(const Key('chat-message-footer')),
|
||||
matching: find.byKey(const Key('chat-turn-chips')),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
|
||||
@@ -28,6 +28,10 @@ void main() {
|
||||
];
|
||||
await tester.pumpWidget(shellThread(gateway));
|
||||
await tester.pump();
|
||||
// Let the transcript settle at its end, so the card (under its day's
|
||||
// date divider) is scrolled clear of the composer before it is tapped.
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
testWidgets(
|
||||
|
||||
@@ -53,10 +53,18 @@ void main() {
|
||||
expect(chatCopyGutter(560), 0);
|
||||
});
|
||||
|
||||
testWidgets('without a gutter Copy starts the footer', (tester) async {
|
||||
testWidgets('without a gutter Copy trails the footer\'s time', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(find.descendant(of: _footer, matching: _copy), findsOneWidget);
|
||||
expect(_gutter, findsNothing);
|
||||
// The time starts at the answer's text edge, so hidden actions never
|
||||
// leave a gap before it.
|
||||
final model = tester.getRect(find.text('gpt-test'));
|
||||
final text = tester.getRect(find.text('The answer text'));
|
||||
expect(model.left, text.left);
|
||||
expect(tester.getRect(_copy).left, greaterThan(model.right));
|
||||
});
|
||||
|
||||
testWidgets('with a gutter Copy sits left of the answer, not in it', (
|
||||
@@ -107,6 +115,63 @@ void main() {
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
|
||||
);
|
||||
|
||||
double footerOpacity(WidgetTester tester) => tester
|
||||
.widget<AnimatedOpacity>(
|
||||
find.byKey(const Key('chat-message-actions-visibility')),
|
||||
)
|
||||
.opacity;
|
||||
|
||||
testWidgets(
|
||||
'without a gutter a desktop shows the footer actions on hover and focus',
|
||||
(tester) async {
|
||||
final semantics = tester.ensureSemantics();
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(footerOpacity(tester), 0);
|
||||
// The time and model stay visible; only the actions wait for hover.
|
||||
expect(find.text('gpt-test'), findsOneWidget);
|
||||
expect(
|
||||
tester.getSemantics(_copy),
|
||||
isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true),
|
||||
);
|
||||
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
addTearDown(mouse.removePointer);
|
||||
await mouse.addPointer(location: Offset.zero);
|
||||
await mouse.moveTo(tester.getCenter(find.text('The answer text')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 1);
|
||||
await mouse.moveTo(const Offset(5, 590));
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 0);
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
|
||||
await tester.pumpAndSettle();
|
||||
expect(footerOpacity(tester), 1);
|
||||
semantics.dispose();
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
|
||||
);
|
||||
|
||||
testWidgets('touch keeps the footer actions shown, with small muted icons', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(_host(0));
|
||||
expect(footerOpacity(tester), 1);
|
||||
final context = tester.element(_copy);
|
||||
final icon = tester.getSize(
|
||||
find.descendant(of: _copy, matching: find.byType(Icon)),
|
||||
);
|
||||
// Smaller than the reply's body text line and the default 24 px icon.
|
||||
expect(icon.height, 18);
|
||||
final style = tester.widget<IconButton>(_copy).style!;
|
||||
expect(
|
||||
style.foregroundColor!.resolve({}),
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
// A touch target still meets the platform minimum.
|
||||
expect(tester.getSize(_copy).height, greaterThanOrEqualTo(48));
|
||||
});
|
||||
|
||||
for (final (width, inGutter) in [(1400.0, true), (560.0, false)]) {
|
||||
testWidgets('a ${width.toInt()} px conversation puts Copy '
|
||||
'${inGutter ? 'in the gutter' : 'in the footer'}', (tester) async {
|
||||
|
||||
@@ -82,7 +82,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('shows a local dated timestamp but keeps it out of copy', (
|
||||
testWidgets('shows a local time-only timestamp but keeps it out of copy', (
|
||||
tester,
|
||||
) async {
|
||||
_phone(tester);
|
||||
@@ -122,9 +122,20 @@ void main() {
|
||||
final context = tester.element(find.byType(ChatMessageTimestamp).first);
|
||||
final local = DateTime.utc(2026, 10, 20, 8, 12).toLocal();
|
||||
final l10n = MaterialLocalizations.of(context);
|
||||
final expected =
|
||||
'${local.day} ${l10n.formatMonthYear(local)} · ${l10n.formatTimeOfDay(TimeOfDay.fromDateTime(local), alwaysUse24HourFormat: true)}';
|
||||
expect(find.text(expected), findsOneWidget);
|
||||
final time = l10n.formatTimeOfDay(
|
||||
TimeOfDay.fromDateTime(local),
|
||||
alwaysUse24HourFormat: true,
|
||||
);
|
||||
// The row shows only its time; the date is the day divider's, and the
|
||||
// full date and time stay in the tooltip and the accessible name.
|
||||
final full = '${local.day} ${l10n.formatMonthYear(local)}, $time';
|
||||
expect(find.text(time), findsOneWidget);
|
||||
expect(find.textContaining('2026'), findsNothing);
|
||||
expect(
|
||||
find.byWidgetPredicate((w) => w is Tooltip && w.message == full),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.bySemanticsLabel('Sent $full'), findsOneWidget);
|
||||
|
||||
final copy = tester.widget<ChatCopyButton>(find.byType(ChatCopyButton));
|
||||
expect(copy.text, 'Answer');
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
// `?tasks=N` the history ends with N consecutive background-task notices
|
||||
// in the server's wording (every third one failed);
|
||||
// `?links=1` answers and operator turns carry a markdown link, an
|
||||
// autolink, a bare URL and URLs inside code (never linkified).
|
||||
// autolink, a bare URL and URLs inside code (never linkified);
|
||||
// `?timestamps=1` messages carry recorded times over two calendar days.
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -31,6 +32,7 @@ bool get _links => _params['links'] == '1';
|
||||
bool get _older => _params['older'] == '1';
|
||||
int get _live => int.tryParse(_params['live'] ?? '') ?? 0;
|
||||
int get _tasks => int.tryParse(_params['tasks'] ?? '') ?? 0;
|
||||
bool get _timestamps => _params['timestamps'] == '1';
|
||||
|
||||
/// Background task [i]'s notice, as the server records a Claude Code task
|
||||
/// notification.
|
||||
@@ -154,6 +156,22 @@ JsonMap _message(String chat, int i) {
|
||||
};
|
||||
}
|
||||
|
||||
/// With `?timestamps=1`, message [i] of [count] carries a recorded time: the
|
||||
/// first half on 24 November 2026 and the rest on the 25th (local time), a
|
||||
/// few minutes apart, so the transcript shows two day dividers.
|
||||
JsonMap _timed(JsonMap message, int i, int count) {
|
||||
if (!_timestamps) return message;
|
||||
final secondDay = i >= count ~/ 2;
|
||||
final at = DateTime(
|
||||
2026,
|
||||
11,
|
||||
secondDay ? 25 : 24,
|
||||
10,
|
||||
0,
|
||||
).add(Duration(minutes: 3 * i));
|
||||
return {...message, 'created_at': at.millisecondsSinceEpoch};
|
||||
}
|
||||
|
||||
/// One history page for chat [index]: the newest messages, or with `?older=1`
|
||||
/// and a cursor, the 20 messages before them.
|
||||
JsonMap chatScrollHistory(String sessionId, int index, String cursor) {
|
||||
@@ -165,10 +183,14 @@ JsonMap chatScrollHistory(String sessionId, int index, String cursor) {
|
||||
'has_more': false,
|
||||
};
|
||||
}
|
||||
final messages = [
|
||||
for (var i = 0; i < count; i++) _message(sessionId, i),
|
||||
for (var i = 0; i < _tasks; i++) _taskNotice(sessionId, i),
|
||||
];
|
||||
return {
|
||||
'messages': [
|
||||
for (var i = 0; i < count; i++) _message(sessionId, i),
|
||||
for (var i = 0; i < _tasks; i++) _taskNotice(sessionId, i),
|
||||
for (var i = 0; i < messages.length; i++)
|
||||
_timed(messages[i], i, messages.length),
|
||||
],
|
||||
'next_cursor': _older ? 'older' : '',
|
||||
'has_more': _older,
|
||||
|
||||
Reference in New Issue
Block a user