Commit Graph

35 Commits

Author SHA1 Message Date
hunteraraujo
deb84cc804 Remove mock data 2023-08-31 15:15:40 -07:00
hunteraraujo
5ae17d009b Update TaskViewModel to Use TaskService and Task API Integration
This commit includes a significant overhaul of the TaskViewModel to use the newly created TaskService and integrate it with the task API. Specifically:

- Removed dependency on mock data for tasks.
- Added real API calls through the TaskService for task operations like creating and fetching tasks.
- Updated createTask to return the ID of the newly created task.
- Updated fetchTasks method to fetch tasks from the API and update the local list.
- Updated selectTask to handle selection based on string IDs.

These changes make the TaskViewModel ready for real-world usage and remove dependencies on mock data.
2023-08-31 15:15:24 -07:00
hunteraraujo
651e112e3d Update ChatViewModel to Use ChatService and Step Model
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.
2023-08-31 15:11:03 -07:00
hunteraraujo
ae5799fc6a Introduce TaskService Class for Task Operations
This commit adds a new TaskService class to handle all task-related operations, including task creation, listing, and artifacts management.

- Implemented methods for creating a new task (createTask).
- Added functionality to retrieve details for a specific task (getTaskDetails).
- Enabled listing all tasks with optional pagination (listAllTasks).
- Enabled listing all artifacts for a specific task with optional pagination (listTaskArtifacts).

By encapsulating these operations within the TaskService class, this commit provides a clean and centralized way to interact with the backend for task functionalities, making the application more maintainable and easier to extend.
2023-08-31 15:07:05 -07:00
hunteraraujo
078db3105c Introduce ChatService Class for Chat Operations
This commit adds a new ChatService class to handle all chat-related operations, including steps and artifacts.

- Implemented methods for executing a step within a task (executeStep).
- Added functionality to retrieve details for a specific step (getStepDetails).
- Enabled listing all steps for a specific task with optional pagination (listTaskSteps).
- Laid groundwork for artifact uploading (uploadArtifact) and downloading (downloadArtifact), though these are not implemented yet.

By encapsulating these operations within the ChatService class, this commit provides a clean and centralized way to interact with the backend for chat functionalities, making the application more maintainable and easier to extend.
2023-08-31 15:04:57 -07:00
hunteraraujo
ed03a32bc3 Create Step Class to Model Step Information
This commit introduces the Step class to the codebase, designed to model the steps related to tasks.

- Implemented Step class with both required and optional fields.
- Provided a fromMap factory method for easy deserialization from API responses.
- Ensured that optional fields are handled gracefully, providing default values where necessary.

The addition of the Step class lays the foundation for more complex interactions with tasks, including the ability to handle steps with varying levels of information. This makes the application more flexible and robust when interfacing with the backend.
2023-08-31 14:56:32 -07:00
hunteraraujo
0dcdaaf641 Add RestApiUtility Class for HTTP Requests
This commit introduces a new utility class, RestApiUtility, designed to encapsulate all the HTTP request operations.

- Created RestApiUtility class with a constructor that accepts a base URL.
- Added get method to perform GET requests and return data as a Map.
- Added getList method to perform GET requests and return data as a List.
- Added post method to perform POST requests with payload and return data as a Map.

The class uses the http package for making network calls and dart:convert for JSON serialization and deserialization. This centralized approach makes it easier to manage API calls and handle errors across the application.
2023-08-31 14:46:01 -07:00
hunteraraujo
1c862be18a Update Task Model to Use String IDs
This commit updates the Task model to use string-based identifiers (id) instead of integers. The change aligns the model with the backend service, which uses string-based UUIDs for task identification.
2023-08-31 14:43:01 -07:00
hunteraraujo
43593d849d Update Chat Model to Use String IDs
This commit updates the Chat model to use string-based identifiers (id and taskId) instead of integers. This change aligns the model with the backend service, which uses string-based UUIDs for task and chat identification.
2023-08-31 14:41:20 -07:00
hunteraraujo
8950ab44be Implement and Test TaskRequestBody Model
This commit adds the TaskRequestBody class, which is designed to encapsulate the request body when creating a new task. The class includes a toJson method for easy serialization to JSON format.

Additionally, unit tests have been written to ensure that the TaskRequestBody object is created with the correct values and that it serializes to the expected JSON structure.

- Added TaskRequestBody class with input and optional additionalInput fields.
- Implemented toJson method for converting an instance of the class to JSON.
- Added unit tests to verify both object creation and JSON serialization.

These changes provide a standardized way to manage the request body when creating new tasks, improving the overall code quality and maintainability.
2023-08-31 14:39:03 -07:00
hunteraraujo
c4d08aefb9 Implement and Test StepRequestBody Model
This commit introduces the StepRequestBody class, designed to encapsulate the request body for sending a chat message in the form of a step. The class includes a toJson method for easy serialization to JSON format.

Additionally, unit tests have been added to ensure that the StepRequestBody object is created with the correct values and that it serializes to the expected JSON format.

- Added StepRequestBody class with input and optional additionalInput fields.
- Implemented toJson method for converting an instance of the class to JSON.
- Added unit tests to verify both object creation and JSON serialization.

These changes provide a robust way to manage the request body for step-based chat messages.
2023-08-31 14:36:35 -07:00
hunteraraujo
803e3f6ef9 Fix various splash radius for icon buttons 2023-08-25 08:12:35 -07:00
hunteraraujo
c08165c66a Align chat tiles to top of chat view 2023-08-25 08:04:34 -07:00
hunteraraujo
b312b1d481 Fix copy button background color 2023-08-24 21:53:35 -07:00
hunteraraujo
2ca75159e3 Include send icon in text field 2023-08-24 21:51:18 -07:00
hunteraraujo
9f8c93ebb0 Update main_layout.dart + main.dart to integrate ChatView 2023-08-24 21:43:02 -07:00
hunteraraujo
0fb67241c5 Implement ChatView with Agent and User Message Tiles
This commit introduces the ChatView widget, a central component of the application that manages the chat interface. It's responsible for displaying both agent and user messages and includes the following features:

- Fetching chats for a specific task upon initialization.
- A reverse ListView to display chats with the most recent messages at the bottom.
- Dynamic rendering of UserMessageTile and AgentMessageTile widgets based on message type.
- Integration with the ChatInputField for inputting user messages.
- Placeholder logic for handling send action, to be implemented later.

This implementation lays the groundwork for a fully functional chat interface within the application, allowing for a seamless interaction between users and agents.
2023-08-24 21:41:53 -07:00
hunteraraujo
33c900b73f Add AgentMessageTile Widget with Tests
This commit introduces the AgentMessageTile widget, a core component of the chat interface. The widget is designed to display agent messages, including a collapsible section for displaying a pretty-printed JSON code snippet.

The following features have been implemented:
- Rendering of agent title, message text, and expand/collapse button.
- Expandable section for displaying a JSON code snippet, complete with copy functionality.
- A minimum height constraint to ensure consistent appearance.
- Widget tests to validate rendering and interaction behavior.

These enhancements contribute to the overall chat functionality, providing a clear and interactive display of agent messages.
2023-08-24 21:17:11 -07:00
hunteraraujo
ddfbd1b9f8 Implement UserMessageTile Widget and Tests
This commit introduces the UserMessageTile widget, designed to display user messages in the chat interface. The widget includes the following features:
- Proper alignment based on available screen width
- A predefined minimum height with flexible expansion for longer messages
- Styling including a white background, thin black border, and small corner radius

Alongside the widget, this commit also includes comprehensive widget tests to ensure the correct rendering and functionality of the UserMessageTile. The tests cover:
- Rendering without errors
- Displaying the correct user message
- Showing the "User" title as expected

These implementations improve the structure and readability of the user messages within the chat view, ensuring a consistent and user-friendly experience.
2023-08-24 20:59:47 -07:00
hunteraraujo
05ce744f8c Add JsonCodeSnippetView to Display and Copy Pretty-Printed JSON
This commit introduces the JsonCodeSnippetView, a widget designed to display JSON data in a pretty-printed format. Users can view the JSON content with proper indentation and formatting, enhancing readability.

Features:
- The JSON data is displayed using the HighlightView with GitHub-themed syntax highlighting.
- A copy button (IconButton) is provided to allow users to easily copy the pretty-printed JSON to the clipboard.
- Padding and layout adjustments ensure that the view fits seamlessly within the designated space, with scrollable content if the JSON exceeds the available space.

This widget enhances the user experience when interacting with JSON data, providing a clean and efficient way to view and copy content.
2023-08-24 20:52:11 -07:00
hunteraraujo
d7b6d1e49a Implement and Test Chat Input Field Widget
This commit introduces the ChatInputField widget, a custom text input field designed for use within the ChatView. The ChatInputField widget handles varying screen sizes and gracefully resizes itself according to the available width. It starts with a height of 50 and can expand up to 400 as the user types more lines of text.

In addition to the implementation, this commit also includes widget tests to ensure the ChatInputField behaves as expected.

- Add ChatInputField widget with dynamic resizing
- Include IconButton for sending messages
- Add widget tests for ChatInputField
- Handle edge cases and overflows
2023-08-24 11:55:05 -07:00
hunteraraujo
6e2d325994 Refactor UI with New Widgets and Provider Integration
In this commit, the app underwent significant UI improvements by leveraging new, more modular widgets (NewTaskButton and TaskListTile). This ensures better code maintainability and a cleaner architecture.

Key changes include:

Integrated ChangeNotifierProvider in main.dart to facilitate the creation and broadcasting of TaskViewModel.
Refactored TaskView to utilize the newly created NewTaskButton and TaskListTile widgets.
Updated MainLayout to reflect the changes and provide a more cohesive user experience.
2023-08-23 08:31:54 -07:00
hunteraraujo
3a0db45b3b Implement TaskListTile with tests
This commit introduces the TaskListTile, a custom widget designed to display individual tasks in the TaskView. The tile offers a user-friendly interface with interactive features, such as selection and deletion.

Key Features:
- Responsive design that adapts its width based on the TaskView's constraints.
- Interactive tile that changes its background color upon selection.
- A delete icon that appears only when the tile is selected.
- Comprehensive widget tests to ensure the TaskListTile behaves as expected.

By splitting this into its own widget, the codebase remains modular, making it easier to maintain and update in the future.
2023-08-23 08:25:19 -07:00
hunteraraujo
b71b7d1f26 Update new_task_button.dart 2023-08-22 17:03:52 -04:00
hunteraraujo
d830a7ebcf Implement NewTaskButton with styling and tests
This commit introduces the NewTaskButton widget, designed to allow users to create new tasks. The button follows specific design guidelines, including dimensions, colors, and layout.

Key Features:

Button with a set height and adaptive width.
Icon and text layout within the button.
Styling for background, border, and corner radius.
Associated tests to ensure the button's functionality and appearance.
2023-08-22 16:59:36 -04:00
hunteraraujo
1436092a35 Implement ChatViewModel with tests and mock data
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.
2023-08-22 07:33:54 +02:00
hunteraraujo
5b520eb5ae Implement TaskViewModel with tests and mock data
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.
2023-08-21 00:03:39 +02:00
hunteraraujo
fb946e3d57 Create Chat class + tests 2023-08-20 20:57:29 +02:00
hunteraraujo
cf4aa4fe9c Create Task class + tests 2023-08-20 20:26:04 +02:00
hunteraraujo
d65e7ab830 Update AgentView to TaskView 2023-08-20 20:15:15 +02:00
hunteraraujo
d505724e90 Update agent to task 2023-08-20 19:20:56 +02:00
hunteraraujo
9bedb9fa08 Implement basic 2 panels w/ responsiveness 2023-08-20 16:33:53 +02:00
hunteraraujo
66cf84b007 Remove settings view 2023-08-20 10:31:15 +02:00
hunteraraujo
b6a9d905f1 Stub files per design document 2023-08-15 15:05:34 +02:00
hunteraraujo
dc35dc3024 initial commit 2023-08-15 00:28:10 +02:00