fix(货源): LLM 密钥去掉平台公费兜底,任务没带自己的密钥就不检而不代付
`llm-api-key` 这条回落链(配置 → 公费 key)此前是账目对不上的一个来源:用户没配密钥时 货源任务照样跑完 LLM,花费记在平台头上。现在只认任务自带的 api_key,为空即跳过检测、 保留原始行。两台线上都未设置 AIIMAGE_SIMILAR_ASIN_LLM_API_KEY,本批发布对现网行为零变化。
This commit is contained in:
@@ -158,9 +158,6 @@ public class SimilarAsinProperties {
|
||||
/** 直连 LLM 的 base url(OpenAI 兼容 /v1/chat/completions)。 */
|
||||
private String llmHost = "https://ai.t8star.org";
|
||||
|
||||
/** 直连 LLM 的 Bearer token;前端未传 api_key 时兜底使用。 */
|
||||
private String llmApiKey = "";
|
||||
|
||||
/** 类目匹配(一级/二级)使用的小模型。 */
|
||||
private String llmCategoryModel = "gemini-3.1-flash-lite-preview-thinking-medium";
|
||||
|
||||
|
||||
+3
-5
@@ -97,12 +97,10 @@ public class SimilarAsinLlmClient {
|
||||
: new IllegalStateException(lastFailure.getMessage(), lastFailure);
|
||||
}
|
||||
|
||||
/** 前端 api_key 为空时兜底走服务端配置(工作流里 api_key 为必填项)。 */
|
||||
/** 只认任务/用户自己的 api_key(payload → 按 uid 的服务端密钥表已在 readApiKey 兜过);
|
||||
* 为空即空、跳过 LLM,绝不回落平台公费密钥 —— 各用户的任务只能烧各自的密钥。 */
|
||||
public String resolveApiKey(String apiKey) {
|
||||
if (apiKey != null && !apiKey.isBlank()) {
|
||||
return apiKey.trim();
|
||||
}
|
||||
return normalize(properties.getLlmApiKey());
|
||||
return apiKey == null ? "" : apiKey.trim();
|
||||
}
|
||||
|
||||
public boolean hasApiKey(String apiKey) {
|
||||
|
||||
Reference in New Issue
Block a user