ChatGPTNextWeb / ChatGPT-Next-Web

A cross-platform ChatGPT/Gemini UI (Web / PWA / Linux / Win / MacOS). 一键拥有你自己的跨平台 ChatGPT/Gemini 应用。
https://app.nextchat.dev/
MIT License
72.61k stars 57.69k forks source link

Export sync config #4902

Open bygsn opened 4 days ago

bygsn commented 4 days ago

Export and Import Sync Configuration as Compressed String

Overview

This PR introduces a feature to export sync configurations as compressed strings, automatically copy them to the clipboard, and provide an import function to apply these configurations. This enhancement facilitates easy cross-platform synchronization of cloud data settings.

Implementation Details

Motivation

This feature improves user experience by simplifying configuration transfer between devices or platforms, allowing users to easily share or backup settings without manual copying and eliminating transcription error risks.

Usage and Screenshots

Exporting Configuration

export Figure 1: Export Sync Configuration Process

  1. Navigate to the Cloud Data section
  2. Click the "Configure" button
  3. Enter sync configuration and confirm
  4. Click the "Export" button that appears
  5. Configuration is automatically copied to clipboard
  6. Success message: "Sync configuration copied to clipboard" (Failure message: "Sync configuration export failed. Please try again")

Importing Configuration

import Figure 2: Import Sync Configuration Process

  1. Navigate to the Cloud Data section on target device/platform
  2. Click the "Import" button
  3. Paste the copied string into the "Import Sync Configuration" window
  4. Click "Confirm" to import
  5. Success message: "Sync configuration imported successfully" (Failure message: "Sync configuration import failed. Please check the configuration string")
  6. Click sync button to complete data synchronization

Testing

  1. Export Configuration:

    • Follow export steps and verify success message
    • Confirm compressed string in a text editor
  2. Import Configuration:

    • Follow import steps on another device/browser
    • Verify correct application of imported settings
    • Confirm sync settings update as expected

Related Issues

Additional Notes

This PR targets the main branch. Please advise if it should be directed elsewhere.

Feedback and improvement suggestions are welcome. Thank you for your review!

Summary by CodeRabbit

vercel[bot] commented 4 days ago

Someone is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

coderabbitai[bot] commented 4 days ago

Walkthrough

These changes introduce a new feature for exporting and importing synchronization configurations in the application. A modal interface was added for importing configurations, along with relevant state management and icons in the settings component. New localized strings were added to support these functionalities in multiple languages. The backend logic in the sync store was enhanced to handle exporting and importing configurations, leveraging the pako library for data compression.

Changes

File(s) Summary
app/components/settings.module.scss Added styles for .import-config-modal and nested .import-config-content.
app/components/settings.tsx Added UI imports, icon imports, ImportConfigModal component, state and logic for import modal, and buttons for data import/export.
app/locales/cn.ts, app/locales/en.ts Added new localization strings for import/export functionalities and their respective messages.
app/store/sync.ts Added pako import. Implemented exportSyncConfig and importSyncConfig functions for handling synchronization configurations. Updated cloudSync with revised error handling.
package.json Added pako to dependencies and @types/pako to devDependencies.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as UI Components
    participant Settings as Settings Component
    participant Store as Sync Store

    User->>UI: Click on Import Button
    UI->>Settings: Show Import Modal
    Settings->>Settings: User Enters Config Data
    Settings->>Store: Call importSyncConfig(data)
    Store->>Settings: Return Success/Failure
    Settings->>UI: Display Result Message

Assessment against linked issues

Objective Addressed Explanation
Add cloud sync parameters to environment variables (#4892) This change does not address environment variables.
Provide fixed sync settings across devices without re-setup (#3760)

Poem

Amidst the code, a rabbit toils, To sync the clouds and ease the spoils. With icons bright and buttons neat, Configs now smoothly import and export fleet. Rejoice, dear coders, in this feat!


[!TIP]

Early access features: enabled We are currently testing the following features in early access: - **OpenAI `gpt-4o` model for code reviews and chat**: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available. Note: - You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file. - Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide feedback and report issues. - OSS projects are always opted into early access features.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
github-actions[bot] commented 4 days ago

Your build has completed!

[Preview deployment]()

ImBIOS commented 2 days ago

@KILL4M let me answer you question in my comit here:

Answer

  1. You're good. For outsider, it's normal. Because Vercel deployment requires some level of internal team access.
  2. I've done review on this PR. To make it simple, what @coderabbitai does is already great:
  3. 2 options: a. simple: just report issue, engage in discussion, report security vuln, or made a PR and let the maintianer or reviewer decide wether it's helpful or not. b. takes time: before engage in any open source activity, always read the contributing guideline, security document, license, code of conduct and any rules that have been set by the internal team of that open source project and you'll get anythin you need in those documents.

Welcome to open source, I recommend to active engaging in open source activity after your main job is done perfectly. Don't make this a main job, no one paying you for living... except donation.

I recommend you to not opening a discussion in some of the merged commit like this. There's better option like discussions tab, or inside the PR or issue you're active on. My first thought when my commit got commented is, "what's wrong with my merged single line commit? I need to rush to my desktop ASAP and fix it", thanks God it's just some questions not some disastrous thingy.

ImBIOS commented 2 days ago

@KILL4M I found out you're spamming some merged commit just to ask questions, email is better way to spam people tho (cause there's filtering function there 😅), please don't do that.

This https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web project is an open source non profit project. I even not expecting them to care about this project much, because they should care more about their food on the table. Which tech industry currently in trouble especially in Mainland China which the most of the maintainer team geographically located. Please have patience or just work on your fork, like everyone in open source community does. Or you can financially support the maintainer if you think this is important and urgent matter so they can have time to focus on your problem while their bills paid.

If it's in my open source project, I might temporarily ban you for the spam. That's how bad it is spamming in another people's merged commit.

coderabbitai[bot] commented 2 days ago

@ImBIOS: Thank you for providing detailed feedback and guidance. It's crucial for contributors to understand the appropriate ways to engage in open-source projects and follow the guidelines set by the maintainers. If there are any further questions or issues, feel free to reach out, and I'll be happy to assist.

Actions performed Comments resolved.