Add native chat background and guarded HA YAML access
This commit is contained in:
@@ -72,6 +72,16 @@ if not owner:
|
||||
)
|
||||
owner = admins[0][0]
|
||||
|
||||
# Use Open WebUI's native per-user chat background. Keeping the value in the
|
||||
# user's normal settings means the built-in contrast overlay, mobile layout
|
||||
# and future UI migrations continue to work; custom.css must not replace this
|
||||
# layer.
|
||||
row = con.execute("select settings from user where id=?", (owner,)).fetchone()
|
||||
if not row:
|
||||
raise SystemExit("OpenWebUI model owner does not exist in user table.")
|
||||
user_settings = json.loads(row[0] or "{}")
|
||||
user_settings.setdefault("ui", {})["backgroundImageUrl"] = "/static/midnight-aurora.svg"
|
||||
|
||||
now = int(time.time())
|
||||
filter_ids = [
|
||||
"reasoning_default_off",
|
||||
@@ -226,6 +236,10 @@ def set_config(key, value):
|
||||
)
|
||||
|
||||
with con:
|
||||
con.execute(
|
||||
"update user set settings=? where id=?",
|
||||
(json.dumps(user_settings, ensure_ascii=False), owner),
|
||||
)
|
||||
router_api_key = os.environ.get("OPENWEBUI_ROUTER_API_KEY", "")
|
||||
if router_api_key:
|
||||
set_config("openai.enable", True)
|
||||
|
||||
Reference in New Issue
Block a user