|
@@ -6,10 +6,7 @@ import com.alibaba.fastjson2.JSON;
|
|
|
import com.google.protobuf.ByteString;
|
|
|
import com.slibra.business.domain.*;
|
|
|
import com.slibra.business.mapper.*;
|
|
|
-import com.slibra.business.req.ChatReq;
|
|
|
-import com.slibra.business.req.DecisionReq;
|
|
|
-import com.slibra.business.req.PolicyReq;
|
|
|
-import com.slibra.business.req.WorkOrderReq;
|
|
|
+import com.slibra.business.req.*;
|
|
|
import com.slibra.business.res.WorkOrderRes;
|
|
|
import com.slibra.business.service.IFrontService;
|
|
|
import com.slibra.common.core.controller.BaseController;
|
|
@@ -405,7 +402,16 @@ public class GRPCController extends BaseController {
|
|
|
.usePlaintext()
|
|
|
.build();
|
|
|
InferenceAPIsServiceGrpc.InferenceAPIsServiceBlockingStub stub = InferenceAPIsServiceGrpc.newBlockingStub(channel);
|
|
|
- String dataJson = "{\"bot_id\":\"721\",\"exp_id\":\"721\",\"session_id\":\"" + sessionId + "\",\"use_rag\":\"true\",\"prompt\":\"你是LibraAI水务大模型,由红杉天枰开发的水务垂直大语言模型,能够提供水务行业专家问答、智能决策、报表分析、智能工单管理等一系列功能,作为水务人的AI助手,你会竭尽全力帮助我处理工作问题。\",\"history_dia\":" + JSON.toJSONString(historyDates) + ",\"generate_args\":{\"max_new_tokens\":2048,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{ \"ip_address\": \"" + ipAddr + "\" },\"strengthen\":" + (isStrong == 1) + "}";
|
|
|
+// String dataJson = "{\"bot_id\":\"721\",\"exp_id\":\"721\",\"session_id\":\"" + sessionId + "\",\"use_rag\":\"true\",\"prompt\":\"你是LibraAI水务大模型,由红杉天枰开发的水务垂直大语言模型,能够提供水务行业专家问答、智能决策、报表分析、智能工单管理等一系列功能,作为水务人的AI助手,你会竭尽全力帮助我处理工作问题。\",\"history_dia\":" + JSON.toJSONString(historyDates) + ",\"generate_args\":{\"max_new_tokens\":2048,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{ \"ip_address\": \"" + ipAddr + "\" },\"strengthen\":" + (isStrong == 1) + "}";
|
|
|
+ //2024年6月25日18:12:23 优化,不再使用拼接JSON字符串
|
|
|
+ ChatRequest chatRequest = new ChatRequest();
|
|
|
+ chatRequest.setSessionId(sessionId);
|
|
|
+ chatRequest.setHistoryDia(historyDates);
|
|
|
+ Map<String, Object> extra = new HashMap<>();
|
|
|
+ extra.put("ip_address", ipAddr);
|
|
|
+ chatRequest.setExtra(extra);
|
|
|
+ chatRequest.setStrengthen(isStrong == 1);
|
|
|
+ String dataJson = JSON.toJSONString(chatRequest);
|
|
|
log.info("请求大模型的问答参数为{}", dataJson);
|
|
|
PredictionsRequest request = PredictionsRequest.newBuilder()
|
|
|
.setModelName("slibra_bot")
|