refactor: enhance preference management and update mappings

- Updated preferences to utilize the new SendMessageShortcut type for better type safety.
- Refactored components to use the usePreference hook instead of useSettings for improved preference handling.
- Added new preferences for target language and send message shortcut in various components.
- Cleaned up unused code and comments related to settings for better maintainability.
- Updated auto-generated preference mappings to reflect recent changes in preference structure.
This commit is contained in:
fullex
2025-09-02 13:24:41 +08:00
parent 5cc7390bb6
commit 0a67ab4103
16 changed files with 184 additions and 139 deletions
@@ -1,6 +1,6 @@
/**
* Auto-generated preference mappings from classification.json
* Generated at: 2025-09-01T14:38:08.063Z
* Generated at: 2025-09-02T05:21:08.374Z
*
* This file contains pure mapping relationships without default values.
* Default values are managed in packages/shared/data/preferences.ts
@@ -14,10 +14,6 @@
* ElectronStore没有嵌套,originalKey直接对应configManager.get(key)
*/
export const ELECTRON_STORE_MAPPINGS = [
{
originalKey: 'Language',
targetKey: 'app.language'
},
{
originalKey: 'ZoomFactor',
targetKey: 'app.zoom_factor'
@@ -58,6 +54,10 @@ export const REDUX_STORE_MAPPINGS = {
originalKey: 'enableQuickAssistant',
targetKey: 'feature.quick_assistant.enabled'
},
{
originalKey: 'language',
targetKey: 'app.language'
},
{
originalKey: 'launchToTray',
targetKey: 'app.tray.on_launch'
@@ -86,6 +86,10 @@ export const REDUX_STORE_MAPPINGS = {
originalKey: 'sendMessageShortcut',
targetKey: 'chat.input.send_message_shortcut'
},
{
originalKey: 'targetLanguage',
targetKey: 'feature.translate.target_language'
},
{
originalKey: 'proxyMode',
targetKey: 'app.proxy.mode'
@@ -110,10 +114,6 @@ export const REDUX_STORE_MAPPINGS = {
originalKey: 'showPrompt',
targetKey: 'chat.message.show_prompt'
},
{
originalKey: 'showTokens',
targetKey: 'chat.message.show_tokens'
},
{
originalKey: 'showMessageDivider',
targetKey: 'chat.message.show_divider'
@@ -180,7 +180,7 @@ export const REDUX_STORE_MAPPINGS = {
},
{
originalKey: 'codeEditor.enabled',
targetKey: 'chat.code.editor.highlight_active_line'
targetKey: 'chat.code.editor.enabled'
},
{
originalKey: 'codeEditor.themeLight',
@@ -190,6 +190,10 @@ export const REDUX_STORE_MAPPINGS = {
originalKey: 'codeEditor.themeDark',
targetKey: 'chat.code.editor.theme_dark'
},
{
originalKey: 'codeEditor.highlightActiveLine',
targetKey: 'chat.code.editor.highlight_active_line'
},
{
originalKey: 'codeEditor.foldGutter',
targetKey: 'chat.code.editor.fold_gutter'
@@ -298,6 +302,10 @@ export const REDUX_STORE_MAPPINGS = {
originalKey: 'webdavDisableStream',
targetKey: 'data.backup.webdav.disable_stream'
},
{
originalKey: 'translateModelPrompt',
targetKey: 'feature.translate.model_prompt'
},
{
originalKey: 'autoTranslateWithSpace',
targetKey: 'chat.input.translate.auto_translate_with_space'
@@ -723,10 +731,10 @@ export const REDUX_STORE_MAPPINGS = {
/**
* 映射统计:
* - ElectronStore项: 2
* - Redux Store项: 169
* - ElectronStore项: 1
* - Redux Store项: 172
* - Redux分类: settings, selectionStore, nutstore, shortcuts
* - 总配置项: 171
* - 总配置项: 173
*
* 使用说明:
* 1. ElectronStore读取: configManager.get(mapping.originalKey)