UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

38 lines • 1.25 kB
export const DEFAULT_SPEECH_LANG = 'en-US'; export const SPEECH_LANGUAGES = [ { tag: 'en-US', label: 'English (US)' }, { tag: 'en-GB', label: 'English (UK)' }, { tag: 'pt-BR', label: 'Portuguese (Brazil)' }, { tag: 'es-ES', label: 'Spanish (Spain)' }, ]; const STORAGE_KEY = 'nestjs-agent-chat-speech-lang'; /** * Recover the last picked language from localStorage (sync — safe at * `useState` init). Falls back to the default if nothing's stored or the * stored tag isn't in the offered list. */ export function loadStoredSpeechLang() { if (typeof window === 'undefined') return DEFAULT_SPEECH_LANG; try { const raw = window.localStorage.getItem(STORAGE_KEY); if (raw && SPEECH_LANGUAGES.some((language) => language.tag === raw)) { return raw; } } catch { /* localStorage disabled (private window / webview) — use the default */ } return DEFAULT_SPEECH_LANG; } export function persistSpeechLang(tag) { if (typeof window === 'undefined') return; try { window.localStorage.setItem(STORAGE_KEY, tag); } catch { /* same fallback — silently skip persistence */ } } //# sourceMappingURL=speech-languages.js.map