渠道: 启动自动种Step默认渠道(OMO_STEP_API_KEY) + POST /preset/apply

This commit is contained in:
zhiqui
2026-11-15 16:45:29 +08:00
parent 195099a214
commit 6aa3559033
3 changed files with 27 additions and 0 deletions
+9
View File
@@ -38,6 +38,15 @@ async def startup():
password_hash=security.hash_password(settings.first_admin_pass),
kdf_salt=salt.hex(), is_admin=True))
await db.commit()
# 默认渠道:空库时种 Step Plan 预设(key 走 OMO_STEP_API_KEY)
from .models.entities import Channel
from .core.config import STEP_PRESET
chans = (await db.execute(__import__('sqlalchemy').select(Channel))).scalars().all()
if not chans:
db.add(Channel(name=STEP_PRESET["name"], base_url=STEP_PRESET["base_url"],
api_key_enc=settings.step_api_key, models=STEP_PRESET["models"],
owner_id=None, visibility="admin"))
await db.commit()
@app.exception_handler(Exception)