feat:followup 累积用户澄清回答到全局缓存
This commit is contained in:
@@ -201,6 +201,23 @@ public class ShortNovelServiceImpl implements ShortNovelService {
|
||||
}
|
||||
}
|
||||
|
||||
// 累积用户澄清回答到 session 缓存(用于详情页还原完整澄清流程)
|
||||
if ("answer_clarification".equals(request.getAction())
|
||||
&& request.getSessionId() != null && !request.getSessionId().isEmpty()) {
|
||||
Object answer = request.getPayload() != null ? request.getPayload().get("answer") : null;
|
||||
if (answer == null && request.getPayload() != null) {
|
||||
// 兼容前端可能用 value 字段传答案
|
||||
answer = request.getPayload().get("value");
|
||||
}
|
||||
if (answer != null) {
|
||||
JSONObject entry = new JSONObject();
|
||||
entry.put("kind", "clarification_answer");
|
||||
entry.put("answer", String.valueOf(answer));
|
||||
accumulateStage(request.getSessionId(), entry);
|
||||
log.debug("[ShortNovel] 累积澄清回答: sessionId={}", request.getSessionId());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> upstreamBody = new HashMap<>();
|
||||
upstreamBody.put("session_id", request.getSessionId());
|
||||
upstreamBody.put("user_id", currentUserId);
|
||||
|
||||
Reference in New Issue
Block a user