()
| 11 | const CONFIG_KEY = 'webuiapps-llm-config'; |
| 12 | |
| 13 | export async function loadConfig(): Promise<LLMConfig | null> { |
| 14 | try { |
| 15 | const persisted = await loadPersistedConfig(); |
| 16 | if (persisted?.llm) { |
| 17 | localStorage.setItem(CONFIG_KEY, JSON.stringify(persisted.llm)); |
| 18 | return persisted.llm; |
| 19 | } |
| 20 | } catch { |
| 21 | // API not available (production / network error) |
| 22 | } |
| 23 | |
| 24 | try { |
| 25 | const raw = localStorage.getItem(CONFIG_KEY); |
| 26 | return raw ? JSON.parse(raw) : null; |
| 27 | } catch { |
| 28 | return null; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | export async function saveConfig( |
| 33 | config: LLMConfig, |
no test coverage detected