UI bug pass: fix settings crash and rename dead heading
- Rename "Chat Defaults" heading to "Defaults" in settings general - Guard sw.api.models.enabled() call (crashes when no providers are configured since models API returns undefined) - Verified: admin, settings, login surfaces render correctly in both light and dark themes at desktop viewport Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* GeneralSection — chat defaults: model, system prompt, max tokens, temperature, thinking
|
||||
* GeneralSection — user preferences (model, system prompt, max tokens, temperature)
|
||||
*/
|
||||
const { html } = window;
|
||||
const { useState, useEffect, useCallback, useRef } = hooks;
|
||||
@@ -15,10 +15,8 @@ export function GeneralSection() {
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const [s, m] = await Promise.all([
|
||||
sw.api.profile.settings(),
|
||||
sw.api.models.enabled(),
|
||||
]);
|
||||
const s = await sw.api.profile.settings();
|
||||
const m = sw.api.models?.enabled ? await sw.api.models.enabled() : null;
|
||||
const sObj = s || {};
|
||||
setSettings({
|
||||
model: sObj.model || '',
|
||||
@@ -27,7 +25,7 @@ export function GeneralSection() {
|
||||
temperature: sObj.temperature ?? 0.7,
|
||||
show_thinking: sObj.show_thinking || false,
|
||||
});
|
||||
const modelList = (m.data || []).filter(x => !x.hidden);
|
||||
const modelList = (m?.data || []).filter(x => !x.hidden);
|
||||
setModels(modelList);
|
||||
|
||||
// Set initial max hint
|
||||
@@ -74,7 +72,7 @@ export function GeneralSection() {
|
||||
|
||||
return html`
|
||||
<div class="settings-section">
|
||||
<h3>Chat Defaults</h3>
|
||||
<h3>Defaults</h3>
|
||||
<div class="form-group">
|
||||
<label>Default Model</label>
|
||||
<select value=${settings.model} onChange=${onModelChange}>
|
||||
|
||||
Reference in New Issue
Block a user