mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
- Move MemoryPanel from bottom of left column to top of right column
(above chat messages, with a clean border-bottom separator)
- Move hint text ('按住 Space 或按钮说话 · 音色') from left column
to a compact bar on the right column between chat and voice button;
hidden on mobile to save space
- Remove 切换间隔 slider from left column; add it to Settings page
under 🤖 机器人身份 section with proper slider+value layout
- Add switchIntervalMs:10000 to DEFAULT_SETTINGS in settingsStore so
the value persists across sessions; App.jsx reads it on mount
- Left column is now much leaner: face + interaction buttons + micro
expression grid + auto-rotate toggle only
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import { DEFAULT_VOICE } from '../data/voices';
|
|
|
|
const KEY = 'jbot_settings';
|
|
|
|
export const DEFAULT_SETTINGS = {
|
|
robotName: 'JBOT',
|
|
robotPersonality: '你是一个友好、简洁、偶尔幽默的AI机器人助手。回复控制在80字以内。',
|
|
language: 'auto', // 'auto' | 'zh-CN' | 'en-US'
|
|
voiceId: DEFAULT_VOICE,
|
|
customVoiceId: '', // overrides voiceId if non-empty
|
|
responseMaxWords: 80,
|
|
switchIntervalMs: 10000, // micro-expression auto-rotate interval
|
|
};
|
|
|
|
export function getSettings() {
|
|
try {
|
|
const saved = JSON.parse(localStorage.getItem(KEY) || '{}');
|
|
return { ...DEFAULT_SETTINGS, ...saved };
|
|
} catch {
|
|
return { ...DEFAULT_SETTINGS };
|
|
}
|
|
}
|
|
|
|
export function saveSettings(patch) {
|
|
const current = getSettings();
|
|
const updated = { ...current, ...patch };
|
|
localStorage.setItem(KEY, JSON.stringify(updated));
|
|
return updated;
|
|
}
|
|
|
|
export function resetSettings() {
|
|
localStorage.removeItem(KEY);
|
|
return { ...DEFAULT_SETTINGS };
|
|
}
|
|
|
|
// Returns the effective voice ID (custom takes priority)
|
|
export function getEffectiveVoice(settings = null) {
|
|
const s = settings || getSettings();
|
|
return s.customVoiceId?.trim() || s.voiceId || DEFAULT_VOICE;
|
|
}
|