This commit refactors the ChatViewModel to use the newly created ChatService and Step model for chat-related functionalities. The changes include:
- Replaced mock data source with real API calls via ChatService.
- Introduced _currentTaskId to keep track of the current task ID.
- Added fetchChatsForTask method to fetch steps related to the current task and populate the chat list.
- Implemented sendChatMessage to execute a step and add both user and agent messages to the chat list.
By making these changes, the ChatViewModel is now fully integrated with the backend services and models, thus enabling a more realistic and dynamic chat experience.
This commit introduces the ChatViewModel, which manages the business logic for chat interactions associated with tasks. The ViewModel communicates with a mock data source, offering functionalities like fetching chats for a specific task and sending chat messages.
In addition to the implementation, comprehensive tests for ChatViewModel have been provided to ensure its behavior is consistent with our design goals and expectations.
Key Features:
Chat management in ChatViewModel.
Tests covering all major functionalities of ChatViewModel.
Mock data source updates to emulate chat data interactions.
This commit introduces the TaskViewModel, which manages the business logic for tasks. The ViewModel interacts with a mock data source, providing functionalities like fetching tasks, selecting a task, creating, and deleting tasks.
Additionally, comprehensive tests for TaskViewModel have been added to ensure its behavior aligns with expectations. The mock data source has also been updated to support the new functionalities.
Key Features:
- Task management in TaskViewModel.
- Tests for each major functionality in TaskViewModel.
- Mock data source to simulate data interactions.