feat(设备日志/后台配置/密钥检测): 补齐已上线未提交的设备日志与app_config,并合入检测模型解耦
三部分均已部署到双节点(当前线上 JAR 009efc3e),本次补齐仓库状态,避免"已上线未提交" 在后续最小构建比对里被误判。 - 设备日志管理:modules/devicelog + DeviceLogOssProperties(主机B 独立 MinIO,仅内网) + V127 device_log_file/device_log_config + admin-vue 日志管理页;客户端/麦象按 offset 增量上报(X-Internal-Token),查询仅超管 - 后台通用配置:modules/appconfig + V128 app_config 键值表;工作台「开店流程」密码改服务端 校验(POST /api/kd-flow/verify),改密码只需 UPDATE 该行、客户端无需重新发版 - 密钥检测模型解耦:新增 aiimage.user-secret.check-model(env AIIMAGE_USER_SECRET_CHECK_MODEL), 默认 doubao-seed-2-0-lite-260215 —— 同系列 mini 在中继分组下无可用渠道(503 model_not_found), 实测 lite 可路由;UserSecretModule 去掉 LlmTarget 改 resolveLlmHost,探测日志带 model= - 前端:密钥面板「检测配置密钥」按钮不再折行;client-changelog 补 4.0.19/4.0.20/4.0.21 条目 注:application.yml 与 PropertiesConfig 同时承载上述多个部分,故未按功能拆分提交
This commit is contained in:
+12
-7
@@ -6,6 +6,7 @@ import com.nanri.aiimage.common.util.SecretMasking;
|
||||
import com.nanri.aiimage.config.AppearancePatentProperties;
|
||||
import com.nanri.aiimage.config.HttpClientPool;
|
||||
import com.nanri.aiimage.config.SimilarAsinProperties;
|
||||
import com.nanri.aiimage.config.UserSecretProperties;
|
||||
import com.nanri.aiimage.modules.usersecret.client.JikipProxyClient;
|
||||
import com.nanri.aiimage.modules.usersecret.support.UserSecretModule;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -29,6 +30,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 密钥连通性探测:调一次 LLM /v1/chat/completions,能访问通(2xx 且返回 choices)即通过。
|
||||
* 检测模型独立配置(aiimage.user-secret.check-model,默认便宜模型 doubao-seed-2-0-lite-260215),
|
||||
* 与业务任务模型(gemini-3.8-flash 等)无关。
|
||||
* 无副作用(落库由 UserApiSecretService 负责)、不重试;
|
||||
* 出口默认直连,配置了提取链接时优先经代理、代理网络不可达自动回退直连。
|
||||
*/
|
||||
@@ -75,6 +78,7 @@ public class UserApiSecretCheckService {
|
||||
|
||||
private final AppearancePatentProperties appearancePatentProperties;
|
||||
private final SimilarAsinProperties similarAsinProperties;
|
||||
private final UserSecretProperties userSecretProperties;
|
||||
private final JikipProxyClient jikipProxyClient;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@@ -294,8 +298,9 @@ public class UserApiSecretCheckService {
|
||||
}
|
||||
|
||||
private CheckOutcome probeOnce(UserSecretModule module, String plainApiKey, String proxyUrl, boolean viaProxy) {
|
||||
UserSecretModule.LlmTarget target = module.resolveLlmTarget(appearancePatentProperties, similarAsinProperties);
|
||||
String url = joinUrl(target.host(), "/v1/chat/completions");
|
||||
String host = module.resolveLlmHost(appearancePatentProperties, similarAsinProperties);
|
||||
String model = userSecretProperties.getCheckModel();
|
||||
String url = joinUrl(host, "/v1/chat/completions");
|
||||
String key = stripBearer(plainApiKey);
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String viaText = viaProxy ? "经代理" : "直连";
|
||||
@@ -307,20 +312,20 @@ public class UserApiSecretCheckService {
|
||||
headers.setContentType(APPLICATION_JSON_UTF8);
|
||||
headers.set(HttpHeaders.ACCEPT_CHARSET, StandardCharsets.UTF_8.name());
|
||||
})
|
||||
.body(buildCheckBody(target.model()))
|
||||
.body(buildCheckBody(model))
|
||||
.exchange((request, response) -> new StatusAndBody(
|
||||
response.getStatusCode().value(),
|
||||
readResponseBodyBounded(response.getBody())));
|
||||
long latency = System.currentTimeMillis() - startMillis;
|
||||
CheckOutcome outcome = classify(statusAndBody.statusCode(), statusAndBody.body(), (int) latency, viaProxy);
|
||||
log.info("[user-secret][check] {}探测完成 module={} status={} code={} httpStatus={} latency={}ms",
|
||||
viaText, module.key(), outcome.status(), outcome.code(), statusAndBody.statusCode(), latency);
|
||||
log.info("[user-secret][check] {}探测完成 module={} model={} status={} code={} httpStatus={} latency={}ms",
|
||||
viaText, module.key(), model, outcome.status(), outcome.code(), statusAndBody.statusCode(), latency);
|
||||
return outcome;
|
||||
} catch (Exception ex) {
|
||||
long latency = System.currentTimeMillis() - startMillis;
|
||||
CheckOutcome outcome = classifyTransportFailure(ex, (int) latency, viaProxy);
|
||||
log.warn("[user-secret][check] {}探测异常 module={} latency={}ms code={} err={}",
|
||||
viaText, module.key(), latency, outcome.code(), ex.getMessage());
|
||||
log.warn("[user-secret][check] {}探测异常 module={} model={} latency={}ms code={} err={}",
|
||||
viaText, module.key(), model, latency, outcome.code(), ex.getMessage());
|
||||
return outcome;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-12
@@ -41,16 +41,12 @@ public enum UserSecretModule {
|
||||
return required;
|
||||
}
|
||||
|
||||
/** 检测目标:LLM 主机 + 模型(仅 LLM 类模块;代理模块没有 LLM 目标)。 */
|
||||
public LlmTarget resolveLlmTarget(AppearancePatentProperties appearancePatentProperties,
|
||||
SimilarAsinProperties similarAsinProperties) {
|
||||
/** 检测目标主机:各 LLM 模块自己的 API 主机(检测模型由 aiimage.user-secret.check-model 统一指定)。 */
|
||||
public String resolveLlmHost(AppearancePatentProperties appearancePatentProperties,
|
||||
SimilarAsinProperties similarAsinProperties) {
|
||||
return switch (this) {
|
||||
case APPEARANCE_PATENT -> new LlmTarget(
|
||||
appearancePatentProperties.getLlmHost(),
|
||||
appearancePatentProperties.getTitleModel());
|
||||
case SIMILAR_ASIN -> new LlmTarget(
|
||||
similarAsinProperties.getLlmHost(),
|
||||
similarAsinProperties.getLlmCategoryModel());
|
||||
case APPEARANCE_PATENT -> appearancePatentProperties.getLlmHost();
|
||||
case SIMILAR_ASIN -> similarAsinProperties.getLlmHost();
|
||||
case PROXY -> throw new IllegalStateException("代理模块没有 LLM 检测目标");
|
||||
};
|
||||
}
|
||||
@@ -72,7 +68,4 @@ public enum UserSecretModule {
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public record LlmTarget(String host, String model) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user