Skip to content

Add summarize conversation feature #7697

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Apr 3, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality that this introduces.

This PR adds a new "Summarize conversation" button to the chat interface, allowing users to quickly get a summary of their conversation with the AI assistant. The summary is generated using the existing LLM summarizing condenser and is displayed as a system message in the chat.


Give a summary of what the PR does, explaining any non-trivial design decisions.

This PR implements a summarize conversation feature in OpenHands by:

  1. Adding a new summarize button next to the export trajectory button in the UI
  2. Creating a new API endpoint in the backend to handle summarization requests
  3. Using the existing LLMSummarizingCondenser to generate the summary
  4. Displaying the summary as a system message in the chat interface

The implementation leverages the existing condenser implementation without modifying the agent controller or runtime. This approach allows for a clean implementation with minimal changes to the codebase.

Note: This implementation does not accumulate the LLM cost in the agent controller, which can be addressed in a future iteration.


Link of any specific issues this addresses.

N/A


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:d006994-nikolaik   --name openhands-app-d006994   docker.all-hands.dev/all-hands-ai/openhands:d006994

@xingyaoww xingyaoww self-assigned this Apr 3, 2025
@xingyaoww
Copy link
Collaborator Author

@OpenHands help me merge from main and resolve conflict for this PR

Copy link

openhands-ai bot commented Apr 11, 2025

I'm on it! @xingyaoww can track my progress at all-hands.dev

Copy link

openhands-ai bot commented Apr 11, 2025

I've successfully merged the main branch into the feature/add-summarize-conversation-button branch and resolved all conflicts for PR #7697. Here's a summary of what I did:

  1. Identified three files with merge conflicts:

    • frontend/__tests__/utils/check-hardcoded-strings.test.tsx
    • frontend/src/components/features/chat/chat-message.tsx
    • openhands/server/session/session.py
  2. Resolved each conflict:

    • For the test file, I kept the test for unlocalized strings that was in the feature branch but missing in main
    • For the chat-message.tsx file, I merged the changes by keeping both the fixed typo from main ("bg-transparent" instead of "bg-tranparent") and the additional styling for system messages from the feature branch
    • For session.py, I added the missing import for RecallObservation and kept the feature branch's code that included RecallObservation in the event handling
  3. Committed the resolved conflicts with a clear commit message: "Merge main into feature/add-summarize-conversation-button and resolve conflicts"

  4. Pushed the changes to update the PR

  5. Verified the changes by running linting and build processes to ensure everything works correctly

The PR should now be up-to-date with the main branch and all conflicts have been properly resolved. The changes maintain the functionality from both branches, ensuring that the summarize conversation feature works correctly while incorporating the latest improvements from the main branch.

@xingyaoww
Copy link
Collaborator Author

@OpenHands please fix CI here: #7697

Copy link

openhands-ai bot commented Apr 11, 2025

I'm on it! @xingyaoww can track my progress at all-hands.dev

Copy link

openhands-ai bot commented Apr 11, 2025

I successfully fixed the CI issues in PR #7697 for the "Add Summarize Conversation Button" feature. Here's a summary of what I did:

  1. Created the missing file frontend/src/utils/scan-unlocalized-strings-ast.ts which was referenced in tests but was missing from the codebase. This file contains utility functions for scanning the codebase for unlocalized strings.

  2. Fixed several linting issues in the newly created file:

    • Replaced variable name path with nodePath in AST traversal functions to avoid shadowing the imported path module
    • Removed a console.error statement that was triggering linting warnings
    • Fixed a continue statement by restructuring the code to use a positive condition with nested blocks
    • Fixed indentation issues in the code
  3. Ran the tests to verify that the changes fixed the issues, and all tests are now passing.

  4. Committed and pushed the changes to the feature branch.

The CI issues have been successfully addressed. The PR should now pass CI checks as the linting errors have been fixed and the missing file has been added.

Key files modified:

  • Created: frontend/src/utils/scan-unlocalized-strings-ast.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants