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

拉取 #4901

Closed
wants to merge 1 commit into from
Closed

拉取 #4901

wants to merge 1 commit into from

Conversation

QQHKX
Copy link

@QQHKX QQHKX commented Jun 30, 2024

Summary by CodeRabbit

  • New Features

    • Updated branding and text content across the application to "qiqi-GPT 共享平台" and related descriptions.
  • Removed

    • Removed update checking and handling UI from the Settings component.
  • Bug Fixes

    • Fixed various text strings in Chinese localization for better user guidance.
  • Other Improvements

Copy link

vercel bot commented Jun 30, 2024

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

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Jun 30, 2024

Walkthrough

The updates primarily rebrand the application from "ChatGPT Next Web" to "qiqi-GPT 共享平台" across various components and configurations. Text content, UI elements, update notifications, and manifest files have been updated accordingly. Additionally, update handling logic has been removed from the Settings component, simplifying its codebase.

Changes

Files Change Summary
app/components/exporter.tsx Updated displayed text in ImagePreviewer, including main titles and subtitles.
app/components/settings.tsx Removed the section and logic handling update checking and notifications.
app/components/sidebar.tsx Updated sidebar title and subtitle text; added a comment in Chinese.
app/constant.ts Changed REPO_URL to point to https://www.baidu.com.
app/layout.tsx Updated title values in the metadata object to "qiqi-GPT 共享平台".
app/locales/cn.ts Modified various text strings like error messages, authentication prompts, and plugin names.
app/store/update.ts Updated update-related notification titles and messages to reflect the new branding.
public/site.webmanifest Changed the application name to "qiqi-GPT 共享平台" in the manifest file.
src-tauri/tauri.conf.json Updated product name and descriptions from "ChatGPT Next Web" to "qiqi-GPT 共享平台" throughout the config.

Poem

In the land of code so spry and neat,
Changed the name, quite the feat!
From ChatGPT to qiqi's grace,
New titles, messages in place.
Simplified settings, clear and bright,
For a platform that feels just right! ✨🚀✨


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 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
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Your build has completed!

Preview deployment

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c359b30 and 0c55f97.

Files selected for processing (9)
  • app/components/exporter.tsx (3 hunks)
  • app/components/settings.tsx (1 hunks)
  • app/components/sidebar.tsx (2 hunks)
  • app/constant.ts (1 hunks)
  • app/layout.tsx (2 hunks)
  • app/locales/cn.ts (2 hunks)
  • app/store/update.ts (1 hunks)
  • public/site.webmanifest (1 hunks)
  • src-tauri/tauri.conf.json (4 hunks)
Files not reviewed due to errors (2)
  • app/components/sidebar.tsx (no review received)
  • app/locales/cn.ts (no review received)
Files skipped from review due to trivial changes (3)
  • app/constant.ts
  • public/site.webmanifest
  • src-tauri/tauri.conf.json
Additional context used
Biome
app/store/update.ts

[error] 37-43: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 93-121: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

app/components/sidebar.tsx

[error] 181-188: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)

app/components/exporter.tsx

[error] 97-106: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 165-173: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 169-173: This else clause can be omitted because previous branches break early.

(lint/style/noUselessElse)


[error] 196-196: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 216-216: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 490-490: innerHTML is assigned to itself.

This is where is assigned.

(lint/correctness/noSelfAssign)


[error] 641-642: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)

app/components/settings.tsx

[error] 92-92: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 104-104: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 327-327: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 348-348: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 363-363: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 381-381: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 394-394: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 405-405: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 423-423: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 437-437: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 447-447: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 657-657: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 664-667: Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.

Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.

(lint/a11y/useKeyWithClickEvents)


[error] 679-679: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 696-696: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 736-736: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 752-752: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 768-768: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 788-789: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 805-805: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (3)
app/layout.tsx (2)

9-9: Update metadata title to reflect rebranding.

The title in the metadata has been updated to "qiqi-GPT 共享平台" to reflect the new branding.


21-21: Update appleWebApp title to reflect rebranding.

The appleWebApp title in the metadata has been updated to "qiqi-GPT 共享平台" to reflect the new branding.

app/components/exporter.tsx (1)

517-518: Update titles to reflect rebranding.

The main title and subtitle have been updated to "qiqi-GPT 共享平台" and "qiqi为爱发电" respectively.

.isPermissionGranted()
.then((granted) => {
if (!granted) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return;
return;
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});

});
}
});
await window.__TAURI__?.notification
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await window.__TAURI__?.notification
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});

await window.__TAURI__?.notification
.isPermissionGranted()
.then((granted) => {
if (!granted) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!granted) {
if (!granted) {
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});

}
});
await window.__TAURI__?.notification
.isPermissionGranted()
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.isPermissionGranted()
.isPermissionGranted()
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});

.then((granted) => {
if (!granted) {
return;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else {
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});
Tools
Biome

[error] 93-121: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)

});
await window.__TAURI__?.notification
.isPermissionGranted()
.then((granted) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unnecessary else clause.

The else clause can be omitted because the previous branch already returns early.

-              } else {
-                // Request permission to show notifications
-                window.__TAURI__?.notification
-                  .requestPermission()
-                  .then((permission) => {
-                    if (permission === "granted") {
-                      if (version === remoteId) {
-                        // Show a notification using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: `${Locale.Settings.Update.IsLatest}`,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      } else {
-                        const updateMessage =
-                          Locale.Settings.Update.FoundUpdate(`${remoteId}`);
-                        // Show a notification for the new version using Tauri
-                        window.__TAURI__?.notification.sendNotification({
-                          title: "qiqi-GPT 共享平台",
-                          body: updateMessage,
-                          icon: `${ChatGptIcon.src}`,
-                          sound: "Default",
-                        });
-                      }
-                    }
-                  });
-              }
+              }
+              // Request permission to show notifications
+              window.__TAURI__?.notification
+                .requestPermission()
+                .then((permission) => {
+                  if (permission === "granted") {
+                    if (version === remoteId) {
+                      // Show a notification using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: `${Locale.Settings.Update.IsLatest}`,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    } else {
+                      const updateMessage =
+                        Locale.Settings.Update.FoundUpdate(`${remoteId}`);
+                      // Show a notification for the new version using Tauri
+                      window.__TAURI__?.notification.sendNotification({
+                        title: "qiqi-GPT 共享平台",
+                        body: updateMessage,
+                        icon: `${ChatGptIcon.src}`,
+                        sound: "Default",
+                      });
+                    }
+                  }
+                });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.then((granted) => {
}
// Request permission to show notifications
window.__TAURI__?.notification
.requestPermission()
.then((permission) => {
if (permission === "granted") {
if (version === remoteId) {
// Show a notification using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: `${Locale.Settings.Update.IsLatest}`,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
} else {
const updateMessage =
Locale.Settings.Update.FoundUpdate(`${remoteId}`);
// Show a notification for the new version using Tauri
window.__TAURI__?.notification.sendNotification({
title: "qiqi-GPT 共享平台",
body: updateMessage,
icon: `${ChatGptIcon.src}`,
sound: "Default",
});
}
}
});

@lloydzhou

This comment was marked as spam.

@lloydzhou lloydzhou closed this Jul 1, 2024
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.

2 participants