Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Continuous Mode in Chat System #5167

Merged
merged 9 commits into from
Sep 6, 2023

Conversation

hunteraraujo
Copy link
Contributor

Background

In order to enhance user interaction and make the chat system more dynamic, this PR introduces a new feature called "Continuous Mode". In this mode, the chat conversation can continue without requiring the user to press the send button for every message. This is especially useful for tasks or scenarios where a continuous back-and-forth conversation between the user and the agent is expected.

Changes

  1. Refactor ChatInputField to Support Continuous Mode

    • Added a boolean variable isContinuousMode to the ChatInputField widget to determine whether the chat is in continuous mode.
    • Added a callback function onContinuousModePressed to toggle the continuous mode state from an external source.
    • Added a button to toggle between continuous and single message mode, updating the UI accordingly.
    • Conditionally rendered the send button based on the isContinuousMode state.
  2. Update ChatViewModel with Continuous Mode Logic

    • Introduced a boolean state variable _isContinuousMode to manage continuous mode within the view model.
    • Added a setter and getter for _isContinuousMode to handle its state and notify listeners when it changes.
    • Updated the sendChatMessage method to automatically send another message if continuous mode is enabled.
  3. Enhanced Error Handling and Payload Flexibility

    • Made the input field optional in StepRequestBody to support sending an empty payload.
    • Added a toJson method in StepRequestBody to return an empty JSON object if both input and additionalInput are null.
    • Improved error logging and added conditional checks to handle various error scenarios.

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of Auto-GPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

Updated the StepRequestBody class to allow both 'input' and 'additionalInput' to be optional. Added logic in toJson() method to return an empty JSON object if both fields are null.
Added a new state variable `_isContinuousMode` to the ChatViewModel to track whether the chat is in continuous mode or not. This state is toggled via a setter and triggers UI updates through `notifyListeners()`.

Enhanced the `sendChatMessage` method to automatically send a null message if continuous mode is active, triggering the next step in the chat.
- Added a new boolean state `isContinuousMode` to the `ChatInputField` widget to handle the continuous mode feature.
- Introduced a new callback function `onContinuousModePressed` to manage the state of the continuous mode from an external source.
- Conditionally rendered the send button based on the `isContinuousMode` state.
- Enhanced the UI by adding a button to toggle between continuous mode and single message mode, which triggers the `onContinuousModePressed` callback.
@github-actions github-actions bot added the size/m label Sep 6, 2023
@netlify
Copy link

netlify bot commented Sep 6, 2023

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit a933f11
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/64f8d146de3ba50008b4f121
😎 Deploy Preview https://deploy-preview-5167--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added size/l and removed size/m labels Sep 6, 2023
@hunteraraujo hunteraraujo merged commit 34c4418 into master Sep 6, 2023
11 of 16 checks passed
@hunteraraujo hunteraraujo deleted the haraujo/continuous-mode branch September 6, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant