feat(密钥): 用户 API 密钥服务端化——V115 按账号绑定存储 + 后台密钥管理页 + 桌面端全站拦截与配置引导
- 新增 usersecret 模块:外观专利/货源查询密钥从本地 localStorage 迁移至 biz_user_api_secret(AES 加密、按 uid 绑定) - 后台「密钥管理」页:脱敏展示、立即检测、清空;每日 04:30 分布式锁定时巡检 - 桌面端:密钥设置面板走服务端、未配齐引导 /setup-secrets、代理余量展示 - 删除专利汇令牌全链路与密钥保留时长选择器
This commit is contained in:
@@ -254,10 +254,6 @@ function effectiveLlmApiKey() {
|
||||
return getStoredApiSecret('appearance-patent').trim()
|
||||
}
|
||||
|
||||
function effectivePatentToken() {
|
||||
return getStoredApiSecret('appearance-patent-token').trim()
|
||||
}
|
||||
|
||||
|
||||
function uidForStorage() {
|
||||
return typeof window !== 'undefined' ? window.localStorage.getItem('uid') || '0' : '0'
|
||||
@@ -391,8 +387,8 @@ async function parseFiles() {
|
||||
return
|
||||
}
|
||||
if (!effectiveLlmApiKey()) {
|
||||
ElMessage.warning('请先在左上角设置中填写外观专利密钥')
|
||||
return
|
||||
// 本地无明文不再阻断:密钥已服务端化,任务执行按用户 uid 兜底读取
|
||||
console.log('[appearance-patent] 本地无密钥明文,提交时由服务端按用户密钥兜底')
|
||||
}
|
||||
parsing.value = true
|
||||
try {
|
||||
@@ -401,7 +397,7 @@ async function parseFiles() {
|
||||
originalFilename: f.originalFilename,
|
||||
relativePath: f.relativePath,
|
||||
}))
|
||||
const res = await parseAppearancePatent(files, effectiveAiPrompt(), effectiveLlmApiKey(), effectivePatentToken())
|
||||
const res = await parseAppearancePatent(files, effectiveAiPrompt(), effectiveLlmApiKey())
|
||||
// 本模块按主 ID 分组执行,没有分组就没有可跑的批次,一并拦下
|
||||
const guard = checkParseResult(res, {
|
||||
requireGroups: true,
|
||||
@@ -437,8 +433,8 @@ async function pushToPythonQueue() {
|
||||
return
|
||||
}
|
||||
if (!effectiveLlmApiKey()) {
|
||||
ElMessage.warning('请先在左上角设置中填写外观专利密钥')
|
||||
return
|
||||
// 本地无明文不再阻断:服务端已保存该用户密钥,任务执行时按 uid 兜底读取
|
||||
console.log('[appearance-patent] 本地无密钥明文,启动任务由服务端兜底')
|
||||
}
|
||||
pushing.value = true
|
||||
try {
|
||||
@@ -451,7 +447,6 @@ async function pushToPythonQueue() {
|
||||
taskId,
|
||||
prompt: queueAiPrompt(),
|
||||
api_key: effectiveLlmApiKey(),
|
||||
patent_token: effectivePatentToken(),
|
||||
sourceFileCount: currentParseResult.sourceFileCount || 0,
|
||||
totalRows: currentParseResult.totalRows || 0,
|
||||
acceptedRows: currentParseResult.acceptedRows || 0,
|
||||
|
||||
Reference in New Issue
Block a user