mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 03:57:02 +08:00
chore(security): 移除 AI 内置 Key fallback + 修正默认模型名
发布版本不再自动从环境变量读取 VITE_DEEPSEEK_API_KEY 创建默认 DeepSeek provider。 ensureEnvironmentMigration() 改为 no-op(保留方法作为占位)。 用户首次启动必须在「设置 → AI 模型」手动配置 API Key。 migrateLegacy() 保留:用于把用户自己之前存在 localStorage 的旧配置迁移到加密存储, 与内置 Key 是两回事。 附带修正 .env.example 默认模型名:deepseek-v4-flash 是已弃用/不存在的标识符, DeepSeek 官方未发布此模型,统一改为 deepseek-chat。
This commit is contained in:
@@ -41,7 +41,6 @@ export class AIProviderService {
|
||||
constructor(private readonly keyStore = new AIProviderKeyStore()) {}
|
||||
|
||||
list(): AIProviderListResult {
|
||||
this.ensureEnvironmentMigration()
|
||||
try {
|
||||
const data = this.readMetadata()
|
||||
return {
|
||||
@@ -339,15 +338,10 @@ export class AIProviderService {
|
||||
}
|
||||
|
||||
private ensureEnvironmentMigration(): void {
|
||||
const data = this.readMetadata()
|
||||
if (data.providers.length) return
|
||||
const apiKey = String(import.meta.env.VITE_DEEPSEEK_API_KEY || '').trim()
|
||||
if (!apiKey) return
|
||||
this.migrateLegacy({
|
||||
apiKey,
|
||||
baseUrl: String(import.meta.env.VITE_AI_BASE_URL || ''),
|
||||
model: String(import.meta.env.VITE_AI_MODEL || '')
|
||||
})
|
||||
// 已禁用:内置环境变量 Key 自动迁移策略。
|
||||
// 安全要求:发布给最终用户的版本不应携带任何内置 API Key,
|
||||
// 必须由用户自己在 UI 里手动配置(或者通过自己的 .env.local 注入)。
|
||||
// 保留此方法作为占位,方便后续重新评估。
|
||||
}
|
||||
|
||||
private toSummary(
|
||||
|
||||
Reference in New Issue
Block a user