Refactor ChatInputField to use SharedPreferencesService

This commit is contained in:
hunteraraujo
2023-10-10 18:39:24 -07:00
parent 8245433d7f
commit dbec110bac
5 changed files with 21 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import 'package:auto_gpt_flutter_client/models/step.dart';
import 'package:auto_gpt_flutter_client/models/step_request_body.dart';
import 'package:auto_gpt_flutter_client/services/shared_preferences_service.dart';
import 'package:flutter/foundation.dart';
import 'package:auto_gpt_flutter_client/services/chat_service.dart';
import 'package:auto_gpt_flutter_client/models/chat.dart';
@@ -9,10 +10,12 @@ class ChatViewModel with ChangeNotifier {
final ChatService _chatService;
List<Chat> _chats = [];
String? _currentTaskId;
final SharedPreferencesService _prefsService;
bool _isWaitingForAgentResponse = false;
bool get isWaitingForAgentResponse => _isWaitingForAgentResponse;
SharedPreferencesService get prefsService => _prefsService;
bool _isContinuousMode = false;
@@ -22,7 +25,7 @@ class ChatViewModel with ChangeNotifier {
notifyListeners();
}
ChatViewModel(this._chatService);
ChatViewModel(this._chatService, this._prefsService);
/// Returns the current list of chats.
List<Chat> get chats => _chats;