feat: reorganize admin llm settings

This commit is contained in:
2026-08-22 22:06:01 +08:00
parent 78c42eff53
commit f8f0b3c4fd
17 changed files with 1019 additions and 432 deletions
+13 -1
View File
@@ -44,7 +44,8 @@
```bash
cd backend
export Admin__BootstrapUsername='admin'
export Admin__BootstrapPassword='replace-with-a-random-password-of-at-least-12-characters'
export Admin__BootstrapPassword='replace-with-a-password-longer-than-5-characters'
export Secrets__EncryptionKey='base64-encoded-32-byte-key'
dotnet build
# 重启
powershell -Command "Get-Process dotnet | Stop-Process -Force"
@@ -56,6 +57,17 @@ dotnet run --project MiaoJiZhang.Api
引导变量。正式环境必须使用 HTTPS 并保持 `Admin__CookieSecure=true`。本地纯 HTTP 调试时才可
临时设置 `Admin__CookieSecure=false`。
后台“AI 配置 → 模型服务”可以保存和替换 LLM API Key。实际 API Key 使用 AES-GCM
加密后写入配置表,服务端只需通过 `Secrets__EncryptionKey` 提供一个固定的 32 字节
加密主密钥;页面和接口只显示 API Key 尾号。可使用 PowerShell 生成:
```powershell
[Convert]::ToBase64String([Security.Cryptography.RandomNumberGenerator]::GetBytes(32))
```
请将该值保存到部署平台的密钥管理中,不要提交到仓库。更换或丢失主密钥会导致后台已保存的
LLM API Key 无法解密。旧的 `LLM_API_KEY` 仍作为回退配置;后台保存的密钥优先。
### 2. Admin Web
```powershell
cd admin-web