-
Notifications
You must be signed in to change notification settings - Fork 0
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
API token should be fetched later #104
Comments
I'm not sure how to code this properly. This will probably break some symmetry and used practice, but yes, the issue is right. Can I make |
Maybe, the other places need to be changed "accordingly" (e.g., proxy password, ...). I think, however, that it is OK for JabRef users with proxy passwords that JabRef asks for the password right at the start. For API keys, I am not that sure... With your changes, an example can be shown how it will work.
Yes. This will lead to another method signature in |
Maybe "Future" helps? |
Okay, I think I managed to do this in a recent push |
No, see output of
|
Are you sure you started JabRef without AI-enabled? |
If this is too difficult to implement, we can postpone to the famous week 12. |
Ah, I see. I just implemented it for:
And after that the key will be fetched |
As I understand, we should fetch the key ONLY when we start chatting or summarizing? |
Yes. For the preferences, it is difficult. A "perfect" solution would be follwowing: Assumption: Password field is write-only There is no (!) eye icon - thus I cannot read from the field: As a consequence, the field is write only. Question: Should the user know if (s)he entered anything?
After the user changed the text field, the new key is stored in the key store. No need to read the api key ever in the preferences. |
Note that there is something reading the the AI Preferences - and thus the key:
|
See my comment JabRef@1d4c383 on a possible code-based solution. |
Hope I managed to do this in a recent push |
I commented at JabRef#11430 (review) - please refine the code. |
I took this approach: I mark unloaded keys as empty strings. If the string is empty, then it will be retrieved from keyring. I think, this is okay? (You should see a message "InAnYan referenced this issue", above this comment) About factoring out fields: I wonder, if it's really needed. Currently I only see one purpose - grouping. If it had more complex logic.. |
Actually, I understood. It would be better to have a separate class for API keys in case there will be more of them. They should be stored in a |
Yes!
Yes. The enum The |
I wonder, Oliver, if we can make a separate issue for "Refactor support of multiple AI providers", because not only API key is associated with an AI provider. For now we have a simple fix. What if I make that issue and close this one (close this - because API token is fetched later) |
Go ahead with creating a new issue and closing this (with a reference to the new isssue) |
There still was a call to |
* Fix the code from code review * Fix from code review and create new AiChatTabWorking * Improve chat history storage code * More fix from code review * Remove obsolete parameter * Add JavaDoc comment * Fix checkstyle * Fix JavaDoc * Fix more checkstyle * More checkstyle fixes * Fix code changes * Improve the PR * Rework ADR-0031 to enable to use another option * Add many LOGGEr.trace statements * Change "message window" to "context window" * Fix compiler errors * Fix issue list index issue of langchain4j * Fix lint issue * Update 0031-store-chats-alongside-database.md * More tracing * Refine logging * Remove closing of AiChatLanguageModel (because it's not closable) * Use external package for OpenAI API connection * Provide a custom executor for RetrievalAugmentor * Fix shutdown issue (I hope) * Refactor classes * Change BibDatabaseChatHistoryFile * Revert BibDatabaseChatHistoryFile to old version because of langchain4j * Make round corners for chat messages * Refactor embeddings generation * Refactor embeddings generation * Refactor embeddings generation * Fix CHANGELOG.md * Remove jpro-mdfx * Add comment * Fix localizations * Fix checkstyle and remove OpenAI from PRIVACY.md * Remove unnecessary comments * Fix privacy notice UI * Introduce new ApiKeyMissingComponent * Thanks Tobiaz Diez for writing such a good EntryEditorTab class * Fix InAnYan/jabref issues * Merge `build.gradle` and `settings.gradle` from main branch * Update ADRs * Implement rethought ADR for chat history * Use OpenAI embedding model * Use Deep Java embedding model * Remove old langchain4j embedding models * Fix checkstyle errors * Fix checkstyle and remove old dependencies * Fixes from code review * Restructure * Fix checkstyle errors * Add API base URL parameter * Fix localization * Fix from code review + ADR * Something broken * Now MistralAI and Hugging Face work * Fix base URL for other LLM providers * Fix base URL for other LLM providers * Refactor MVStore usage * Load embedding model in background * Bump langchain4j version * Fix bug * Fix checkstyle and localization * Implement summarization * Fix checkstyle and localization * Improve PrivacyNoticeComponent * Fix from code review * Update localization * Wrap text * Add padding * Fix markdown * Use stuff algorithm * Add GPT-4o-mini * Make chat model editable * Update context window size and summarization * Fix checkstyle * Update PrivacyNoticeComponent.fxml * Update AI summary tab * Fix localization * Change order so that there is no diff * Reorrder dependencies * Add missing CHANGELOG.md entry * Refine ADR-0033 * Refine ADR0034 * Fix typos * Refine ADR-0036 * Fix ADR-0037 * Fix title case * Fix changes in module-info.java * Readd removed requires org.apache.httpcomponents.core5.httpcore5 * Revert change in JabRefGUI to avoid conflicts * Remove empty lines * Reorder entries in JabRef_en.properties * Simplify SummariesStorage (and add test) * Use region/endregion * Fix position of comment * Add comment why the event bus is needed * Do not show exception to the user - just that an error is occurred (saves %0 in localization) * Use "URL %0" without colon (consistency) * Fix typos * History has to be kept * Remove empty lines * Fix language (hopefully) * Compilefix * Simplify BibDatabaseChatHistoryManager * Fix from code review * Fix issue #103 * Rework embeddings cache clearing * Fix #99 and partially #101 * Partially fixing shutdown issues and UI progress monitor issue * Add "requires scala.library" and add "region:" / "endregion" * More grouping (move de.saxsys.mvvmfx.validation up) * Add alphabetical hint * Fix InAnYan#101 and InAnYan#106 * Discard changes to settings.gradle * Fix InAnYan#105 * Follow-up fix for InAnYan#103 * Follow-up fix for InAnYan#103 * Remove obsolete class * Partially fix InAnYan#98 * We do need dependencies to the AI providers, don't we? * Fix InAnYan#93 * Simplify code * Partially fix InAnYan#92 * Fix checkstyle and localization * Fix hyperlinks and text in ApiKeyMissingComponent * Fixes from code review * Fix InAnYan#120 * Remove "X% work done" messages * Fix InAnYan#114 * Partially fix InAnYan#113 * Partially fix InAnYan#110 * Fix InAnYan#110 * Fix InAnYan#111 * Improve embedding model downloading notifications * Fix InAnYan#124 * Fix InAnYan#122 * Fix wrong context window size when expert settings customization is turned off * Attempt to fix InAnYan#95 * Finally fix InAnYan#105 * Fix InAnYan#108 * Attempt to fix InAnYan#98 * Fix for InAnYan#104 * Fix for InAnYan#98 * Fix for InAnYan#95 (comment) * Fix for InAnYan#98 (comment) * Fix for InAnYan#126 * Fix for InAnYan#115 * Fix for InAnYan#113 * Fix for InAnYan#91 * Fix for InAnYan#121 * Fix for InAnYan#112 and InAnYan#116 * Fix for InAnYan#125 * Fixes from commit comments * Fix for InAnYan#115 * Fix for InAnYan#120 * Fix for InAnYan#132 * Fix for InAnYan#132 * Fix for InAnYan#104 * Fix for InAnYan#118 * Fix for InAnYan#114 * Fix for InAnYan#104 * Store error messages in chat history * Make error be a ChatMessageComponent * Implement delete messages InAnYan#136 * Fix for InAnYan#118 * Fix for InAnYan#92 * Fix checkstyle and localization. And refactoring * Fix for InAnYan#92 * Fix for InAnYan#139 * Show "Delete message" button only when necessary * Fix for InAnYan#83 * Update src/main/java/org/jabref/logic/ai/AiService.java Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> * Update src/main/java/org/jabref/logic/ai/chathistory/BibDatabaseChatHistoryManager.java Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> * Update src/main/java/org/jabref/logic/ai/AiService.java Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> * Update src/main/java/org/jabref/gui/Base.css Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> * Update src/main/java/org/jabref/gui/Base.css Co-authored-by: Oliver Kopp <kopp.dev@gmail.com> * Fix from code review * Partial fix for InAnYan#125 * Update colors for error message * Fix for InAnYan#145 and InAnYan#142 * Make progress for embedding model download * Fix checkstyle and localization * Add workaround to get FileHistoryMenuTest running again * Small fixes * Revert "Small fixes" This reverts commit 85382a1. * Introduce AiApiKeyProvider * Fix IDE setup instructions * Do not load API keys on startup * Rely on keystore encryption * Prevent mulitple rebuilds when muliple preferences are updated * Fix localization to be more provider independent * Fix method names * Add poor man's solution to notify of API key changes * Reduce calls to key store (and fix key saving) * Fix for InAnYan#148 and partially InAnYan#146 * Revert "Fix for InAnYan#148 and partially InAnYan#146" This reverts commit 5fa3bb5. * Fix for scrolling down when deleting a message * Sort EmbeddingModel enum variants * Fix GenerateSummaryTask progress indication * Fix dark mode * Add notice for embedding models size --------- Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
JabRef uses Java Key Ring to connect to password stores.
org.jabref.preferences.JabRefPreferences#getAiPreferences
access that key store when creating the AI Chat tab. This leads to following startup error output:When opening preferences, the key is there.
When using Gnome, on startup, one will be asked to open the key store. This is not necessary. It is necessary when interacting with the AI.
Please postpone the call to
org.jabref.preferences.JabRefPreferences#getAiApiTokenFromKeyring
to the latest point in time (and store the key internally once retrieved). (OK, one also has to take care if they key is changed by the user)The text was updated successfully, but these errors were encountered: