feat: make bot name configurable

This commit is contained in:
TaraTheStar
2026-04-06 05:10:59 +00:00
parent e1c2e7e3d6
commit e8a8fceb26
9 changed files with 47 additions and 10 deletions

View File

@@ -680,6 +680,7 @@ _SETTINGS_DEFAULTS = {
'sync_to_insights': False, # mirror WebUI token usage to state.db for /insights
'check_for_updates': True, # check if webui/agent repos are behind upstream
'theme': 'dark', # active UI theme name (no enum gate -- allows custom themes)
'bot_name': os.getenv('HERMES_WEBUI_BOT_NAME', 'Hermes'), # display name for the assistant
'password_hash': None, # SHA-256 hash; None = auth disabled
}

View File

@@ -116,7 +116,13 @@ def handle_get(handler, parsed) -> bool:
content_type='text/html; charset=utf-8')
if parsed.path == '/login':
return t(handler, _LOGIN_PAGE_HTML, content_type='text/html; charset=utf-8')
import html as _html
_bot = _html.escape(load_settings().get('bot_name', 'Hermes'))
_page = _LOGIN_PAGE_HTML.replace(
'<title>Hermes — Sign in</title>',
f'<title>{_bot} — Sign in</title>',
).replace('<h1>Hermes</h1>', f'<h1>{_bot}</h1>')
return t(handler, _page, content_type='text/html; charset=utf-8')
if parsed.path == '/api/auth/status':
from api.auth import is_auth_enabled, parse_cookie, verify_session