-
Notifications
You must be signed in to change notification settings - Fork 0
feat(app): multiline composer with inline model & thinking selectors #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a59896
feat(app): multiline composer with inline model & thinking selectors
leduckhc f54b7db
fix(app): prevent composer footer selector overflow on narrow widths
leduckhc 66b7e53
test(app): exercise real selector ellipsis in composer overflow test
leduckhc 467b000
fix(desktop): only use the merge icon for worktrees with an open PR
leduckhc a034c56
feat(server): re-emit session.meta from the native pi rpc adapter
leduckhc 866f2d5
feat: ACP session-mode selector in the composer
leduckhc ff33a00
refactor(server): extract MetaModel type alias in pi adapter
leduckhc aa1ff59
fix(app): make the composer mode picker sheet scrollable
leduckhc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:material_symbols_icons/symbols.dart'; | ||
|
|
||
| import '../../store/store.dart'; | ||
| import '../home/repo_chips.dart' show AgentAvatar; | ||
| import 'client_commands.dart'; | ||
|
|
||
| /// Small rounded pill used in the composer footer: a leading widget (agent | ||
| /// avatar or icon) + a short label, tappable to open a picker. Kept visually | ||
| /// low-key so it reads as an inline control, not a primary button. | ||
| class _ComposerPill extends StatelessWidget { | ||
| const _ComposerPill({ | ||
| required this.leading, | ||
| required this.label, | ||
| required this.onTap, | ||
| this.tooltip, | ||
| }); | ||
|
|
||
| final Widget leading; | ||
| final String label; | ||
| final VoidCallback onTap; | ||
| final String? tooltip; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final theme = Theme.of(context); | ||
| final cs = theme.colorScheme; | ||
| final pill = InkWell( | ||
| onTap: onTap, | ||
| borderRadius: BorderRadius.circular(14), | ||
| child: Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), | ||
| child: Row( | ||
| mainAxisSize: MainAxisSize.min, | ||
| children: [ | ||
| leading, | ||
| const SizedBox(width: 6), | ||
| Flexible( | ||
| child: Text( | ||
| label, | ||
| maxLines: 1, | ||
| overflow: TextOverflow.ellipsis, | ||
| style: theme.textTheme.labelMedium?.copyWith( | ||
| color: cs.onSurfaceVariant, | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ); | ||
| return tooltip == null ? pill : Tooltip(message: tooltip!, child: pill); | ||
| } | ||
| } | ||
|
|
||
| /// Composer-footer control that shows the session's current model and, on tap, | ||
| /// opens the model picker (reusing the `/model` client command). Renders | ||
| /// nothing until `session.meta` has arrived with a non-empty models list — the | ||
| /// client fetches the selectable models asynchronously, so there is simply no | ||
| /// selector to show in the meantime. | ||
| class ComposerModelSelector extends ConsumerWidget { | ||
| /// Creates the model selector for [sessionId]. | ||
| const ComposerModelSelector({super.key, required this.sessionId}); | ||
|
|
||
| /// The session whose model this selector reads and switches. | ||
| final String sessionId; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context, WidgetRef ref) { | ||
| final meta = ref.watch(sessionMetaProvider(sessionId)); | ||
| if (meta == null || meta.models.isEmpty) return const SizedBox.shrink(); | ||
| final agent = ref.watch(sessionsProvider).byId(sessionId)?.agent ?? ''; | ||
| return _ComposerPill( | ||
| leading: AgentAvatar(agent: agent, size: 16), | ||
| label: meta.model?.name ?? 'model', | ||
| tooltip: 'Model', | ||
| onTap: () => handleClientCommand( | ||
| '/model', | ||
| context: context, | ||
| ref: ref, | ||
| sessionId: sessionId, | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| /// Composer-footer control that shows the session's current thinking | ||
| /// (reasoning) effort and, on tap, opens the thinking-level picker (reusing the | ||
| /// `/thinking` client command). Hidden entirely when the agent reports no | ||
| /// thinking support (an empty thinking level). | ||
| class ComposerThinkingSelector extends ConsumerWidget { | ||
| /// Creates the thinking-effort selector for [sessionId]. | ||
| const ComposerThinkingSelector({super.key, required this.sessionId}); | ||
|
|
||
| /// The session whose thinking level this selector reads and changes. | ||
| final String sessionId; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context, WidgetRef ref) { | ||
| final meta = ref.watch(sessionMetaProvider(sessionId)); | ||
| if (meta == null || meta.thinking.isEmpty) return const SizedBox.shrink(); | ||
| return _ComposerPill( | ||
| leading: Icon( | ||
| Symbols.signal_cellular_alt, | ||
| size: 16, | ||
| weight: 400, | ||
| color: Theme.of(context).colorScheme.onSurfaceVariant, | ||
| ), | ||
| label: meta.thinking, | ||
| tooltip: 'Thinking effort', | ||
| onTap: () => handleClientCommand( | ||
| '/thinking', | ||
| context: context, | ||
| ref: ref, | ||
| sessionId: sessionId, | ||
| ), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.