Changeset 0.37.14 (#226)
Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
@@ -18,31 +18,38 @@ export default function SettingsSection() {
|
||||
sw.api.admin.models.list().catch(() => []),
|
||||
sw.api.admin.vault.status().catch(() => null),
|
||||
]);
|
||||
const settings = s || {};
|
||||
const raw = s || {};
|
||||
const pol = raw.policies || {};
|
||||
const cfg_ = raw.settings || {};
|
||||
setCfg({
|
||||
allow_registration: settings.policies?.allow_registration === 'true',
|
||||
registration_default_state: settings.registration_default_state || 'pending',
|
||||
system_prompt: settings.system_prompt || '',
|
||||
default_model: settings.default_model || '',
|
||||
allow_user_byok: settings.policies?.allow_user_byok === 'true',
|
||||
allow_user_personas: settings.policies?.allow_user_personas === 'true',
|
||||
allow_kb_direct_access: settings.policies?.allow_kb_direct_access === 'true',
|
||||
banner_enabled: !!settings.banner?.enabled,
|
||||
banner_text: settings.banner?.text || '',
|
||||
banner_bg: settings.banner?.bg || '#007a33',
|
||||
banner_fg: settings.banner?.fg || '#ffffff',
|
||||
banner_position: settings.banner?.position || 'both',
|
||||
search_provider: settings.search_provider || 'duckduckgo',
|
||||
search_endpoint: settings.search_endpoint || '',
|
||||
search_api_key: settings.search_api_key || '',
|
||||
search_max_results: settings.search_max_results || 5,
|
||||
compaction_enabled: !!settings.auto_compaction_enabled,
|
||||
compaction_threshold: settings.compaction_threshold || 70,
|
||||
compaction_cooldown: settings.compaction_cooldown || 30,
|
||||
memory_extraction_enabled: !!settings.memory_extraction_enabled,
|
||||
memory_auto_approve: !!settings.memory_auto_approve,
|
||||
allow_registration: pol.allow_registration === 'true',
|
||||
registration_default_state: cfg_.registration_default_state || 'pending',
|
||||
system_prompt: cfg_.system_prompt || '',
|
||||
default_model: pol.default_model || '',
|
||||
allow_user_byok: pol.allow_user_byok === 'true',
|
||||
allow_user_personas: pol.allow_user_personas === 'true',
|
||||
allow_kb_direct_access: pol.allow_kb_direct_access === 'true' || pol.kb_direct_access === 'true',
|
||||
banner_enabled: !!cfg_.banner?.enabled,
|
||||
banner_text: cfg_.banner?.text || '',
|
||||
banner_bg: cfg_.banner?.bg || '#007a33',
|
||||
banner_fg: cfg_.banner?.fg || '#ffffff',
|
||||
banner_position: cfg_.banner?.position || 'both',
|
||||
message_enabled: !!cfg_.message?.enabled,
|
||||
message_text: cfg_.message?.text || '',
|
||||
message_variant: cfg_.message?.variant || 'info',
|
||||
footer_enabled: !!cfg_.footer?.enabled,
|
||||
footer_text: cfg_.footer?.text || '',
|
||||
search_provider: cfg_.search_provider || 'duckduckgo',
|
||||
search_endpoint: cfg_.search_endpoint || '',
|
||||
search_api_key: cfg_.search_api_key || '',
|
||||
search_max_results: cfg_.search_max_results || 5,
|
||||
compaction_enabled: !!cfg_.auto_compaction_enabled,
|
||||
compaction_threshold: cfg_.compaction_threshold || 70,
|
||||
compaction_cooldown: cfg_.compaction_cooldown || 30,
|
||||
memory_extraction_enabled: !!cfg_.memory_extraction_enabled,
|
||||
memory_auto_approve: !!cfg_.memory_auto_approve,
|
||||
});
|
||||
setModels(Array.isArray(m) ? m : m.models || m.data || []);
|
||||
setModels(m || []);
|
||||
setVault(v);
|
||||
} catch (e) { sw.toast(e.message, 'error'); }
|
||||
finally { setLoading(false); }
|
||||
@@ -75,6 +82,19 @@ export default function SettingsSection() {
|
||||
position: cfg.banner_position,
|
||||
}});
|
||||
|
||||
// Message bar
|
||||
await sw.api.admin.settings.update('message', { value: {
|
||||
enabled: cfg.message_enabled,
|
||||
text: cfg.message_text,
|
||||
variant: cfg.message_variant,
|
||||
}});
|
||||
|
||||
// Footer
|
||||
await sw.api.admin.settings.update('footer', { value: {
|
||||
enabled: cfg.footer_enabled,
|
||||
text: cfg.footer_text,
|
||||
}});
|
||||
|
||||
// Search
|
||||
await sw.api.admin.settings.update('search_provider', { value: cfg.search_provider });
|
||||
if (cfg.search_provider === 'searxng') {
|
||||
@@ -154,6 +174,32 @@ export default function SettingsSection() {
|
||||
`}
|
||||
</div>
|
||||
|
||||
<div class="settings-section"><h3>Message Bar</h3>
|
||||
<label class="toggle-label"><input type="checkbox" checked=${cfg.message_enabled} onChange=${e => set('message_enabled', e.target.checked)} /><span class="toggle-track"></span><span>Show dismissible message bar</span></label>
|
||||
${cfg.message_enabled && html`
|
||||
<div style="margin-top:8px;">
|
||||
<div class="form-group"><label>Text</label><input value=${cfg.message_text} onInput=${e => set('message_text', e.target.value)} placeholder="System maintenance scheduled..." /></div>
|
||||
<div class="form-group"><label>Variant</label>
|
||||
<select value=${cfg.message_variant} onChange=${e => set('message_variant', e.target.value)}>
|
||||
<option value="info">Info</option>
|
||||
<option value="warn">Warning</option>
|
||||
<option value="error">Error</option>
|
||||
<option value="success">Success</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
|
||||
<div class="settings-section"><h3>Footer</h3>
|
||||
<label class="toggle-label"><input type="checkbox" checked=${cfg.footer_enabled} onChange=${e => set('footer_enabled', e.target.checked)} /><span class="toggle-track"></span><span>Show footer bar</span></label>
|
||||
${cfg.footer_enabled && html`
|
||||
<div style="margin-top:8px;">
|
||||
<div class="form-group"><label>Text</label><input value=${cfg.footer_text} onInput=${e => set('footer_text', e.target.value)} placeholder="Powered by Chat Switchboard" /></div>
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
|
||||
<div class="settings-section"><h3>Web Search</h3>
|
||||
<div class="form-group"><label>Provider</label>
|
||||
<select value=${cfg.search_provider} onChange=${e => set('search_provider', e.target.value)}>
|
||||
|
||||
Reference in New Issue
Block a user