fix(saas): 新用户 llm_routing 默认改为 relay 使 SaaS token pool 成为主路径
Some checks failed
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled

- handlers.rs: SQL INSERT 和 LoginResponse 中 'local' → 'relay'
- 新增 migration: ALTER llm_routing SET DEFAULT 'relay'
- 符合管家式服务理念:用户无需配置 API Key,SaaS 自动中转
This commit is contained in:
iven
2026-04-11 02:05:27 +08:00
parent 4dd9ca01fe
commit 25a4d4e9d5
2 changed files with 5 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
-- 20260411000001_accounts_llm_routing_default_relay.sql
-- 新用户默认走 SaaS relay (Token Pool), 符合管家式服务理念
ALTER TABLE accounts ALTER COLUMN llm_routing SET DEFAULT 'relay';

View File

@@ -120,7 +120,7 @@ pub async fn register(
sqlx::query(
"INSERT INTO accounts (id, username, email, password_hash, display_name, role, status, created_at, updated_at, llm_routing)
VALUES ($1, $2, $3, $4, $5, $6, 'active', $7, $7, 'local')"
VALUES ($1, $2, $3, $4, $5, $6, 'active', $7, $7, 'relay')"
)
.bind(&account_id)
.bind(&req.username)
@@ -176,7 +176,7 @@ pub async fn register(
status: "active".into(),
totp_enabled: false,
created_at: now.to_rfc3339(),
llm_routing: "local".into(),
llm_routing: "relay".into(),
},
};
let jar = set_auth_cookies(jar, &resp.token, &refresh_token);