feat(app): chat list drops search, New chat and Refresh are bar actions, and rows show agent, model and ~ paths
This commit is contained in:
@@ -43,12 +43,22 @@ String relativeChatSessionTime(Object? updatedAt, {DateTime? now}) {
|
||||
return '${then.day} ${_shortMonths[then.month - 1]}';
|
||||
}
|
||||
|
||||
/// The row's muted second line: the directory the chat runs in, plus the model
|
||||
/// the server recorded for it. Both come from the row; nothing is inferred.
|
||||
String chatSessionMeta(JsonMap session) => [
|
||||
'${session['directory'] ?? ''}'.trim(),
|
||||
'${session['model'] ?? ''}'.trim(),
|
||||
].where((part) => part.isNotEmpty).join(' · ');
|
||||
/// The row's muted second line: which agent runs the chat (an empty backend
|
||||
/// is a legacy OpenCode row), its model, and the directory with the home
|
||||
/// folder written as `~`.
|
||||
String chatSessionMeta(JsonMap session) {
|
||||
final backend = '${session['backend'] ?? ''}'.trim();
|
||||
return [
|
||||
backend.isEmpty ? 'opencode' : backend,
|
||||
'${session['model'] ?? ''}'.trim(),
|
||||
homeRelativePath('${session['directory'] ?? ''}'.trim()),
|
||||
].where((part) => part.isNotEmpty).join(' · ');
|
||||
}
|
||||
|
||||
final _homePrefix = RegExp(r'^(/Users/[^/]+|/home/[^/]+|/root)(?=/|$)');
|
||||
|
||||
/// `/Users/alan/repos/x` (or `/home/alan/...`) as `~/repos/x`.
|
||||
String homeRelativePath(String path) => path.replaceFirst(_homePrefix, '~');
|
||||
|
||||
/// The row's muted second line as the web words it: recency first, then the
|
||||
/// directory and model (`1 day ago · /srv/probe · model-a`).
|
||||
|
||||
Reference in New Issue
Block a user