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

Added example questions to AI chat #12745

Closed
wants to merge 2 commits into from

Conversation

kaushikaW
Copy link

@kaushikaW kaushikaW commented Mar 15, 2025

Describe the changes you have made here: what, why, ...

Fixes #12702
Added 3 example questions to the AI chat tab section (see the screenshot).
Currently, the 3 questions are hardcoded in the codebase and are not being generated by the AI model.
Some extra styles have been added to improve the user experience.

image

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Tests created for changes (if applicable)
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Comment on lines +118 to +128
private void initializeExampleQuestions() {
String newExampleLabel = exQuestionLabel.getText();
String newExQuestion1 = exQuestion1.getText();
String newExQuestion2 = exQuestion2.getText();
String newExQuestion3 = exQuestion3.getText();

exQuestion1.setText(newExQuestion1);
exQuestion2.setText(newExQuestion2);
exQuestion3.setText(newExQuestion3);
exQuestionLabel.setText(newExampleLabel);
}
Copy link

Choose a reason for hiding this comment

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

The method reads text values and sets them back without any transformation, making these operations redundant and potentially confusing. This violates clean code principles and adds unnecessary complexity.

Comment on lines +290 to +293
private void sendExampleQuestion1Prompt() {
String questionText = exQuestion1.getText();
onSendMessage(questionText);
}
Copy link

Choose a reason for hiding this comment

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

Code duplication across three similar methods (sendExampleQuestion1/2/3Prompt). Should be refactored into a single method taking the question number as parameter to improve maintainability.

@kaushikaW kaushikaW marked this pull request as ready for review March 15, 2025 17:49
Comment on lines +118 to +128
private void initializeExampleQuestions() {
String newExampleLabel = exQuestionLabel.getText();
String newExQuestion1 = exQuestion1.getText();
String newExQuestion2 = exQuestion2.getText();
String newExQuestion3 = exQuestion3.getText();

exQuestion1.setText(newExQuestion1);
exQuestion2.setText(newExQuestion2);
exQuestion3.setText(newExQuestion3);
exQuestionLabel.setText(newExampleLabel);
}
Copy link

Choose a reason for hiding this comment

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

The method gets text from UI elements and sets the same text back to them without any transformation, making these operations redundant and potentially causing unnecessary UI updates.

Copy link

trag-bot bot commented Mar 15, 2025

@trag-bot didn't find any issues in the code! ✅✨

Copy link
Contributor

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

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.

@kaushikaW
Copy link
Author

kaushikaW commented Mar 15, 2025

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

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.

@koppor @egonw can you give some hints to fix this issue I setup the checkstyle correctly but I 'm currently struggling to resolve Checkstyle: Wrong order error
image

@koppor
Copy link
Member

koppor commented Mar 15, 2025

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

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.

@koppor @egonw can you give some hints to fix this issue I setup the checkstyle correctly but I 'm currently struggling to resolve Checkstyle: Wrong order error
image

https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html

@koppor
Copy link
Member

koppor commented Mar 15, 2025

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

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.

@koppor @egonw can you give some hints to fix this issue I setup the checkstyle correctly but I 'm currently struggling to resolve Checkstyle: Wrong order error
image

https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html

Screenshot of your IntellIj config missing. We cannot double check whether you setup everything correctly. Just seeing a JabRef class does not support in checking if you setup everything correctly.

@subhramit
Copy link
Member

I setup the checkstyle correctly

If you did, just removing the imports would make IntelliJ automatically re-import in the correct order.

@kaushikaW
Copy link
Author

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.
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.

@koppor @egonw can you give some hints to fix this issue I setup the checkstyle correctly but I 'm currently struggling to resolve Checkstyle: Wrong order error
image

https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html

Screenshot of your IntellIj config missing. We cannot double check whether you setup everything correctly. Just seeing a JabRef class does not support in checking if you setup everything correctly.

here are my configs of interlij plz help me on this
code style
image
check style
image
JavaDoc
image
Auto import
image
code folding
image

@kaushikaW kaushikaW marked this pull request as draft March 16, 2025 10:46
@kaushikaW kaushikaW closed this Mar 16, 2025
@koppor
Copy link
Member

koppor commented Mar 16, 2025

code style

It should show "JabRef". If you want, you can submit a PR modifying https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html to show the result after the import. Currently, we show the state before the import, which is equal to your setup.

@koppor
Copy link
Member

koppor commented Mar 16, 2025

Follow-up PR #12747

@kaushikaW
Copy link
Author

code style

It should show "JabRef". If you want, you can submit a PR modifying https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-13-code-style.html to show the result after the import. Currently, we show the state before the import, which is equal to your setup.

Okay, thanks for the help! I fixed the issue. The reason was that I had installed another code formatting plugin. I just uninstalled it, and now everything is fine. Thanks for the help!

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.

Add example questions to AI chat
3 participants