|
@@ -112,6 +112,15 @@ public class AIChatController {
|
|
|
inputs.put("mascot_persona", "");
|
|
inputs.put("mascot_persona", "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 画像注入
|
|
|
|
|
+ String chatMemberIdStr = params.get("memberId");
|
|
|
|
|
+ Long chatMemberId = chatMemberIdStr != null && !chatMemberIdStr.trim().isEmpty()
|
|
|
|
|
+ ? Long.valueOf(chatMemberIdStr) : null;
|
|
|
|
|
+ String chatPortrait = portraitService.buildPortraitPrompt(userId, chatMemberId);
|
|
|
|
|
+ if (chatPortrait != null) {
|
|
|
|
|
+ inputs.put("portrait_prompt", chatPortrait);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// AI记忆层注入(会话摘要+关键事实)
|
|
// AI记忆层注入(会话摘要+关键事实)
|
|
|
inputs = aiService.enrichInputsWithMemory(userId, conversationId, inputs);
|
|
inputs = aiService.enrichInputsWithMemory(userId, conversationId, inputs);
|
|
|
|
|
|
|
@@ -459,6 +468,11 @@ public class AIChatController {
|
|
|
inputs.put("mascot_gender", "");
|
|
inputs.put("mascot_gender", "");
|
|
|
inputs.put("mascot_persona", "");
|
|
inputs.put("mascot_persona", "");
|
|
|
}
|
|
}
|
|
|
|
|
+ // 画像注入
|
|
|
|
|
+ String coachPortrait = portraitService.buildPortraitPrompt(userId, memberId);
|
|
|
|
|
+ if (coachPortrait != null) {
|
|
|
|
|
+ inputs.put("portrait_prompt", coachPortrait);
|
|
|
|
|
+ }
|
|
|
Map<String, Object> resp = aiGateway.chat(query, userId, conversationId, inputs);
|
|
Map<String, Object> resp = aiGateway.chat(query, userId, conversationId, inputs);
|
|
|
String answer = resp != null ? (String) resp.getOrDefault("answer", "") : "";
|
|
String answer = resp != null ? (String) resp.getOrDefault("answer", "") : "";
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
@@ -491,6 +505,12 @@ public class AIChatController {
|
|
|
if (params.get("focus") != null) {
|
|
if (params.get("focus") != null) {
|
|
|
inputs.put("focus", params.get("focus").toString());
|
|
inputs.put("focus", params.get("focus").toString());
|
|
|
}
|
|
}
|
|
|
|
|
+ // 画像注入
|
|
|
|
|
+ Long butlerMemberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : null;
|
|
|
|
|
+ String butlerPortrait = portraitService.buildPortraitPrompt(userId, butlerMemberId);
|
|
|
|
|
+ if (butlerPortrait != null) {
|
|
|
|
|
+ inputs.put("portrait_prompt", butlerPortrait);
|
|
|
|
|
+ }
|
|
|
Map<String, Object> resp = aiGateway.chat(query, userId, conversationId, inputs);
|
|
Map<String, Object> resp = aiGateway.chat(query, userId, conversationId, inputs);
|
|
|
String answer = resp != null ? (String) resp.getOrDefault("answer", "") : "";
|
|
String answer = resp != null ? (String) resp.getOrDefault("answer", "") : "";
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
Map<String, Object> result = new LinkedHashMap<>();
|