Просмотр исходного кода

fix: make LangGraph URL configurable via @Value + app.yml (IMPORTANT-3) + overview key normalization (BLOCKING-1) + Docker deployment TODO comment

Xiaogang Liao 1 месяц назад
Родитель
Сommit
1ac4851d2a

+ 10 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthReportController.java

@@ -40,6 +40,7 @@ import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -73,6 +74,14 @@ public class HealthReportController {
     private static final String LANGGRAPH_BASE_URL = "http://localhost:9000";
     private static final String LANGGRAPH_BASE_URL = "http://localhost:9000";
     private static final String REPORT_PARSE_URL = LANGGRAPH_BASE_URL + "/api/v1/report/parse";
     private static final String REPORT_PARSE_URL = LANGGRAPH_BASE_URL + "/api/v1/report/parse";
 
 
+    /**
+     * LangGraph 服务地址(生产环境通过 application.yml 覆盖,避免 Docker 容器跨主机调用失败)
+     * TODO(部署): 容器化部署时需确保 Java 上传目录(uploads/health-reports)
+     * 对 LangGraph 容器可见(共享 volume 或主机路径挂载),否则 file_path 不可访问将回退本地解析。
+     */
+    @Value("${langgraph.base-url:http://localhost:9000}")
+    private String langgraphBaseUrl;
+
     @Resource
     @Resource
     private HealthReportService healthReportService;
     private HealthReportService healthReportService;
 
 
@@ -499,7 +508,7 @@ public class HealthReportController {
                 }
                 }
 
 
                 ResponseEntity<Map> lgResponse = restTemplate.postForEntity(
                 ResponseEntity<Map> lgResponse = restTemplate.postForEntity(
-                        REPORT_PARSE_URL, lgRequest, Map.class);
+                        langgraphBaseUrl + "/api/v1/report/parse", lgRequest, Map.class);
                 Map<String, Object> lgBody = lgResponse.getBody();
                 Map<String, Object> lgBody = lgResponse.getBody();
                 if (lgBody != null && Integer.valueOf(200).equals(lgBody.get("code"))) {
                 if (lgBody != null && Integer.valueOf(200).equals(lgBody.get("code"))) {
                     Map<String, Object> lgData = (Map<String, Object>) lgBody.get("data");
                     Map<String, Object> lgData = (Map<String, Object>) lgBody.get("data");

+ 6 - 0
cfc-backend/src/main/resources/application.yml

@@ -102,6 +102,12 @@ python:
     failure-threshold: 3
     failure-threshold: 3
     reset-timeout-ms: 30000
     reset-timeout-ms: 30000
 
 
+langgraph:
+  # LangGraph 报告解析服务(健康报告 PDF → 结构化 JSON)
+  # 开发环境默认 localhost,生产环境指向 ai.etotem.com.cn
+  # TODO(部署): 容器化时需确保 uploads/health-reports 对 LangGraph 容器可见
+  base-url: ${LANGGRAPH_BASE_URL:http://localhost:9000}
+
 math:
 math:
   verify-mode: dify  # dify | eval; dify=走Dify工作流, eval=服务端计算(兜底)
   verify-mode: dify  # dify | eval; dify=走Dify工作流, eval=服务端计算(兜底)
   workflow-id: ""    # Dify 数学判题工作流 ID(留空则使用 eval 兜底)
   workflow-id: ""    # Dify 数学判题工作流 ID(留空则使用 eval 兜底)