渠道: 启动自动种Step默认渠道(OMO_STEP_API_KEY) + POST /preset/apply
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user