-
-
Notifications
You must be signed in to change notification settings - Fork 133
feat(ai-chat): add toggle-widget support, auto focus input option and default model selection #595
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds three new features to the AI Chat widget to improve usability when controlling the widget via keyboard shortcuts:
- Toggle widget visibility via CLI command (
yasbc toggle-widget ai_chat) - Auto-focus input field option when chat window opens
- Default model selection for initial widget initialization
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/widgets/yasb/ai_chat.py | Implements toggle-widget CLI handling, auto-focus input functionality, and default model selection logic |
| src/core/widgets/base.py | Adds widget_config_name property to BaseWidget for identifying widgets in CLI commands |
| src/core/validation/widgets/yasb/ai_chat.py | Adds validation schemas for new auto_focus_input and default configuration options |
| src/core/utils/widget_builder.py | Sets widget_config_name on widget instances during construction |
| docs/widgets/(Widget)-Ai-Chat.md | Documents the new features and their configuration options |
|
I went ahead and made it possible to toggle specific instances of the widget by adding a widget_config_name attribute to the base widget, which gets populated by the widget builder. This name can be referenced when calling toggle-widget - at least for this widget, haven't touched the |
|
Interesting, Ai makes Ai widget xD |
|
Ayy, not gonna lie, for smaller changes in an unfamiliar codebase it's pretty decent - as long as you verify afterwards. 😛 |
|
I will check all this when I have some free time, probably this weekend |
… default model selection
… default model selection
* Allows widgets to refer to their name defined in the yaml, for example to differentiate multiple instances, without adding extra attributes to the config.
yasbc toggle-widget ai_chatdefault: trueadded to the respective model. Only affects initial initialization, if the widget is opened, model/provider changed, closed and opened back up the default model doesn't affect it.Also, should more than one model be declared as default, first model is selected as default.
Just started using yasb, figured I'd implement the changes I'd like to see myself. Should make it easier to use the widget via hotkeys.
Tested behavior with "old" yaml before the change, no breaking changes from what I could see.