Commit Graph

11 Commits

Author SHA1 Message Date
hunteraraujo
2df6c5e334 Implement onSendPressed Functionality in ChatView
This commit enhances the ChatView class by implementing the onSendPressed functionality, which is triggered when the user sends a message through the ChatInputField:

- When onSendPressed is triggered, it checks if a task ID is currently selected (currentTaskId in ChatViewModel).
- If a task ID is selected, the message is sent as a chat message for that task using sendChatMessage from ChatViewModel.
- If no task ID is selected, a new task is created using createTask from TaskViewModel, and then the message is sent for that new task.

This change provides a complete workflow for sending chat messages, either within an existing task or by creating a new task.
2023-08-31 15:45:55 -07:00
hunteraraujo
5d865a36d9 Refactor ChatInputField to Use Callback for Sending Messages
This commit brings a key update to the ChatInputField widget, making it more flexible and decoupled:

- The onSendPressed callback now takes a string parameter. This string represents the message that the user wishes to send.
- The onPressed of the send button (IconButton) is now implemented within the ChatInputField widget. It checks if the TextField has any text before calling onSendPressed.
- Added a TextEditingController to manage the TextField's content.
2023-08-31 15:42:33 -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
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