fix: save llm key without extra secret
This commit is contained in:
+3
-11
@@ -45,7 +45,6 @@
|
||||
cd backend
|
||||
export Admin__BootstrapUsername='admin'
|
||||
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"
|
||||
@@ -57,16 +56,9 @@ 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` 仍作为回退配置;后台保存的密钥优先。
|
||||
后台“AI 配置 → 模型服务”可以直接保存和替换 LLM API Key。实际 API Key 使用 AES-GCM
|
||||
加密后写入配置表,加密密钥由服务端从必填的 `Jwt__Secret` 自动派生,无需增加部署变量;
|
||||
页面和接口只显示 API Key 尾号。旧的 `LLM_API_KEY` 仍作为回退配置,后台保存的密钥优先。
|
||||
|
||||
### 2. Admin Web
|
||||
```powershell
|
||||
|
||||
Reference in New Issue
Block a user