Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

End continuous mode when clicking text field

hunteraraujo27e9868aa50e
diff --git a/frontend/lib/views/chat/chat_input_field.dart b/frontend/lib/views/chat/chat_input_field.dart
index 19bf72f06e..4901408aaf 100644
--- a/frontend/lib/views/chat/chat_input_field.dart
+++ b/frontend/lib/views/chat/chat_input_field.dart
@@ -22,6 +22,22 @@ class _ChatInputFieldState extends State<ChatInputField> {
final TextEditingController _controller = TextEditingController();
final FocusNode _focusNode = FocusNode();
+ @override
+ void initState() {
+ super.initState();
+ _focusNode.addListener(() {
+ if (_focusNode.hasFocus && widget.isContinuousMode) {
+ widget.onContinuousModePressed();
+ }
+ });
+ }
+
+ @override
+ void dispose() {
+ _focusNode.dispose(); // Dispose of the FocusNode when you're done.
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
// Using LayoutBuilder to provide the current constraints of the widget,
@@ -54,7 +70,6 @@ class _ChatInputFieldState extends State<ChatInputField> {
// when the content exceeds its maximum height
child: SingleChildScrollView(
reverse: true,
- // TODO: Include tool tip to explain clicking text field will end continuous mode
child: TextField(
controller: _controller,
focusNode: _focusNode,