feat(密钥管理): 代理配置后台明文展示 + 按次统计各密钥调用损耗

- 后台密钥管理「代理设置」列改为完整明文展示(含账号密码),便于运维核对;
  新增 full 字段仅对代理模块下发,密钥两列保持脱敏
- 新增 biz_user_secret_usage_daily(V117):用户 × 模块 × 天累计真实对外请求次数
- 计次口径:LLM 每次真实 HTTP 请求(含重试)计 1 次;代理每次成功提取计 1 次
- LLM 埋点走 SecretUsageContext 上下文(批次外设置、线程池内快照恢复)
- 新增内部上报接口 /api/internal/user-secret-usage(X-Internal-Token)
- 新增后台页「密钥用量统计」:日期范围 + 用户名 + 分组筛选,含范围内汇总
This commit is contained in:
2026-09-13 21:56:46 +08:00
parent 178901b03e
commit 41674d1adb
35 changed files with 1545 additions and 76 deletions
@@ -22,6 +22,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import static org.assertj.core.api.Assertions.assertThat;
import com.nanri.aiimage.modules.usersecret.service.UserSecretUsageService;
import static org.mockito.Mockito.mock;
class AppearancePatentLlmClientHttpTest {
@@ -45,7 +47,8 @@ class AppearancePatentLlmClientHttpTest {
properties,
objectMapper,
null,
new BrandCheckClient(new BrandCheckProperties(), null)
new BrandCheckClient(new BrandCheckProperties(), null),
mock(UserSecretUsageService.class)
);
}
@@ -15,6 +15,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.nanri.aiimage.modules.usersecret.service.UserSecretUsageService;
class AppearancePatentLlmClientTest {
@@ -22,7 +23,8 @@ class AppearancePatentLlmClientTest {
new AppearancePatentProperties(),
new ObjectMapper(),
null,
new BrandCheckClient(new BrandCheckProperties(), null)
new BrandCheckClient(new BrandCheckProperties(), null),
mock(UserSecretUsageService.class)
);
@Test
@@ -65,7 +67,8 @@ class AppearancePatentLlmClientTest {
new AppearancePatentProperties(),
new ObjectMapper(),
null,
brandCheckClient
brandCheckClient,
mock(UserSecretUsageService.class)
);
AppearancePatentResultRowDto row = new AppearancePatentResultRowDto();
row.setId("1");
@@ -90,7 +93,8 @@ class AppearancePatentLlmClientTest {
new AppearancePatentProperties(),
new ObjectMapper(),
null,
brandCheckClient
brandCheckClient,
mock(UserSecretUsageService.class)
);
AppearancePatentResultRowDto row = new AppearancePatentResultRowDto();
row.setId("1");
@@ -112,7 +116,8 @@ class AppearancePatentLlmClientTest {
new AppearancePatentProperties(),
new ObjectMapper(),
null,
brandCheckClient
brandCheckClient,
mock(UserSecretUsageService.class)
);
AppearancePatentResultRowDto row = new AppearancePatentResultRowDto();
row.setId("1");
@@ -134,7 +139,8 @@ class AppearancePatentLlmClientTest {
new AppearancePatentProperties(),
new ObjectMapper(),
null,
brandCheckClient
brandCheckClient,
mock(UserSecretUsageService.class)
);
AppearancePatentResultRowDto row = new AppearancePatentResultRowDto();
row.setId("1");