Skip to content

Fix #13868 — Export AI conversations & summaries to Markdown/JSON#14501

Closed
Shubh03-m wants to merge 6 commits into
JabRef:mainfrom
Shubh03-m:fix/13868-export-ai-chat
Closed

Fix #13868 — Export AI conversations & summaries to Markdown/JSON#14501
Shubh03-m wants to merge 6 commits into
JabRef:mainfrom
Shubh03-m:fix/13868-export-ai-chat

Conversation

@Shubh03-m

@Shubh03-m Shubh03-m commented Dec 3, 2025

Copy link
Copy Markdown

Closes #13868

This PR implements export functionality for AI Chat conversations and AI Summaries, allowing users to save the generated content in both Markdown (.md) and JSON (.json) formats. The feature improves usability by enabling users to store, review, and reuse AI-generated text outside JabRef. Export buttons were added to the relevant UI components, and formatting + error handling were implemented on the backend.

Steps to test

  1. Open JabRef in your IDE and run the application.

  2. Navigate to the AI Chat view.

  3. Create a test conversation or generate AI output.

  4. Click the newly added Export button.

  5. Choose either Markdown or JSON format.

  6. Verify that:

  • The exported Markdown file contains clean, human-readable text.

  • The exported JSON file contains structured data representing the conversation.

  1. Repeat the steps in the Summary view.

  2. Confirm that success or error notifications appear appropriately.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license.
  • I manually tested my changes in running JabRef (always required).
  • [/] I added JUnit tests for changes (not applicable for UI-driven export feature).
  • I added screenshots in the PR description (if change is visible to the user).
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (not required for this feature).
  • [/] I checked the user documentation. The feature does not require documentation updates at this time.

@github-actions

github-actions Bot commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Hey @Shubh03-m! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs.

Please re-check our AI Usage Policy to ensure that your pull request is in line with it. It also contains links to our contribution guide in case of any other doubts related to our contribution workflow.

@github-actions github-actions Bot added first contrib status: changes-required Pull requests that are not yet complete labels Dec 3, 2025
@jabref-machine

Copy link
Copy Markdown
Collaborator

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Checkstyle (pull_request)" and click on it.

In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports.

Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues, commit, and push.

@koppor koppor mentioned this pull request Dec 3, 2025
2 tasks

@koppor koppor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this contains too much generated code.

Use GSON for JSON export.

Use org.jabref.model.entry.BibEntry#getStringRepresentation for string representation (will be introduced at #14504)

}

private String generateMarkdownExport(BibEntry entry) {
StringBuilder markdown = new StringBuilder();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use StringJoiner to add \n automatically.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jabref-machine

Copy link
Copy Markdown
Collaborator

Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push.

In special cases, consider using // formatter:off and // formatter:on annotations to allow deviation from the code style.

@jabref-machine

Copy link
Copy Markdown
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

Comment thread jabgui/build.gradle.kts
// implementation("org.openjfx:javafx-controls")
// implementation("org.openjfx:javafx-fxml")
// implementation("org.openjfx:javafx-graphics")
implementation("com.google.code.gson:gson:2.10.1")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should already have GSON defined in versions gradle

@Shubh03-m Shubh03-m requested a review from koppor December 3, 2025 15:58
@koppor

koppor commented Dec 4, 2025

Copy link
Copy Markdown
Member

PR supersed by #14486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contrib status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add export chat and summary feature to AI functionality

4 participants