fix(llm): add @Slf4j and log embedding test failures with full stack trace (#176)

Closes #175

ModelConfigController.testEmbedding() previously caught and stringified
the exception's getMessage() into the response body without writing
anything to the server log. Operators investigating an Embedding test
failure saw only the truncated client-side message — root causes like
the DashScope-native vs OpenAI-compat routing bug (#166) or the
requireApiKey gap (#167) were invisible server-side.

Add @Slf4j to the controller and log.error the full stack trace
alongside the failing modelId, so future Embedding test regressions are
diagnosable from the server log without redeploying with debug
breakpoints.
This commit is contained in:
倪程伟 2026-05-20 10:18:48 +08:00 committed by GitHub
parent 3340885da3
commit 461f81ccb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ package vip.mate.llm.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import vip.mate.common.result.R;
import vip.mate.llm.model.*;
@ -22,6 +23,7 @@ import java.util.List;
import java.util.Map;
import vip.mate.workspace.core.annotation.RequireWorkspaceRole;
@Slf4j
@Tag(name = "模型配置管理")
@RestController
@RequestMapping("/api/v1/models")
@ -264,6 +266,7 @@ public class ModelConfigController {
result.put("model", config.getModelName());
result.put("message", "连通性测试成功");
} catch (Exception e) {
log.error("[EmbeddingTest] modelId={} test failed", modelId, e);
result.put("success", false);
result.put("message", e.getMessage());
}