|
|
@@ -431,6 +431,23 @@ public class AIChatController {
|
|
|
if (memberId != null) {
|
|
|
inputs.put("child_id", memberId);
|
|
|
}
|
|
|
+ // 注入教练人格(对齐 /chat/send 的 mascot 范式;coach_id 用于 LangGraph prompt 路由)
|
|
|
+ com.etotem.cfc.entity.User hcUser = userService.getUserInfo(userId);
|
|
|
+ String hcMascotCode = hcUser != null ? hcUser.getMascot() : null;
|
|
|
+ if (hcMascotCode != null && !hcMascotCode.isEmpty()) {
|
|
|
+ com.etotem.cfc.enums.MascotEnum hcMascot = com.etotem.cfc.enums.MascotEnum.fromCode(hcMascotCode);
|
|
|
+ if (hcMascot != null) {
|
|
|
+ inputs.put("coach_id", hcMascot.getCode());
|
|
|
+ inputs.put("mascot_name", hcMascot.name());
|
|
|
+ inputs.put("mascot_gender", hcMascot.gender());
|
|
|
+ inputs.put("mascot_persona", hcMascot.persona());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ inputs.put("coach_id", "");
|
|
|
+ inputs.put("mascot_name", "健康教练");
|
|
|
+ inputs.put("mascot_gender", "");
|
|
|
+ inputs.put("mascot_persona", "");
|
|
|
+ }
|
|
|
Map<String, Object> resp = aiGateway.chat(query, userId, conversationId, inputs);
|
|
|
String answer = resp != null ? (String) resp.getOrDefault("answer", "") : "";
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|