Chat colours: the tint and bar span the divider; a stronger top wash; capture fixture
?colors=1 (with ?chats=N) names, stars and colours the fixture chats and keeps colours picked with chat_color, for capture review.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
// `?graph=1` run 7 carries its pinned graph (plan -> build);
|
||||
// `?quota=claude|opencode` (with `?chats=N`) pushes a usage frame with
|
||||
// that harness's account quota after a chat subscribes.
|
||||
// `?colors=1` (with `?chats=N`) names the chats, stars and colours some of
|
||||
// them, and keeps colours picked with chat_color;
|
||||
// `?msgs=`, `?rich=1`, `?older=1`, `?live=N` vary the chat transcripts for
|
||||
// scroll captures (tool/perf/chat_scroll_fixture.dart).
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -25,6 +27,46 @@ void configurePerfFixture(Map<String, String> params) {
|
||||
int get _hits => int.tryParse(_params['hits'] ?? '') ?? 0;
|
||||
int get _chats => int.tryParse(_params['chats'] ?? '') ?? 0;
|
||||
bool get perfRunGraph => _params['graph'] == '1';
|
||||
bool get _colors => _params['colors'] == '1';
|
||||
|
||||
/// `?colors=1`: titles, directories, stars and colours per chat index.
|
||||
const _colorTitles = [
|
||||
'Release notes',
|
||||
'api refactor',
|
||||
'Billing bug',
|
||||
'Docs pass',
|
||||
'Flaky test',
|
||||
'Onboarding',
|
||||
'Perf sweep',
|
||||
'Search UX',
|
||||
];
|
||||
const _colorStarred = {0, 1, 3};
|
||||
const _colorNames = ['teal', 'purple', null, 'amber', 'red', null, 'blue'];
|
||||
final Map<String, String?> _pickedColors = {};
|
||||
|
||||
JsonMap _chatRow(int i) {
|
||||
final id = 'perf-chat-$i';
|
||||
if (!_colors) {
|
||||
return {
|
||||
'id': id,
|
||||
'title': 'Fixture chat ${i + 1}',
|
||||
'directory': '/workspace/demo',
|
||||
};
|
||||
}
|
||||
final color = _pickedColors.containsKey(id)
|
||||
? _pickedColors[id]
|
||||
: _colorNames[i % _colorNames.length];
|
||||
return {
|
||||
'id': id,
|
||||
'title': _colorTitles[i % _colorTitles.length],
|
||||
'directory': i.isEven ? '/workspace/demo' : '/workspace/site',
|
||||
'model': 'claude-opus',
|
||||
'backend': 'claude',
|
||||
'updated_at': DateTime.now().millisecondsSinceEpoch - (i + 1) * 600000,
|
||||
if (_colorStarred.contains(i)) 'starred': true,
|
||||
'color': ?color,
|
||||
};
|
||||
}
|
||||
|
||||
/// Whether a chat scroll option (tool/perf/chat_scroll_fixture.dart) shapes
|
||||
/// the transcripts instead of the bench's short markdown history.
|
||||
@@ -137,14 +179,22 @@ JsonMap? perfChatReply(JsonMap request) {
|
||||
'id': id,
|
||||
'type': 'chat_sessions',
|
||||
'chat_sessions': [
|
||||
for (var i = 0; i < _chats; i++)
|
||||
{
|
||||
'id': 'perf-chat-$i',
|
||||
'title': 'Fixture chat ${i + 1}',
|
||||
'directory': '/workspace/demo',
|
||||
},
|
||||
for (var i = 0; i < _chats; i++) _chatRow(i),
|
||||
],
|
||||
};
|
||||
case 'chat_color':
|
||||
final query = request['chat_query'];
|
||||
final session = query is Map ? '${query['session_id'] ?? ''}' : '';
|
||||
final color = query is Map ? query['color'] as String? : null;
|
||||
_pickedColors[session] = color;
|
||||
final index = int.tryParse(session.replaceFirst('perf-chat-', '')) ?? 0;
|
||||
final row = _chatRow(index);
|
||||
return {
|
||||
'id': id,
|
||||
'type': 'chat_color',
|
||||
'chat_session': row,
|
||||
'chat_sessions': [row],
|
||||
};
|
||||
case 'chat_subscribe':
|
||||
return {'id': id, 'type': 'chat_subscribed'};
|
||||
case 'chat_shells':
|
||||
|
||||
Reference in New Issue
Block a user