feat: browse subagent sessions nested under their parent
Sessions with a parentID were filtered out of the sidebar, so a subagent's conversation was unreachable. They now render indented under the session that started them (robot marker, "子代理 ·" subtitle), the parent shows its worker count, and tapping one opens its full chat. Opening a parent also fetches its children with parentID=<id>, so older workers missing from the loaded page appear. A subagent's app bar gets a back arrow to its parent session. Builds now produce a universal APK plus per-ABI arm64/armv7/x86_64 splits; the packaging preference is kept in project memory. 0.4.9 (409).
This commit is contained in:
1 parent
79221e57d7
commit
cebf09048e
9 files changed
+170
-19
No files matched your search
@@ -135,19 +135,50 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// The session that started this one, when it is a subagent.
|
||||
Session? get _parentSession {
|
||||
final parentID = widget.session.parentID;
|
||||
if (parentID == null || parentID.isEmpty) return null;
|
||||
for (final session in widget.app.sessions) {
|
||||
if (session.id == parentID) return session;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final parent = _parentSession;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: widget.onOpenSessions == null
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
tooltip: '会话',
|
||||
onPressed: widget.onOpenSessions,
|
||||
),
|
||||
title: Text(_title(), maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
// A subagent opened from its parent's row goes back there; its own
|
||||
// sessions menu would lose that way back on a phone.
|
||||
leading: parent != null
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: '返回父会话',
|
||||
onPressed: () => widget.app.openChat(parent),
|
||||
)
|
||||
: widget.onOpenSessions == null
|
||||
? null
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
tooltip: '会话',
|
||||
onPressed: widget.onOpenSessions,
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
if (widget.session.isChild) ...[
|
||||
Icon(Icons.smart_toy_outlined,
|
||||
size: 16, color: theme.hintColor),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
Expanded(
|
||||
child: Text(_title(),
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.view_sidebar_outlined),
|
||||
|
||||
Reference in new issue
Block a user