-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Conversation
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); | ||
} |
There was a problem hiding this comment.
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.
private void sendExampleQuestion1Prompt() { | ||
String questionText = exQuestion1.getText(); | ||
onSendMessage(questionText); | ||
} |
There was a problem hiding this comment.
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.
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); | ||
} |
There was a problem hiding this comment.
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.
@trag-bot didn't find any issues in the code! ✅✨ |
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 |
|
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. |
If you did, just removing the imports would make IntelliJ automatically re-import in the correct order. |
here are my configs of interlij plz help me on this |
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. |
Follow-up PR #12747 |
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! |
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.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)