feat: fix template preview links, default chat action, update default templates

- Fix sanitizePreview regex to match literal quotes instead of " entities
- Default telegram chat_action to "typing" in model and frontend
- Change "photo(s)" to "file(s)" in default templates (EN/RU)
- Remove redundant album URL line from assets_added templates
- Auto-refresh system-owned templates from files on server startup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 01:37:58 +03:00
parent 1d445f3980
commit 371ea70756
8 changed files with 37 additions and 29 deletions
@@ -78,7 +78,7 @@ async def health():
async def _seed_default_templates():
"""Seed default templates on first startup if none exist."""
"""Seed or update default (system-owned) templates on startup."""
from sqlmodel import func, select
from sqlmodel.ext.asyncio.session import AsyncSession
from .database.engine import get_engine
@@ -89,22 +89,36 @@ async def _seed_default_templates():
async with AsyncSession(engine) as session:
result = await session.exec(select(func.count()).select_from(TemplateConfig))
count = result.one()
if count > 0:
return
for locale in ("en", "ru"):
slots = load_default_templates(locale)
if not slots:
continue
name = f"Default ({locale.upper()})"
config = TemplateConfig(
user_id=0,
provider_type="immich",
name=name,
description=f"Default Immich templates ({locale.upper()})",
**slots,
if count == 0:
# First startup — seed all defaults
for locale in ("en", "ru"):
slots = load_default_templates(locale)
if not slots:
continue
name = f"Default ({locale.upper()})"
config = TemplateConfig(
user_id=0,
provider_type="immich",
name=name,
description=f"Default Immich templates ({locale.upper()})",
**slots,
)
session.add(config)
else:
# Update existing system-owned templates from files
result = await session.exec(
select(TemplateConfig).where(TemplateConfig.user_id == 0)
)
session.add(config)
system_configs = result.all()
for config in system_configs:
locale = "ru" if "(RU)" in config.name else "en"
slots = load_default_templates(locale)
if not slots:
continue
for key, value in slots.items():
setattr(config, key, value)
session.add(config)
await session.commit()