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
+2
View File
@@ -38,3 +38,5 @@ export enum ThemeMode {
export type LanguageVarious = 'zh-CN' | 'zh-TW' | 'el-GR' | 'en-US' | 'es-ES' | 'fr-FR' | 'ja-JP' | 'pt-PT' | 'ru-RU'
export type WindowStyle = 'transparent' | 'opaque'
export type SendMessageShortcut = 'Enter' | 'Shift+Enter' | 'Ctrl+Enter' | 'Command+Enter' | 'Alt+Enter'
+6 -5
View File
@@ -1,6 +1,6 @@
/**
* Auto-generated preferences configuration
* Generated at: 2025-09-02T02:45:09.198Z
* Generated at: 2025-09-02T04:48:55.916Z
*
* This file is automatically generated from classification.json
* To update this file, modify classification.json and run:
@@ -14,6 +14,7 @@ import type {
SelectionActionItem,
SelectionFilterMode,
SelectionTriggerMode,
SendMessageShortcut,
WindowStyle
} from '@shared/data/preferenceTypes'
import { LanguageVarious, ThemeMode } from '@shared/data/preferenceTypes'
@@ -116,7 +117,7 @@ export interface PreferencesType {
// redux/settings/enableQuickPanelTriggers
'chat.input.quick_panel.triggers_enabled': boolean
// redux/settings/sendMessageShortcut
'chat.input.send_message_shortcut': string
'chat.input.send_message_shortcut': SendMessageShortcut
// redux/settings/showInputEstimatedTokens
'chat.input.show_estimated_tokens': boolean
// redux/settings/autoTranslateWithSpace
@@ -143,8 +144,6 @@ export interface PreferencesType {
'chat.message.show_divider': boolean
// redux/settings/showPrompt
'chat.message.show_prompt': boolean
// redux/settings/showTokens
'chat.message.show_tokens': boolean
// redux/settings/messageStyle
'chat.message.style': string
// redux/settings/thoughtAutoCollapse
@@ -321,6 +320,8 @@ export interface PreferencesType {
'feature.selection.trigger_mode': SelectionTriggerMode
// redux/settings/translateModelPrompt
'feature.translate.model_prompt': string
// redux/settings/targetLanguage
'feature.translate.target_language': string
// redux/shortcuts/shortcuts.exit_fullscreen
'shortcut.app.exit_fullscreen': Record<string, unknown>
// redux/shortcuts/shortcuts.search_message
@@ -436,7 +437,6 @@ export const DefaultPreferences: PreferencesType = {
'chat.message.navigation_mode': 'none',
'chat.message.show_divider': true,
'chat.message.show_prompt': true,
'chat.message.show_tokens': true,
'chat.message.style': 'plain',
'chat.message.thought.auto_collapse': true,
'chat.narrow_mode': false,
@@ -552,6 +552,7 @@ export const DefaultPreferences: PreferencesType = {
'feature.selection.remember_win_size': false,
'feature.selection.trigger_mode': 'selected',
'feature.translate.model_prompt': TRANSLATE_PROMPT,
'feature.translate.target_language': 'en-us',
'shortcut.app.exit_fullscreen': { editable: false, enabled: true, key: ['Escape'], system: true },
'shortcut.app.search_message': {
editable: true,