对话 新增session_id
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.aida.lanecarford.service.impl;
|
||||
|
||||
import com.aida.lanecarford.common.constant.CommonConstants;
|
||||
import com.aida.lanecarford.common.security.context.UserContext;
|
||||
import com.aida.lanecarford.service.ChatService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -90,11 +91,12 @@ public class ChatServiceImpl implements ChatService {
|
||||
*/
|
||||
private void sendToAI(HttpURLConnection connection, String message, String sessionId, String gender)
|
||||
throws IOException {
|
||||
|
||||
Long userId = UserContext.getUserHolder().getId();
|
||||
// 构建AI服务请求体
|
||||
JSONObject requestBody = new JSONObject();
|
||||
requestBody.put("user_message", message);
|
||||
requestBody.put("user_id", sessionId);
|
||||
requestBody.put("user_id", userId);
|
||||
requestBody.put("session_id", sessionId);
|
||||
requestBody.put("gender", gender); // 启用流式输出
|
||||
|
||||
log.info("发送请求到AI服务: sessionId={}, messageLength={}", sessionId, message.length());
|
||||
|
||||
@@ -99,6 +99,7 @@ public class StyleServiceImpl extends ServiceImpl<StyleMapper, Style> implements
|
||||
params.put("stylist_path", stylistPath);
|
||||
params.put("callback_url", webhookDomain);
|
||||
params.put("gender", gender);
|
||||
params.put("max_len", 9);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user