|
@@ -8,6 +8,7 @@ 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.res.WorkOrderRes;
|
|
|
import com.slibra.business.service.IFrontService;
|
|
@@ -120,7 +121,7 @@ public class GRPCController extends BaseController {
|
|
|
type = 1;//决策
|
|
|
//决策请求的业务参数
|
|
|
List<DecisionReq> decisionReqs = getDecisionReqs();
|
|
|
- String rows = JSON.toJSONString(decisionReqs, JSONWriter.Feature.WriteNulls);
|
|
|
+// String rows = JSON.toJSONString(decisionReqs, JSONWriter.Feature.WriteNulls);
|
|
|
String dataJson = "";
|
|
|
boolean needAdd = true;//标识变量是否可以保存
|
|
|
try {
|
|
@@ -128,7 +129,17 @@ public class GRPCController extends BaseController {
|
|
|
.usePlaintext()
|
|
|
.build();
|
|
|
InferenceAPIsServiceGrpc.InferenceAPIsServiceBlockingStub stub = InferenceAPIsServiceGrpc.newBlockingStub(channel);
|
|
|
- dataJson = "{\"bot_id\":\"b00001\",\"exp_id\":\"721\",\"norm\":\"" + chatReq.getCategory() + "\",\"feedback\":" + feedback + ",\"simulate\":" + simulate + ",\"session_id\":" + "\"" + sessionId + "\"" + ",\"generate_args\":{\"max_new_tokens\":1024,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{\"rows\":" + rows + "}}";
|
|
|
+// dataJson = "{\"bot_id\":\"b00001\",\"exp_id\":\"721\",\"norm\":\"" + chatReq.getCategory() + "\",\"feedback\":" + feedback + ",\"simulate\":" + simulate + ",\"session_id\":" + "\"" + sessionId + "\"" + ",\"generate_args\":{\"max_new_tokens\":1024,\"max_length\":4096,\"num_beams\":1,\"do_sample\":true,\"top_p\":0.7,\"temperature\":0.95},\"extra\":{\"rows\":" + rows + "}}";
|
|
|
+ //2024年6月24日17:59:17 优化,不再拼接JSON字符串
|
|
|
+ PolicyReq policyReq = new PolicyReq();
|
|
|
+ policyReq.setNorm(chatReq.getCategory());
|
|
|
+ policyReq.setFeedback(StringUtils.isBlank(feedback) ? null : JSON.parseObject(feedback, Map.class));
|
|
|
+ policyReq.setSimulate(StringUtils.isBlank(simulate) ? null : JSON.parseObject(simulate, Map.class));
|
|
|
+ policyReq.setSessionId(sessionId);
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("rows", decisionReqs);
|
|
|
+ policyReq.setExtra(map);
|
|
|
+ dataJson = JSON.toJSONString(policyReq, JSONWriter.Feature.WriteNulls);
|
|
|
log.info("请求大模型的决策的参数为{}", dataJson);
|
|
|
PredictionsRequest request = PredictionsRequest.newBuilder()
|
|
|
.setModelName("slibra_bot")
|