OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Add Export Trajectory Button to Conversation Card

Open raymyers opened this issue 7 months ago • 2 comments

  • [x] 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 this introduces.

Add the ability to Export json from the conversation list, useful to save your data if the runtime will not start.


Summarize what the PR does, explaining any non-trivial design decisions.

We do not show the conversation (including the export trajectory button) until the runtime starts. In the case that it doesn't start, people may not be able to retrieve their data - especially on cloud.   This PR adds an "Export Trajectory" button to the conversation card context menu, allowing users to easily export conversation trajectory data as a JSON file.

Ideally, we could display the conversation independent of the runtime starting, but that maybe more difficult and in the meantime this will serve as a stopgap allowing people to retrieve the raw data.

Changes

  • Added an "Export Trajectory" button to the conversation card context menu
  • Implemented the export functionality using the existing useGetTrajectory hook and downloadTrajectory utility, similar to the version in frontend/src/components/features/chat/chat-interface.tsx

Screenshot 2025-05-20 204756


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:fe92626-nikolaik   --name openhands-app-fe92626   docker.all-hands.dev/all-hands-ai/openhands:fe92626

raymyers avatar May 21 '25 02:05 raymyers

Just a quick side note

We do not show the conversation (including the export trajectory button) until the runtime starts. In the case that it doesn't start, people may not be able to retrieve their data - especially on cloud.

I am surprised, I could swear the conversation window is / was visible. Not sure when or why that changed. Wait, it didn't image

But the Export Conversation button doesn't appear to work, I click and nothing happens.

enyst avatar May 21 '25 10:05 enyst

Ah, maybe what happens may be twofold:

  • either those conversations don't manage to load in the UI - that's before the runtime is starting, I think, it's loading events here - in which case I assume you may want to look at e.g. the size of those histories
  • or the button exists, but pressing it does nothing, until the runtime does manage to start, which I never noticed before, maybe we could look into why?

Of course, the above is assuming the saas hasn't changed this flow.

Edited to add: just to clarify, I think the PR is welcome anyway, more ways for people to not lose data is always welcome in my view. These notes are just because I was surprised by the behavior in the PR description, I don't think that's the normal behavior of the application?

enyst avatar May 21 '25 10:05 enyst

Thanks for the notes @enyst. Despite that it was accepted I'm being won over by the idea that this shouldn't have been needed because we should be able to show the conversation pane when the runtime won't start. So I'm going to close this and I or someone can attempt that cleaner solution.

raymyers avatar May 27 '25 17:05 raymyers