mirror of
https://github.com/wahyd4/links.git
synced 2026-08-08 21:04:53 +10:00
- Add jbot Django app (jbot/__init__.py, apps.py, urls.py, api_urls.py) - Python backend (jbot/views.py): TTS 2.0, ASR 1.0 BigASR, LLM/memory via OpenRouter - React SPA frontend at /jbot/ (static_src/jbot/): RobotFace, ChatPanel, expressions, voices, push-to-talk, history, memory, settings pages - Vite entry jbot: static_src/jbot/main.jsx → dist/jbot.js + dist/jbot.css - react-router-dom added; BrowserRouter basename=/jbot for SPA routing - core/settings.py: added jbot to INSTALLED_APPS - core/urls.py: /jbot/ + /api/jbot/ URL includes - pyproject.toml: websocket-client>=1.9.0 for BigASR binary WS protocol - Dockerfile: ffmpeg added to production apt-get for WebM→PCM audio conversion - k8s/manifest.yaml: VOLC_APP_ID, VOLC_ACCESS_TOKEN, OPENROUTER_API_KEY env vars via jbot-credentials Secret; LLM_MODEL, VOLC_TTS_VOICE, VOLC_ASR_RESOURCE defaults Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 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,
|
|
};
|
|
|
|
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;
|
|
}
|