5.9 KiB
name, overview, todos, isProject
| name | overview | todos | isProject | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| eGFR fix and video gen | Fix the eGFR field not appearing in calculator results due to a Lombok/Jackson serialization mismatch, and ensure the check-in page correctly calls the KieAI API to generate sora videos when the toggle is enabled. |
|
false |
Fix eGFR Display and Check-in Video Generation
Issue 1: eGFR Not Showing in Calculator Results
Root Cause
The field private String eGFR in HealthData uses Lombok @Data, which generates the getter getEGFR(). Jackson follows Java Beans naming convention: when the first two characters after stripping "get" are both uppercase ("EG"), the property name stays as-is: "EGFR". The frontend expects data.healthData.eGFR but receives data.healthData.EGFR, resulting in undefined and displaying --.
sequenceDiagram
participant FE as Frontend
participant BE as Backend
FE->>BE: GET /tool/calculator/result/{id}
BE->>BE: buildResponse() sets healthData.setEGFR(...)
BE-->>FE: JSON: {"healthData":{"EGFR":"7.9",...}}
FE->>FE: healthData.eGFR is undefined
FE->>FE: Displays "--"
Fix
Add @JsonProperty("eGFR") annotation to the eGFR field in NutritionCalculateResponse.java (line 55):
@JsonProperty("eGFR")
@ApiModelProperty(value = "eGFR数值(ml/min/1.73m²)", example = "7.9")
private String eGFR;
This forces Jackson to use the exact field name "eGFR" in JSON output, matching the frontend's expectation.
Issue 2: Check-in Page Video Generation
Current State
The implementation already exists in checkin-publish.vue (lines 590-627). It calls api.createImageToVideoTask() / api.createTextToVideoTask() from models-api.js which hit the backend KieAIController.java endpoints at /api/front/kieai/image-to-video and /api/front/kieai/text-to-video.
Auth is not required (kieai endpoints are excluded from the interceptor in WebConfig.java line 98).
sequenceDiagram
participant User
participant CheckinPage as checkin-publish.vue
participant ModelsAPI as models-api.js
participant Backend as KieAIController
participant Sora2 as ToolSora2ServiceImpl
participant KieAI as KieAI API
User->>CheckinPage: Toggle "生成打卡视频" ON, click 发布
CheckinPage->>ModelsAPI: createImageToVideoTask({imageUrl, prompt, uid})
ModelsAPI->>Backend: POST /api/front/kieai/image-to-video
Backend->>Sora2: createImageToVideoTask(...)
Sora2->>KieAI: Upload image to KieAI
Sora2->>KieAI: POST /api/v1/jobs/createTask (sora-2-image-to-video)
KieAI-->>Sora2: {taskId: "..."}
Sora2->>Sora2: Save Article record with taskId
Sora2-->>Backend: taskId
Backend-->>ModelsAPI: CommonResult{code:200, data: taskId}
ModelsAPI-->>CheckinPage: response
CheckinPage->>CheckinPage: submitCheckin({...taskId...})
Issues to Fix
**a) Request parameter format bug in models-api.js**
The createImageToVideoTask function sends image_urls as [params.imageUrl] (single URL in array). However, the Sora2Request.Input.image_urls field is String[] -- this should work for deserialization, but the request body also sets uid as a potential number (from vuex). The Sora2Request.uid is String type. Jackson auto-coerces number -> String, so this is fine. No code change needed here.
b) n_frames hardcoded in backend
The backend ToolSora2ServiceImpl.java hardcodes input.put("n_frames", "15") at lines 44 and 109, ignoring the value sent by the frontend (5). For check-in videos, a shorter duration (5 frames ~ 5 seconds) is more appropriate. Change to use the value from the request input.
c) Video task result not linked to check-in in backend
Currently the video task creates an Article record but has no direct link to the UserSign (check-in) record. The frontend passes taskId in the submitCheckin request, but this linkage should be verified in the backend ToolCheckinServiceImpl to properly store and retrieve the video for the check-in.
d) Error handling improvement in frontend
The current error handling silently fails. Improve feedback to the user when video generation fails.
Changes
- ToolSora2ServiceImpl.java: Use the
n_framesvalue from the request input instead of hardcoding"15". BothcreateTextToVideoTask(line 44) andcreateImageToVideoTask(line 109) need this fix. - checkin-publish.vue: Improve video generation error handling and ensure proper prompt construction for nutritional video content.
- Verify backend checkin service stores the
taskIdfrom the video task in theUserSignrecord correctly.