-
Notifications
You must be signed in to change notification settings - Fork 625
feat: support canary upgrade #840
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
Changes from all commits
8261aa4
fc2fd71
594d85d
3d70c38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ interface IAppSettings { | |
| floatingButtonEnabled?: boolean // 悬浮按钮是否启用 | ||
| default_system_prompt?: string // 默认系统提示词 | ||
| webContentLengthLimit?: number // 网页内容截断长度限制,默认3000字符 | ||
| updateChannel?: string // 更新渠道:'stable' | 'canary' | ||
| [key: string]: unknown // 允许任意键,使用unknown类型替代any | ||
| } | ||
|
|
||
|
|
@@ -122,6 +123,7 @@ export class ConfigPresenter implements IConfigPresenter { | |
| floatingButtonEnabled: false, | ||
| default_system_prompt: '', | ||
| webContentLengthLimit: 3000, | ||
| updateChannel: 'stable', // 默认使用正式版 | ||
| appVersion: this.currentAppVersion | ||
| } | ||
| }) | ||
|
|
@@ -1192,6 +1194,16 @@ export class ConfigPresenter implements IConfigPresenter { | |
| this.setSetting('default_system_prompt', '') | ||
| } | ||
|
|
||
| // 获取更新渠道 | ||
| getUpdateChannel(): string { | ||
| return this.getSetting<string>('updateChannel') || 'stable' | ||
| } | ||
|
|
||
| // 设置更新渠道 | ||
| setUpdateChannel(channel: string): void { | ||
| this.setSetting('updateChannel', channel) | ||
| } | ||
|
Comment on lines
+1197
to
+1205
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainValidate and broadcast update-channel changes; return a typed value
- // 获取更新渠道
- getUpdateChannel(): string {
- return this.getSetting<string>('updateChannel') || 'stable'
- }
+ // Get update channel
+ getUpdateChannel(): UpdateChannel {
+ const val = this.getSetting<UpdateChannel>('updateChannel')
+ return val === 'canary' ? 'canary' : 'stable'
+ }
- // 设置更新渠道
- setUpdateChannel(channel: string): void {
- this.setSetting('updateChannel', channel)
- }
+ // Set update channel
+ setUpdateChannel(channel: UpdateChannel): void {
+ const prev = this.getUpdateChannel()
+ const next: UpdateChannel = channel === 'canary' ? 'canary' : 'stable'
+ if (prev === next) return
+ this.setSetting('updateChannel', next)
+ // Notify all windows so UI/logic can react
+ eventBus.send(CONFIG_EVENTS.UPDATE_CHANNEL_CHANGED, SendTarget.ALL_WINDOWS, next)
+ console.info(
+ '[Config]',
+ JSON.stringify({
+ level: 'INFO',
+ event: 'UPDATE_CHANNEL_CHANGED',
+ prev,
+ next,
+ at: new Date().toISOString()
+ })
+ )
+ }Follow-ups:
You can verify repo-wide typing and usages with: I can open a small PR to add the event constant and d.ts updates if you want. 🏁 Script executed: #!/bin/bash
# Verify typing and usages for update-channel API
rg -n -C2 --type=ts "type\s+UpdateChannel\s*=\s*'stable'\s*\|\s*'canary'"
rg -n -C2 --type=ts "getUpdateChannel\s*\("
rg -n -C2 --type=ts "setUpdateChannel\s*\("
rg -n -C2 --type=ts "'UPDATE_CHANNEL_CHANGED'|UPDATE_CHANNEL_CHANGED"Length of output: 2087 I’m running additional checks to confirm the presence of the 🏁 Script executed: #!/bin/bash
# Search for UpdateChannel type alias
rg -n -C2 --type=ts "type\s+UpdateChannel"
# Search for any UpdateChannel mentions
rg -n -C2 --type=ts "UpdateChannel"
# Search for eventBus usage
rg -n -C2 --type=ts "eventBus"
# Search for CONFIG_EVENTS usage
rg -n -C2 --type=ts "CONFIG_EVENTS"
# Search for SendTarget usage
rg -n -C2 --type=ts "SendTarget"
# Search for eventBus import statements
rg -n -C2 --type=ts "import.*eventBus"Length of output: 234042 Define
🤖 Prompt for AI Agents |
||
|
|
||
| // 获取默认快捷键 | ||
| getDefaultShortcutKey(): ShortcutKeySetting { | ||
| return { | ||
|
|
||
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.
💡 Verification agent
🧩 Analysis chain
Verify consistency across localized READMEs and avoid fragile attributes.
Ensure the same fixes (no inline styles, no
targeton<img>,reladded on<a>) are applied in README.zh.md and README.jp.md and in any other leaderboard block.Run:
🏁 Script executed:
Length of output: 3793
Fix leaderboard blocks in all localized READMEs
styleattributestarget="_blank"from the<img>tagrel="noopener noreferrer"to the<a>tagApplies to the leaderboard snippet in:
🤖 Prompt for AI Agents