-
Notifications
You must be signed in to change notification settings - Fork 61.2k
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
切换prompts源为jsdelivr,更新prompts列表,美化prompts.json的写入 #6253
base: main
Are you sure you want to change the base?
Conversation
@takestairs is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes update URL references and JSON formatting in two parts of the codebase. In the Changes
Sequence Diagram(s)sequenceDiagram
participant S as Script
participant F as Fetch Service (jsDelivr CDN)
participant FS as File System
S->>F: Request prompt data (using URL with @main branch)
F-->>S: Return prompt JSON data
S->>FS: Write JSON file with formatting (indentation)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
scripts/fetch-prompts.mjs (2)
4-4
: Security improvement with HTTPS, but consider version pinning.The switch to jsdelivr CDN with HTTPS is a good security improvement. However, using
@main
without version pinning could lead to unexpected changes if the upstream repositories update their content.Consider pinning to specific commits for better stability:
-const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh@main/prompts-zh.json"; +const RAW_CN_URL = "PlexPt/awesome-chatgpt-prompts-zh@{commit-hash}/prompts-zh.json";Also applies to: 6-6, 8-8, 10-10
16-22
: Consider improving timeout and error handling.The current implementation has some potential reliability issues:
- The 5000ms timeout might be too short for some regions
- No retry mechanism for transient failures
- Limited error logging
Consider implementing:
- Configurable timeout duration
- Retry mechanism with exponential backoff
- Detailed error logging including HTTP status codes
Example implementation:
const fetchWithRetry = async (url, timeout = 5000, maxRetries = 3) => { for (let i = 0; i < maxRetries; i++) { try { const response = await Promise.race([ fetch(url), timeoutPromise(timeout * Math.pow(2, i)) ]); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response; } catch (error) { console.error(`Attempt ${i + 1}/${maxRetries} failed:`, error); if (i === maxRetries - 1) throw error; } } };Also applies to: 27-27, 46-46, 66-66
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/fetch-prompts.mjs
(2 hunks)
🔇 Additional comments (1)
scripts/fetch-prompts.mjs (1)
86-86
: LGTM! Improved JSON formatting.The addition of proper JSON formatting (indentation of 2 spaces) improves readability while maintaining consistent formatting in both success and error cases.
Also applies to: 90-90
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
📝 补充信息 | Additional Information
Summary by CodeRabbit