| const SETTINGS_KEY = "oapix.chatclient.settings"; | |
| export function loadSettings({ | |
| endpointInput, | |
| modelInput, | |
| systemPromptInput, | |
| audioOutputInput, | |
| voiceInput | |
| }) { | |
| endpointInput.value = `${window.location.origin}/v1/chat/completions`; | |
| try { | |
| const saved = JSON.parse(window.localStorage.getItem(SETTINGS_KEY) || "{}"); | |
| endpointInput.value = saved.endpoint || endpointInput.value; | |
| modelInput.value = saved.model || modelInput.value; | |
| systemPromptInput.value = saved.systemPrompt || ""; | |
| audioOutputInput.checked = saved.audioOutput ?? true; | |
| voiceInput.value = saved.voice || voiceInput.value; | |
| } catch (_error) { | |
| window.localStorage.removeItem(SETTINGS_KEY); | |
| } | |
| } | |
| export function saveSettings({ | |
| endpointInput, | |
| modelInput, | |
| systemPromptInput, | |
| audioOutputInput, | |
| voiceInput | |
| }) { | |
| window.localStorage.setItem(SETTINGS_KEY, JSON.stringify({ | |
| endpoint: endpointInput.value.trim(), | |
| model: modelInput.value.trim(), | |
| systemPrompt: systemPromptInput.value, | |
| audioOutput: audioOutputInput.checked, | |
| voice: voiceInput.value | |
| })); | |
| } | |