Skip to content

feat: 对macos支持浅色和深色模式切换模型功能 - #1006

Open
2287560043 wants to merge 1 commit into
ayangweb:masterfrom
2287560043:feat/theme-switch
Open

2287560043 wants to merge 1 commit into
ayangweb:masterfrom
2287560043:feat/theme-switch

Conversation

@2287560043

Copy link
Copy Markdown
19b16cf7-5d4c-4062-8679-c9bce5064af5

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

该 PR 为 macOS 的浅色/深色模式切换引入“自动切换桌宠模型”的能力:允许用户分别为浅色与深色模式指定模型,并在系统主题变化且应用主题设置为 auto 时自动切换主窗口桌宠模型。

Changes:

  • model store 中新增 lightModelId / darkModelId 用于记录浅色/深色模式对应的模型选择,并在模型列表变更时做有效性清理
  • 偏好设置-模型页新增浅色/深色模型设置入口(含多语言 tooltip)
  • 将主题监听/主题应用逻辑从偏好设置的 theme-mode 组件迁移至 App.vue 统一处理,并在自动主题下驱动模型切换

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/stores/model.ts 新增浅色/深色模式对应模型 ID,并在初始化时校验有效性
src/pages/preference/components/model/index.vue UI 增加浅色/深色模型快捷设置(sun/moon)并在删除模型时清理引用
src/pages/preference/components/general/components/theme-mode/index.vue 移除窗口主题监听与 DOM class 切换逻辑,改由 App 统一处理
src/locales/zh-TW.json 新增浅色/深色模型 tooltip 文案
src/locales/zh-CN.json 新增浅色/深色模型 tooltip 文案
src/locales/vi-VN.json 新增浅色/深色模型 tooltip 文案
src/locales/pt-BR.json 新增浅色/深色模型 tooltip 文案
src/locales/en-US.json 新增浅色/深色模型 tooltip 文案
src/App.vue 统一主题应用/监听逻辑,并在 auto 主题下按浅/深色配置自动切换模型
src-tauri/src/core/setup/mod.rs 移除 debug 下默认打开 devtools 的行为
Suppressed comments (1)

src/pages/preference/components/model/index.vue:130

  • These new theme-model icons are clickable but not keyboard-accessible. Consider adding role="button", tabindex, and Enter/Space key handlers so the action can be triggered without a mouse.
            <i
              :aria-label="$t('pages.preference.model.tooltips.darkModel')"
              class="i-lucide:moon"
              :class="{ 'text-blue-5': data.id === modelStore.darkModelId }"
              @click.stop="handleThemeModel(data, 'dark')"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/App.vue
Comment on lines +88 to +92
watch(() => generalStore.appearance.theme, (value) => {
if (!themeReady.value) return

applyTheme(value)
})
Comment on lines +117 to +122
<i
:aria-label="$t('pages.preference.model.tooltips.lightModel')"
class="i-lucide:sun"
:class="{ 'text-orange-5': data.id === modelStore.lightModelId }"
@click.stop="handleThemeModel(data, 'light')"
/>
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