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

⚖️ feat: Terms and Conditions Dialog #3712

Merged
merged 17 commits into from
Aug 31, 2024

Conversation

maxesse
Copy link
Contributor

@maxesse maxesse commented Aug 20, 2024

Pull Request Template

⚠️ Before Submitting a PR, Please Review:

  • Please ensure that you have thoroughly read and understood the Contributing Docs before submitting your Pull Request.

⚠️ Documentation Updates Notice:

  • Kindly note that documentation updates are managed in this repository: librechat.ai

Summary

This feature provides a modal terms and conditions acceptance dialogue that the user needs to accept to proceed.
It's set up by the user by adding three options to librechat.yaml. modalAcceptance enables the feature, modalTitle assigns a custom title to it (if empty, a standard localised string will be used for Terms of Service), and modalContent (if empty the dialogue will say that there is no content). The content is expected to be presented in markdown. This is because embedding HTML led to... mixed results depending on what was coming in. The standard externalUrl parameters is still being used for LibreChat's terms of use link on the footer.

The change also provides a npm script (npm run reset-terms) to set all users to a non-accepted status (useful in case the terms and conditions change and need to be accepted again).

The change has been localised for all supported LibreChat languages too, except the content of the terms, as that would force users to change files under source control. Besides, it's quite common for terms and conditions to be in the native language of the country in which the instance is deployed, even if the rest is localised.

Closes #3650

Change Type

Please delete any irrelevant options.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update
  • Translation update

Testing

I tested the feature with each of the options with values and not to ensure that it doesn't break anything.

Test Configuration:

Add the following to librechat.yaml:

  # Terms of service
  termsOfService:
    externalUrl: 'https://librechat.ai/tos'
    openNewTab: true
    modalAcceptance: true
    modalTitle: "Terms of Service for LibreChat"
    modalContent: |
      # Terms and Conditions for LibreChat

      *Effective Date: February 18, 2024*

      Welcome to LibreChat, the informational website for the open-source AI chat platform, available at https://librechat.ai. These Terms of Service ("Terms") govern your use of our website and the services we offer. By accessing or using the Website, you agree to be bound by these Terms and our Privacy Policy, accessible at https://librechat.ai//privacy.

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • A pull request for updating the documentation has been submitted.

Copy link
Collaborator

@berry-13 berry-13 left a comment

Choose a reason for hiding this comment

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

I hope that all my comments make sense, thanks!

@danny-avila should we still access directly the User model?

client/src/components/ui/TermsAndConditionsModal.tsx Outdated Show resolved Hide resolved
api/server/controllers/UserController.js Outdated Show resolved Hide resolved
api/server/controllers/UserController.js Outdated Show resolved Hide resolved
client/src/components/ui/TermsAndConditionsModal.tsx Outdated Show resolved Hide resolved
client/src/components/ui/TermsAndConditionsModal.tsx Outdated Show resolved Hide resolved
client/src/routes/Root.tsx Outdated Show resolved Hide resolved
client/src/routes/Root.tsx Outdated Show resolved Hide resolved
client/src/components/ui/TermsAndConditionsModal.tsx Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
@maxesse
Copy link
Contributor Author

maxesse commented Aug 20, 2024

Thanks a lot! I implemented all the changes earlier - definitely did some learning on the api calls abstractions used in the app :)

@danny-avila
Copy link
Owner

@danny-avila should we still access directly the User model?

No, thanks for catching that!

And @maxesse thanks so much for the PR

@berry-13
Copy link
Collaborator

@maxesse Thank you! Could you reset the package lock? The easiest way is to just copy the package-lock from our repo to yours and make a commit; this way, you’re aligned with ours. Otherwise, you could try using npm run reinstall

@maxesse
Copy link
Contributor Author

maxesse commented Aug 21, 2024

Hello @berry-13, I just repushed package-lock copying it from librechat/main (I had done it yesterday, but for some reason it must have changed again?!).
Also, I am getting some warnings about peer dependencies since a few days ago when running npm update.

librechatadm@LibrechatVMNPMDev:~/LibreChat$ npm update
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @langchain/community@0.0.46
npm warn Found: mongodb@4.17.2
npm warn node_modules/mongodb
npm warn mongodb@"^4.5.0" from @keyv/mongo@2.2.8
npm warn node_modules/@keyv/mongo
npm warn @keyv/mongo@"^2.1.8" from @librechat/backend@0.7.4
npm warn api
npm warn
npm warn Could not resolve dependency:
npm warn peerOptional mongodb@"^5.2.0" from langchain@0.0.214
npm warn node_modules/langchain
npm warn langchain@"^0.0.214" from @librechat/backend@0.7.4
npm warn api
npm warn 1 more (langsmith)

@maxesse
Copy link
Contributor Author

maxesse commented Aug 22, 2024

Hello, @danny-avila @berry-13 do you need me to do anything else on this PR?

@danny-avila
Copy link
Owner

Hi @maxesse

Please resolve the conflicts, I will try to review this during the week since there's a lot of changes.

I'm cutting a release candidate today, merging this in at some point after that makes sense.

@maxesse
Copy link
Contributor Author

maxesse commented Aug 26, 2024

Ok @danny-avila, I'm travelling for work today and tomorrow, will merge with main on Wednesday and solve the conflicts 👍🏻

@danny-avila
Copy link
Owner

Ok @danny-avila, I'm travelling for work today and tomorrow, will merge with main on Wednesday and solve the conflicts 👍🏻

sweet!

@maxesse
Copy link
Contributor Author

maxesse commented Aug 27, 2024

@danny-avila ok, I solved the conflict (was only a very small thing in api-endpoints at the end of the file). Also there's a separate PR on the librechat.ai repo for the docs update.

@danny-avila danny-avila changed the title feat/Modal Terms and Conditions Dialog ⚖️ feat: Terms and Conditions Dialog Aug 31, 2024
@danny-avila danny-avila merged commit 618be4b into danny-avila:main Aug 31, 2024
2 checks passed
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.

Enhancement: Acceptance of Terms and Privacy Policy on First Login
3 participants