-
Notifications
You must be signed in to change notification settings - Fork 603
feat(update): switch to GitHub releases auto-update #1215
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
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
📝 WalkthroughWalkthroughThis PR implements a migration from canary-based to beta-based auto-update channel handling, consolidates macOS build configurations, and refactors CI/CD workflows to use GitHub Releases as the update provider. Version bumped to v0.5.6-beta.1 with corresponding translation updates across all supported languages. Changes
Sequence DiagramsequenceDiagram
participant User
participant Renderer
participant Main as Main Process
participant EU as electron-updater
participant GitHub
rect rgba(100, 150, 200, 0.2)
Note over User,GitHub: Update Check Flow
User->>Renderer: Check for Updates
Renderer->>Main: request update check
Main->>Main: Get updateChannel (normalize to beta/stable)
Main->>EU: checkForUpdates() with channel
EU->>GitHub: GET releases endpoint<br/>(filter by prerelease flag)
GitHub-->>EU: release metadata + assets
end
rect rgba(100, 200, 150, 0.2)
Note over Main,Renderer: Handling Update State
EU-->>Main: update-available event
Main->>Main: Convert to VersionInfo (githubUrl computed)
Main-->>Renderer: version info + download URL
Renderer->>Renderer: Display update notification
end
rect rgba(200, 150, 100, 0.2)
Note over Main,GitHub: Download & Release
alt Update Available
User->>Renderer: Accept Update
Renderer->>EU: download update
EU->>GitHub: download artifact
GitHub-->>EU: platform-specific package
EU->>Main: update-downloaded event
else Update Failed
EU->>Main: error event (track failure)
Main-->>Renderer: prompt manual update
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/presenter/upgradePresenter/index.ts (1)
361-363: Same catch clause type annotation issue.Apply the same fix here as noted above.
🔎 Proposed fix
- } catch (error: Error | unknown) { + } catch (error: unknown) {
🧹 Nitpick comments (6)
src/main/presenter/upgradePresenter/index.ts (4)
100-116: Use English for logs and comments in new code.Per coding guidelines, new code should use English for logs and comments. Several Chinese strings are present:
- Line 102:
'自动更新失败'- Line 115:
'正在检查更新'🔎 Suggested English translations
// 错误处理 autoUpdater.on('error', (e) => { - console.log('自动更新失败', e.message) + console.log('Auto update failed', e.message) this._lock = false this._status = 'error' this._error = e.message ... }) // 检查更新状态 autoUpdater.on('checking-for-update', () => { - console.log('正在检查更新') + console.log('Checking for updates') })
134-144: Good fallback for failed updates, but use English for user-facing messages.The logic to halt auto-updates after a previous failure is sound. However, the error message on line 137 is user-facing and should be in English (or use i18n):
🔎 Suggested change
if (this._previousUpdateFailed) { - console.log('上次更新失败,本次不进行自动更新,改为手动更新') + console.log('Previous update failed, skipping auto-update, switching to manual update') this._status = 'error' - this._error = '自动更新可能不稳定,请手动下载更新' + this._error = 'Auto-update may be unstable, please download manually'
202-251: Consider adding type validation for parsed update marker.The
updateInfofromJSON.parseon line 206 is implicitly typed asanyand directly assigned to_versionInfoon line 221. While the structure is expected to matchVersionInfo, there's no runtime validation.🔎 Suggested type guard
// Add a simple validation before assignment const isValidVersionInfo = (obj: unknown): obj is VersionInfo => { return ( typeof obj === 'object' && obj !== null && 'version' in obj && typeof (obj as VersionInfo).version === 'string' ) } // In checkPendingUpdate: const updateInfo = JSON.parse(content) if (!isValidVersionInfo(updateInfo)) { console.error('Invalid update marker format') fs.unlinkSync(this._updateMarkerPath) return }
418-437: Chinese strings in restartToUpdate.Several log messages and user-facing error strings are in Chinese. Per coding guidelines, new code should use English.
🔎 Suggested changes
restartToUpdate(): boolean { - console.log('重启并更新') + console.log('Restarting to apply update') if (this._status !== 'downloaded') { eventBus.sendToRenderer(UPDATE_EVENTS.ERROR, SendTarget.ALL_WINDOWS, { - error: '更新尚未下载完成' + error: 'Update has not finished downloading' }) return false } ... - console.error('重启更新失败', e) + console.error('Failed to restart and update', e)src/main/presenter/configPresenter/index.ts (1)
76-76: Consider using a stricter union type.The comment documents the allowed values, but the type is still
string. A union type would provide compile-time safety:- updateChannel?: string // Update channel: 'stable' | 'beta' + updateChannel?: 'stable' | 'beta' // Update channelsrc/renderer/settings/components/AboutUsSettings.vue (1)
48-48: Consider translating Chinese comments to English.The comments on lines 48 and 68 are in Chinese. Per coding guidelines, new code should use English for comments to maintain consistency across the codebase.
🔎 Proposed translation
- <!-- 更新渠道选择 --> + <!-- Update channel selection --> <div class="flex items-center gap-4 mt-4"> - <!-- 操作按钮区域 --> + <!-- Action buttons area --> <div class="flex gap-2 mt-2">Also applies to: 68-68
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
.github/workflows/build.yml.github/workflows/release.ymlCHANGELOG.mddocs/rebrand-guide.mdelectron-builder-macx64.ymlelectron-builder.ymlpackage.jsonscripts/rebrand.jssrc/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.tssrc/renderer/settings/components/AboutUsSettings.vuesrc/renderer/src/i18n/da-DK/about.jsonsrc/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/fa-IR/about.jsonsrc/renderer/src/i18n/fr-FR/about.jsonsrc/renderer/src/i18n/he-IL/about.jsonsrc/renderer/src/i18n/ja-JP/about.jsonsrc/renderer/src/i18n/ko-KR/about.jsonsrc/renderer/src/i18n/pt-BR/about.jsonsrc/renderer/src/i18n/ru-RU/about.jsonsrc/renderer/src/i18n/zh-CN/about.jsonsrc/renderer/src/i18n/zh-HK/about.jsonsrc/renderer/src/i18n/zh-TW/about.json
💤 Files with no reviewable changes (3)
- electron-builder-macx64.yml
- docs/rebrand-guide.md
- scripts/rebrand.js
🧰 Additional context used
📓 Path-based instructions (22)
src/renderer/src/i18n/**/*.json
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/i18n/**/*.json: Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')
Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Files:
src/renderer/src/i18n/da-DK/about.jsonsrc/renderer/src/i18n/fr-FR/about.jsonsrc/renderer/src/i18n/ko-KR/about.jsonsrc/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/he-IL/about.jsonsrc/renderer/src/i18n/pt-BR/about.jsonsrc/renderer/src/i18n/zh-TW/about.jsonsrc/renderer/src/i18n/zh-CN/about.jsonsrc/renderer/src/i18n/fa-IR/about.jsonsrc/renderer/src/i18n/zh-HK/about.jsonsrc/renderer/src/i18n/ru-RU/about.jsonsrc/renderer/src/i18n/ja-JP/about.json
src/**/*
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
New features should be developed in the
srcdirectory
Files:
src/renderer/src/i18n/da-DK/about.jsonsrc/renderer/src/i18n/fr-FR/about.jsonsrc/renderer/src/i18n/ko-KR/about.jsonsrc/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/he-IL/about.jsonsrc/renderer/src/i18n/pt-BR/about.jsonsrc/renderer/settings/components/AboutUsSettings.vuesrc/renderer/src/i18n/zh-TW/about.jsonsrc/renderer/src/i18n/zh-CN/about.jsonsrc/renderer/src/i18n/fa-IR/about.jsonsrc/renderer/src/i18n/zh-HK/about.jsonsrc/renderer/src/i18n/ru-RU/about.jsonsrc/main/presenter/configPresenter/index.tssrc/renderer/src/i18n/ja-JP/about.jsonsrc/main/presenter/upgradePresenter/index.ts
src/renderer/**
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Use lowercase with dashes for directories (e.g., components/auth-wizard)
Files:
src/renderer/src/i18n/da-DK/about.jsonsrc/renderer/src/i18n/fr-FR/about.jsonsrc/renderer/src/i18n/ko-KR/about.jsonsrc/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/he-IL/about.jsonsrc/renderer/src/i18n/pt-BR/about.jsonsrc/renderer/settings/components/AboutUsSettings.vuesrc/renderer/src/i18n/zh-TW/about.jsonsrc/renderer/src/i18n/zh-CN/about.jsonsrc/renderer/src/i18n/fa-IR/about.jsonsrc/renderer/src/i18n/zh-HK/about.jsonsrc/renderer/src/i18n/ru-RU/about.jsonsrc/renderer/src/i18n/ja-JP/about.json
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)
Files:
src/renderer/settings/components/AboutUsSettings.vuesrc/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling
Files:
src/renderer/settings/components/AboutUsSettings.vue
src/renderer/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components
src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'
Files:
src/renderer/settings/components/AboutUsSettings.vue
src/renderer/**/*.{vue,js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Renderer process code should be placed in
src/renderer(Vue 3 application)
Files:
src/renderer/settings/components/AboutUsSettings.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Avoid enums; use const objects instead
Use arrow functions for methods and computed properties
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statementsVue 3 app code in
src/renderer/srcshould be organized intocomponents/,stores/,views/,i18n/,lib/directories with shell UI insrc/renderer/shell/
Files:
src/renderer/settings/components/AboutUsSettings.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation
Files:
src/renderer/settings/components/AboutUsSettings.vue
src/**/*.{ts,tsx,vue,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with single quotes, no semicolons, and 100 character width
Files:
src/renderer/settings/components/AboutUsSettings.vuesrc/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
package.json
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
package.json: Node.js >= 22 required
pnpm >= 9 required
Files:
package.json
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and maintain strict TypeScript type checking for all files
**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/main/presenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Organize core business logic into dedicated Presenter classes, with one presenter per functional domain
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/main/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use EventBus from
src/main/eventbus.tsfor main-to-renderer communication, broadcasting events viamainWindow.webContents.send()
src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
src/main/**/*.ts: Electron main process code belongs insrc/main/with presenters inpresenter/(Window/Tab/Thread/Mcp/Config/LLMProvider) andeventbus.tsfor app events
Use the Presenter pattern in the main process for UI coordination
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/main/presenter/configPresenter/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Store and retrieve custom prompts via
configPresenter.getCustomPrompts()for config-based data source management
Files:
src/main/presenter/configPresenter/index.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Write logs and comments in English
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}
📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)
Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/main/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Main process code for Electron should be placed in
src/main
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use OxLint for linting JavaScript and TypeScript files
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use EventBus for inter-process communication events
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/upgradePresenter/index.ts
🧠 Learnings (12)
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)
Applied to files:
src/renderer/src/i18n/da-DK/about.jsonsrc/renderer/src/i18n/fr-FR/about.jsonsrc/renderer/src/i18n/ko-KR/about.jsonsrc/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/pt-BR/about.jsonsrc/renderer/src/i18n/zh-TW/about.jsonsrc/renderer/src/i18n/zh-CN/about.jsonsrc/renderer/src/i18n/zh-HK/about.jsonsrc/renderer/src/i18n/ru-RU/about.jsonsrc/renderer/src/i18n/ja-JP/about.json
📚 Learning: 2025-11-25T05:26:43.510Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.510Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')
Applied to files:
src/renderer/src/i18n/en-US/about.jsonsrc/renderer/src/i18n/zh-HK/about.json
📚 Learning: 2025-11-25T05:27:26.656Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T05:27:26.656Z
Learning: Applies to src/main/**/*.{js,ts} : Main process code for Electron should be placed in `src/main`
Applied to files:
electron-builder.yml
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to test/**/*.{test,spec}.ts : Test files must be named with `.test.ts` or `.spec.ts` extension
Applied to files:
electron-builder.yml
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations
Applied to files:
electron-builder.yml
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to package.json : pnpm >= 9 required
Applied to files:
electron-builder.ymlpackage.json
📚 Learning: 2025-11-25T05:26:15.929Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-11-25T05:26:15.929Z
Learning: Applies to package.json : Node.js >= 22 required
Applied to files:
electron-builder.ymlpackage.json
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Require Node ≥ 20.19 and pnpm ≥ 10.11 (pnpm only, not npm) as the project toolchain
Applied to files:
package.json
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Use the Presenter pattern in the main process for UI coordination
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/renderer/**/*.ts : Use the `usePresenter.ts` composable for renderer-to-main IPC communication to call presenter methods directly
Applied to files:
src/main/presenter/upgradePresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/**/*.ts : Use EventBus for inter-process communication events
Applied to files:
src/main/presenter/upgradePresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/upgradePresenter/index.ts (4)
src/main/eventbus.ts (1)
eventBus(151-151)src/main/events.ts (1)
UPDATE_EVENTS(78-84)src/renderer/src/events.ts (1)
UPDATE_EVENTS(54-59)test/mocks/electron.ts (1)
shell(25-27)
🪛 actionlint (1.7.9)
.github/workflows/release.yml
414-414: the runner of "softprops/action-gh-release@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 Biome (2.1.2)
src/main/presenter/upgradePresenter/index.ts
[error] 335-336: Catch clause variable type annotation must be 'any' or 'unknown' if specified.
(parse)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (30)
src/main/presenter/upgradePresenter/index.ts (6)
17-25: LGTM!Constants are properly named using
SCREAMING_SNAKE_CASEas per coding guidelines, and theReleaseNoteItemtype provides good type safety for release notes parsing.
36-71: LGTM!Helper functions are well-structured, pure, and handle edge cases appropriately. The
formatReleaseNotesfunction correctly handles various input types (string,ReleaseNoteItem[],null), and the defensiveString(notes)fallback on line 51 ensures robustness against unexpected types.
178-180: LGTM - Good defensive fallback.Ensuring
_versionInfois populated even if it wasn't set during theupdate-availableevent is good defensive coding, preventing potential null reference issues downstream.
300-304: LGTM - Channel configuration is correct.The channel setup correctly configures
allowPrereleasefor beta users and maps the internal channel names to electron-updater's expected values ('beta'vs'latest'). This aligns with electron-updater's channel-based update mechanism.
333-346: LGTM - Good fallback URL handling.The fallback to the main releases page when
_versionInfois unavailable ensures users can always navigate to a download location. Both'github'and'netdisk'types gracefully degrade to the same fallback.
372-416: LGTM - Robust quit-and-install implementation.Good platform-specific handling for macOS vs Windows/Linux, proper flag management, and the 30-second force-quit timeout provides a reasonable safeguard. Error recovery correctly resets state and notifies the renderer.
src/renderer/src/i18n/zh-HK/about.json (1)
10-10: LGTM! Translation key and value updated consistently.The rename from
canaryChanneltobetaChannelaligns with the PR objective to standardize on beta channel terminology. The translation value "内测版" (internal testing version) is appropriate for Traditional Chinese (Hong Kong).Based on learnings, this maintains the consistent key-value structure required across all language translation files.
src/renderer/src/i18n/zh-TW/about.json (1)
10-10: LGTM! Consistent with cross-locale updates.The translation key and value update matches the pattern applied across other locale files in this PR.
Based on learnings, key-value structure consistency is maintained across language files.
CHANGELOG.md (1)
1-18: LGTM! Changelog properly documents the beta release.The v0.5.6-beta.1 entry follows a consistent bilingual format and appropriately documents the changes. The version number aligns with the beta channel migration objective.
src/renderer/src/i18n/zh-CN/about.json (1)
10-10: LGTM! Translation update is consistent.The key rename and translation value are appropriate for Simplified Chinese and consistent with the broader locale updates in this PR.
Based on learnings, this maintains consistent key-value structure across language files.
src/renderer/src/i18n/ru-RU/about.json (1)
10-10: LGTM! Translation key updated consistently.The key rename is consistent with other locales. Using "Beta" (Latin script) is appropriate and commonly used in technical contexts for Russian localization.
Based on learnings, this maintains the required consistent key-value structure across language files.
src/renderer/src/i18n/pt-BR/about.json (1)
18-18: LGTM! Translation update is consistent.The key rename from
canaryChanneltobetaChannelis consistent with the cross-locale migration. Using "Beta" is standard practice in Brazilian Portuguese technical contexts.Based on learnings, consistent key-value structure is maintained across language files.
.github/workflows/build.yml (3)
59-62: LGTM! Two-step build process improves clarity.Separating the build step (
pnpm run build) from the packaging step (electron-builder) provides better control and makes the workflow more explicit. The--publish=neverflag correctly prevents accidental publishing during the build workflow.
115-118: LGTM! Consistent two-step build pattern for Linux.The Linux build follows the same two-step pattern as Windows, providing consistency across platforms.
172-175: LGTM! Consistent two-step build pattern for macOS.The macOS build follows the same two-step pattern, ensuring consistent build processes across all platforms.
electron-builder.yml (1)
98-101: electron-updater is correctly configured to use GitHub releases.The implementation properly:
- Reads release metadata from GitHub releases via
autoUpdaterwith correct owner/repo configuration matching electron-builder.yml- Implements beta/stable channel distinction via
allowPrereleaseandchannelproperties based onUPDATE_CHANNEL_BETAsetting- Maintains platform-specific builds with
${arch}preserved in artifact names across all platforms (Windows, macOS, Linux)package.json (2)
3-3: LGTM - Version bump and simplified macOS build script.The version increment to
0.5.6-beta.1aligns with the beta testing phase, and the simplifiedbuild:mac:x64script using standard--mac --x64flags is consistent with other platform build scripts in this file.Also applies to: 41-41
8-11: Verify Node.js version requirement.Based on learnings, Node.js >= 22 is required, but
engines.nodespecifies>=20.19.0. Please verify if this lower bound is intentional for broader compatibility or should be updated to match the documented requirement.src/main/presenter/configPresenter/index.ts (1)
1477-1484: Normalization logic looks good for channel migration.The implementation correctly handles the migration from the old
canarychannel to the newbetachannel by coercing any non-recognized value to'beta'. This ensures existing canary users are seamlessly transitioned.One consideration: calling
setSettingwithin a getter will trigger theCONFIG_EVENTS.SETTING_CHANGEDevent, which is acceptable for a one-time migration but worth noting..github/workflows/release.yml (3)
376-405: Mac YAML merge logic is well-implemented.The Ruby script correctly merges the x64 and arm64 metadata files, handling edge cases where only one architecture is present. The deduplication by URL ensures clean output.
91-153: Windows build configuration looks good.The Windows build job properly:
- Checks out the resolved SHA for consistency
- Installs dependencies with platform-specific configuration
- Installs the Node runtime
- Builds with
--publish=neverfor manual release control- Uploads artifacts with appropriate exclusions
293-307: Version validation and prerelease detection are robust.The workflow correctly:
- Validates that the tag matches the package.json version
- Detects prerelease versions using the
-(beta|alpha).[0-9]+$pattern- Sets the appropriate
prereleaseoutput for the release creationsrc/renderer/src/i18n/ko-KR/about.json (1)
10-10: LGTM - Channel key renamed to align with beta migration.The key rename from
canaryChanneltobetaChannelis consistent with the broader i18n update across all locales. Based on learnings, maintaining consistent key-value structure across all language files is required, and this change follows that guideline.src/renderer/src/i18n/fa-IR/about.json (1)
18-18: LGTM - Consistent with the beta channel migration.The change maintains structural consistency across all locale files as required by the i18n guidelines.
src/renderer/src/i18n/en-US/about.json (1)
18-18: LGTM - Reference locale updated for beta channel.The English locale serves as the reference, and this key rename ensures consistency across all translations.
src/renderer/src/i18n/fr-FR/about.json (1)
18-18: LGTM - French locale updated consistently.The key rename maintains structural consistency across all language files.
src/renderer/src/i18n/da-DK/about.json (1)
2-2: LGTM - Danish locale updated for beta channel.The change is consistent with the beta migration. Note that this locale file uses alphabetical key ordering, which differs from other locales but is functionally equivalent.
src/renderer/src/i18n/he-IL/about.json (1)
18-18: LGTM! Translation key updated consistently.The change from
canaryChanneltobetaChannelaligns with the UI component update and maintains the expected JSON structure. Using "Beta" in Latin characters is consistent with the pattern observed across other locales.src/renderer/src/i18n/ja-JP/about.json (1)
10-10: LGTM! Translation key updated consistently.The change from
canaryChanneltobetaChannelaligns with the UI component update. The value changed from "テスト版" (Test version) to "Beta" (Latin characters), which maintains consistency with other locale files in this PR.src/renderer/settings/components/AboutUsSettings.vue (1)
60-61: Backend handling of "beta" channel is properly implemented.All verification checks pass:
- Backend validation:
configPresenter.setUpdateChannel()correctly accepts and stores the "beta" channel value. ThegetUpdateChannel()method normalizes stored values to either "stable" or "beta" (defaulting to "beta" for invalid values).- i18n consistency: All 12 locale files (da-DK, en-US, fa-IR, fr-FR, he-IL, ja-JP, ko-KR, pt-BR, ru-RU, zh-CN, zh-HK, zh-TW) have the "betaChannel" key with appropriate translations and maintain consistent key-value structure.
- Migration completion: No remaining references to "canaryChannel" or "canary" found in code or i18n files.
- Proper i18n usage:
AboutUsSettings.vuecorrectly uses i18n keys for both channel options and properly binds to the backend method.
| - name: Install dependencies | ||
| run: pnpm install | ||
|
|
||
| - name: Build Linux | ||
| run: | | ||
| pnpm run build | ||
| pnpm exec electron-builder --linux --${{ matrix.arch }} --publish=never | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| VITE_GITHUB_CLIENT_ID: ${{ secrets.DC_GITHUB_CLIENT_ID }} | ||
| VITE_GITHUB_CLIENT_SECRET: ${{ secrets.DC_GITHUB_CLIENT_SECRET }} | ||
| VITE_GITHUB_REDIRECT_URI: ${{ secrets.DC_GITHUB_REDIRECT_URI }} | ||
| VITE_PROVIDER_DB_URL: ${{ secrets.CDN_PROVIDER_DB_URL }} |
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.
Missing Node Runtime installation step for Linux build.
The Windows (line 132-133) and Mac (line 250-251) builds include an "Install Node Runtime" step, but the Linux build does not. This may cause the Linux build to produce incomplete artifacts.
🔎 Proposed fix
- name: Install dependencies
run: pnpm install
+ - name: Install Node Runtime
+ run: pnpm run installRuntime:linux:${{ matrix.arch }}
+
- name: Build Linux
run: |
pnpm run build🤖 Prompt for AI Agents
.github/workflows/release.yml around lines 189 to 201: the Linux job is missing
the "Install Node Runtime" step present in the Windows and Mac jobs, which can
cause incomplete artifacts; add the same "Install Node Runtime" step used for
Windows/Mac immediately before the "Build Linux" step (i.e., invoke the same
action/commands used there such as the setup/install node runtime step with the
same inputs/versions), then proceed with pnpm run build and electron-builder
as-is so the Linux build uses the correct Node runtime environment.
| - name: Create Draft Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| tag_name: v${{ steps.get_version.outputs.version }} | ||
| tag_name: ${{ needs.resolve-tag.outputs.tag }} | ||
| name: DeepChat V${{ steps.get_version.outputs.version }} | ||
| draft: true | ||
| prerelease: ${{ github.event.inputs.prerelease }} | ||
| prerelease: ${{ steps.get_version.outputs.prerelease == 'true' }} | ||
| files: | | ||
| release_assets/* | ||
| body: | | ||
| # 🚀 DeepChat ${{ steps.get_version.outputs.version }} 正式发布 | 重新定义你的 AI 对话体验! | ||
| —— 不再是简单的 ChatBot,而是你的自然语言 Agent 工具🌟 | ||
| 🔥 为什么选择 DeepChat? | ||
| ✅ **商业友好**:基于原版 [Apache License 2.0](https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE) 开源,无任何协议外的额外约束,面向开源。 | ||
| ✅ **开箱即用**:极简配置,即刻开启你的智能对话之旅。 | ||
| ✅ **极致灵活**:自由切换模型,自定义模型源,满足你多样化的对话和探索需求。 | ||
| ✅ **体验绝佳**:LaTeX 公式渲染、代码高亮、Markdown 支持,模型对话从未如此顺畅。 | ||
| ✅ **持续进化**:我们倾听用户反馈,不断迭代更新,为你带来更卓越的 AI 对话体验。 | ||
| 📥 立即体验未来 | ||
| 💬 反馈有礼:欢迎提交你的宝贵建议,加入 VIP 用户社群,与我们一同塑造 DeepChat 的未来! | ||
| <img width="400px" src="https://github.com/user-attachments/assets/2ebc21e8-3eef-4a11-b3ab-de28e8f9d9c0"/> | ||
| 🎮 加入 Discord 社区:[https://discord.gg/6RBatENX](https://discord.gg/6RBatENX) | ||
| --- | ||
| # 🚀 DeepChat ${{ steps.get_version.outputs.version }} Official Release | Redefine Your AI Conversation Experience! | ||
| —— Not just a simple ChatBot, but your natural language Agent tool 🌟 | ||
| 🔥 Why Choose DeepChat? | ||
| ✅ **Business-Friendly**: Open source under [Apache License 2.0](https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE), with no additional constraints beyond the license, truly open source. | ||
| ✅ **Ready to Use**: Minimal configuration, start your intelligent conversation journey immediately. | ||
| ✅ **Ultra Flexible**: Freely switch models, customize model sources, meet your diverse conversation and exploration needs. | ||
| ✅ **Excellent Experience**: LaTeX formula rendering, code highlighting, Markdown support, model conversations have never been smoother. | ||
| ✅ **Continuous Evolution**: We listen to user feedback, continuously iterate and update, bringing you an even better AI conversation experience. | ||
| 📥 Experience the Future Now | ||
| 💬 Feedback Welcome: We welcome your valuable suggestions, join the user community, and shape the future of DeepChat together! | ||
| <img width="400px" src="https://github.com/user-attachments/assets/2ebc21e8-3eef-4a11-b3ab-de28e8f9d9c0"/> | ||
| 🎮 Join Discord Community: [https://discord.gg/6RBatENX](https://discord.gg/6RBatENX) | ||
| body_path: release_notes.md |
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.
Update softprops/action-gh-release to v2.
Static analysis indicates the runner for @v1 is too old for current GitHub Actions. Update to v2 for compatibility:
🔎 Proposed fix
- name: Create Draft Release
- uses: softprops/action-gh-release@v1
+ uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.resolve-tag.outputs.tag }}📝 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.
| - name: Create Draft Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| tag_name: ${{ needs.resolve-tag.outputs.tag }} | |
| name: DeepChat V${{ steps.get_version.outputs.version }} | |
| draft: true | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| prerelease: ${{ steps.get_version.outputs.prerelease == 'true' }} | |
| files: | | |
| release_assets/* | |
| body: | | |
| # 🚀 DeepChat ${{ steps.get_version.outputs.version }} 正式发布 | 重新定义你的 AI 对话体验! | |
| —— 不再是简单的 ChatBot,而是你的自然语言 Agent 工具🌟 | |
| 🔥 为什么选择 DeepChat? | |
| ✅ **商业友好**:基于原版 [Apache License 2.0](https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE) 开源,无任何协议外的额外约束,面向开源。 | |
| ✅ **开箱即用**:极简配置,即刻开启你的智能对话之旅。 | |
| ✅ **极致灵活**:自由切换模型,自定义模型源,满足你多样化的对话和探索需求。 | |
| ✅ **体验绝佳**:LaTeX 公式渲染、代码高亮、Markdown 支持,模型对话从未如此顺畅。 | |
| ✅ **持续进化**:我们倾听用户反馈,不断迭代更新,为你带来更卓越的 AI 对话体验。 | |
| 📥 立即体验未来 | |
| 💬 反馈有礼:欢迎提交你的宝贵建议,加入 VIP 用户社群,与我们一同塑造 DeepChat 的未来! | |
| <img width="400px" src="https://github.com/user-attachments/assets/2ebc21e8-3eef-4a11-b3ab-de28e8f9d9c0"/> | |
| 🎮 加入 Discord 社区:[https://discord.gg/6RBatENX](https://discord.gg/6RBatENX) | |
| --- | |
| # 🚀 DeepChat ${{ steps.get_version.outputs.version }} Official Release | Redefine Your AI Conversation Experience! | |
| —— Not just a simple ChatBot, but your natural language Agent tool 🌟 | |
| 🔥 Why Choose DeepChat? | |
| ✅ **Business-Friendly**: Open source under [Apache License 2.0](https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE), with no additional constraints beyond the license, truly open source. | |
| ✅ **Ready to Use**: Minimal configuration, start your intelligent conversation journey immediately. | |
| ✅ **Ultra Flexible**: Freely switch models, customize model sources, meet your diverse conversation and exploration needs. | |
| ✅ **Excellent Experience**: LaTeX formula rendering, code highlighting, Markdown support, model conversations have never been smoother. | |
| ✅ **Continuous Evolution**: We listen to user feedback, continuously iterate and update, bringing you an even better AI conversation experience. | |
| 📥 Experience the Future Now | |
| 💬 Feedback Welcome: We welcome your valuable suggestions, join the user community, and shape the future of DeepChat together! | |
| <img width="400px" src="https://github.com/user-attachments/assets/2ebc21e8-3eef-4a11-b3ab-de28e8f9d9c0"/> | |
| 🎮 Join Discord Community: [https://discord.gg/6RBatENX](https://discord.gg/6RBatENX) | |
| body_path: release_notes.md | |
| - name: Create Draft Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.resolve-tag.outputs.tag }} | |
| name: DeepChat V${{ steps.get_version.outputs.version }} | |
| draft: true | |
| prerelease: ${{ steps.get_version.outputs.prerelease == 'true' }} | |
| files: | | |
| release_assets/* | |
| body_path: release_notes.md |
🧰 Tools
🪛 actionlint (1.7.9)
414-414: the runner of "softprops/action-gh-release@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
.github/workflows/release.yml around lines 413 to 422: the workflow is using
softprops/action-gh-release@v1 which is outdated and can cause
runner/compatibility issues; update the action reference to
softprops/action-gh-release@v2 and verify input names/behaviour remain
compatible (tag_name, name, draft, prerelease, files, body_path), then run a
workflow lint or test run to ensure the new major version accepts the same
parameters and the release step executes correctly.
| } catch (error: Error | unknown) { | ||
| this._status = 'error' | ||
| this._error = error instanceof Error ? error.message : String(error) |
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.
Fix invalid catch clause type annotation.
TypeScript only allows any or unknown as catch clause type annotations. The union Error | unknown is syntactically invalid (and semantically equivalent to just unknown).
🔎 Proposed fix
- } catch (error: Error | unknown) {
+ } catch (error: unknown) {📝 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.
| } catch (error: Error | unknown) { | |
| this._status = 'error' | |
| this._error = error instanceof Error ? error.message : String(error) | |
| } catch (error: unknown) { | |
| this._status = 'error' | |
| this._error = error instanceof Error ? error.message : String(error) |
🤖 Prompt for AI Agents
In src/main/presenter/upgradePresenter/index.ts around lines 306 to 308, the
catch clause currently uses an invalid type annotation `Error | unknown`; change
the catch parameter to use a valid annotation (either `unknown` or no
annotation) — e.g. `catch (error: unknown)` — and keep the existing runtime type
guard (`error instanceof Error ? error.message : String(error)`) to extract the
message safely.
* refactor: mac build workflow * feat: support github channels update * fix: action error * fix: action error * fix: gh_token error * fix: gh_token error * fix: release.yml due some pack * fix: realeas.yml workflow failed * chore: 0.5.6-beta.1 for testing * docs: update changelog * docs: update changelog * docs: update changelog * feat(update): switch to GitHub releases auto-update
* feat: support ripgrep file tools * feat: add ripgrep to mention * feat: add support for ripgrep search workspace files * feat(update): switch to GitHub releases auto-update (#1215) * refactor: mac build workflow * feat: support github channels update * fix: action error * fix: action error * fix: gh_token error * fix: gh_token error * fix: release.yml due some pack * fix: realeas.yml workflow failed * chore: 0.5.6-beta.1 for testing * docs: update changelog * docs: update changelog * docs: update changelog * feat(update): switch to GitHub releases auto-update * fix: remove useless params and support windows dir * fix: using logger and safe regex --------- Co-authored-by: yyhhyyyyyy <[email protected]>
close #1202
Summary by CodeRabbit
New Features
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.