mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
refactor: Encrypt & Expire User Provided Keys, feat: Rate Limiting (#874)
* docs: make_your_own.md formatting fix for mkdocs * feat: add express-mongo-sanitize feat: add login/registration rate limiting * chore: remove unnecessary console log * wip: remove token handling from localStorage to encrypted DB solution * refactor: minor change to UserService * fix mongo query and add keys route to server * fix backend controllers and simplify schema/crud * refactor: rename token to key to separate from access/refresh tokens, setTokenDialog -> setKeyDialog * refactor(schemas): TEndpointOption token -> key * refactor(api): use new encrypted key retrieval system * fix(SetKeyDialog): fix key prop error * fix(abortMiddleware): pass random UUID if messageId is not generated yet for proper error display on frontend * fix(getUserKey): wrong prop passed in arg, adds error handling * fix: prevent message without conversationId from saving to DB, prevents branching on the frontend to a new top-level branch * refactor: change wording of multiple display messages * refactor(checkExpiry -> checkUserKeyExpiry): move to UserService file * fix: type imports from common * refactor(SubmitButton): convert to TS * refactor(key.ts): change localStorage map key name * refactor: add new custom tailwind classes to better match openAI colors * chore: remove unnecessary warning and catch ScreenShot error * refactor: move userKey frontend logic to hooks and remove use of localStorage and instead query the DB * refactor: invalidate correct query key, memoize userKey hook, conditionally render SetKeyDialog to avoid unnecessary calls, refactor SubmitButton props and useEffect for showing 'provide key first' * fix(SetKeyDialog): use enum-like object for expiry values feat(Dropdown): add optionsClassName to dynamically change dropdown options container classes * fix: handle edge case where user had provided a key but the server changes to env variable for keys * refactor(OpenAI/titleConvo): move titling to client to retain authorized credentials in message lifecycle for titling * fix(azure): handle user_provided keys correctly for azure * feat: send user Id to OpenAI to differentiate users in completion requests * refactor(OpenAI/titleConvo): adding tokens helps minimize LLM from using the language in title response * feat: add delete endpoint for keys * chore: remove throttling of title * feat: add 'Data controls' to Settings, add 'Revoke' keys feature in Key Dialog and Data controls * refactor: reorganize PluginsClient files in langchain format * feat: use langchain for titling convos * chore: cleanup titling convo, with fallback to original method, escape braces, use only snippet for language detection * refactor: move helper functions to appropriate langchain folders for reusability * fix: userProvidesKey handling for gptPlugins * fix: frontend handling of plugins key * chore: cleanup logging and ts-ignore SSE * fix: forwardRef misuse in DangerButton * fix(GoogleConfig/FileUpload): localize errors and simplify validation with zod * fix: cleanup google logging and fix user provided key handling * chore: remove titling from google * chore: removing logging from browser endpoint * wip: fix menu flicker * feat: useLocalStorage hook * feat: add Tooltip for UI * refactor(EndpointMenu): utilize Tooltip and useLocalStorage, remove old 'New Chat' slide-over * fix(e2e): use testId for endpoint menu trigger * chore: final touches to EndpointMenu before future refactor to declutter component * refactor(localization): change select endpoint to open menu and add translations * chore: add final prop to error message response * ci: minor edits to facilitate testing * ci: new e2e test which tests for new key setting/revoking features
This commit is contained in:
parent
64f1557852
commit
4ca43fb53d
122 changed files with 1933 additions and 966 deletions
|
|
@ -30,6 +30,8 @@ export default {
|
|||
com_ui_pay_per_call: 'All AI conversations in one place. Pay per call and not per month',
|
||||
com_ui_enter: 'Enter',
|
||||
com_ui_submit: 'Submit',
|
||||
com_ui_upload_success: 'Successfully uploaded file',
|
||||
com_ui_upload_invalid: 'Invalid file for upload',
|
||||
com_ui_cancel: 'Cancel',
|
||||
com_ui_save: 'Save',
|
||||
com_ui_copy_to_clipboard: 'Copy to clipboard',
|
||||
|
|
@ -40,12 +42,17 @@ export default {
|
|||
com_ui_success: 'Success',
|
||||
com_ui_all: 'all',
|
||||
com_ui_clear: 'Clear',
|
||||
com_ui_revoke: 'Revoke',
|
||||
com_ui_revoke_info: 'Revoke all user provided credentials.',
|
||||
com_ui_confirm_action: 'Confirm Action',
|
||||
com_ui_chats: 'chats',
|
||||
com_ui_delete: 'Delete',
|
||||
com_ui_delete_conversation: 'Delete chat?',
|
||||
com_ui_delete_conversation_confirm: 'This will delete',
|
||||
com_auth_error_login:
|
||||
'Unable to login with the information provided. Please check your credentials and try again.',
|
||||
com_auth_error_login_rl:
|
||||
'Too many login attempts from this IP in a short amount of time. Please try again later.',
|
||||
com_auth_no_account: 'Don\'t have an account?',
|
||||
com_auth_sign_up: 'Sign up',
|
||||
com_auth_sign_in: 'Sign in',
|
||||
|
|
@ -96,6 +103,7 @@ export default {
|
|||
com_auth_to_try_again: 'to try again.',
|
||||
com_auth_submit_registration: 'Submit registration',
|
||||
com_auth_welcome_back: 'Welcome back',
|
||||
com_endpoint_open_menu: 'Open Menu',
|
||||
com_endpoint_bing_enable_sydney: 'Enable Sydney',
|
||||
com_endpoint_bing_to_enable_sydney: 'To enable Sydney',
|
||||
com_endpoint_bing_jailbreak: 'Jailbreak',
|
||||
|
|
@ -189,29 +197,30 @@ export default {
|
|||
com_endpoint_func_hover: 'Enable use of Plugins as OpenAI Functions',
|
||||
com_endpoint_skip_hover:
|
||||
'Enable skipping the completion step, which reviews the final answer and generated steps',
|
||||
com_endpoint_config_token: 'Config Token',
|
||||
com_endpoint_config_token_for: 'Config Token for',
|
||||
com_endpoint_config_token_name: 'Token Name',
|
||||
com_endpoint_config_token_name_placeholder: 'Set token first',
|
||||
com_endpoint_config_token_server: 'Your token will be sent to the server, but not saved.',
|
||||
com_endpoint_config_token_import_json_key: 'Import Service Account JSON Key.',
|
||||
com_endpoint_config_token_import_json_key_succesful: 'Import Service Account JSON Key.',
|
||||
com_endpoint_config_token_import_json_key_invalid:
|
||||
com_endpoint_config_key: 'Set API Key',
|
||||
com_endpoint_config_key_for: 'Set API Key for',
|
||||
com_endpoint_config_key_name: 'Key',
|
||||
com_endpoint_config_value: 'Enter value for',
|
||||
com_endpoint_config_key_name_placeholder: 'Set API key first',
|
||||
com_endpoint_config_key_encryption: 'Your key will be encrypted and deleted at',
|
||||
com_endpoint_config_key_expiry: 'the expiry time',
|
||||
com_endpoint_config_key_import_json_key: 'Import Service Account JSON Key.',
|
||||
com_endpoint_config_key_import_json_key_success: 'Successfully Imported Service Account JSON Key',
|
||||
com_endpoint_config_key_import_json_key_invalid:
|
||||
'Invalid Service Account JSON Key, Did you import the correct file?',
|
||||
com_endpoint_config_token_get_edge_key: 'To get your Access token for Bing, login to',
|
||||
com_endpoint_config_token_get_edge_key_dev_tool:
|
||||
com_endpoint_config_key_get_edge_key: 'To get your Access token for Bing, login to',
|
||||
com_endpoint_config_key_get_edge_key_dev_tool:
|
||||
'Use dev tools or an extension while logged into the site to copy the content of the _U cookie. If this fails, follow these',
|
||||
com_endpoint_config_token_edge_instructions: 'instructions',
|
||||
com_endpoint_config_token_edge_full_token_string: 'to provide the full cookie strings.',
|
||||
com_endpoint_config_token_chatgpt:
|
||||
'To get your Access token For ChatGPT \'Free Version\', login to',
|
||||
com_endpoint_config_token_chatgpt_then_visit: 'then visit',
|
||||
com_endpoint_config_token_chatgpt_copy_token: 'Copy access token.',
|
||||
com_endpoint_config_token_google_need_to: 'You need to',
|
||||
com_endpoint_config_token_google_vertex_ai: 'Enable Vertex AI',
|
||||
com_endpoint_config_token_google_vertex_api: 'API on Google Cloud, then',
|
||||
com_endpoint_config_token_google_service_account: 'Create a Service Account',
|
||||
com_endpoint_config_token_google_vertex_api_role:
|
||||
com_endpoint_config_key_edge_instructions: 'instructions',
|
||||
com_endpoint_config_key_edge_full_key_string: 'to provide the full cookie strings.',
|
||||
com_endpoint_config_key_chatgpt: 'To get your Access token For ChatGPT \'Free Version\', login to',
|
||||
com_endpoint_config_key_chatgpt_then_visit: 'then visit',
|
||||
com_endpoint_config_key_chatgpt_copy_token: 'Copy access token.',
|
||||
com_endpoint_config_key_google_need_to: 'You need to',
|
||||
com_endpoint_config_key_google_vertex_ai: 'Enable Vertex AI',
|
||||
com_endpoint_config_key_google_vertex_api: 'API on Google Cloud, then',
|
||||
com_endpoint_config_key_google_service_account: 'Create a Service Account',
|
||||
com_endpoint_config_key_google_vertex_api_role:
|
||||
'Make sure to click \'Create and Continue\' to give at least the \'Vertex AI User\' role. Lastly, create a JSON key to import here.',
|
||||
com_nav_export_filename: 'Filename',
|
||||
com_nav_export_filename_placeholder: 'Set the filename',
|
||||
|
|
@ -240,6 +249,7 @@ export default {
|
|||
com_nav_settings: 'Settings',
|
||||
com_nav_search_placeholder: 'Search messages',
|
||||
com_nav_setting_general: 'General',
|
||||
com_nav_setting_data: 'Data controls',
|
||||
com_nav_language: 'Language',
|
||||
com_nav_lang_english: 'English',
|
||||
com_nav_lang_chinese: '中文',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue