|
|
@@ -1429,27 +1429,27 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
params.setIcon_color("blue");
|
|
|
params.setIcon_type("robot_assist");
|
|
|
String url = bigModelConfig.getBaseurl() + bigModelConfig.getApplication();
|
|
|
- if(params != null && Objects.nonNull(params.getKnowledge_info().getRerank_status()) && params.getKnowledge_info().getRerank_status() == 1){
|
|
|
- List<IndexType> reankList = new ArrayList();
|
|
|
- for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
- IndexType type = new IndexType();
|
|
|
- type.setIndex_type_id(i);
|
|
|
- type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
- reankList.add(type);
|
|
|
- }
|
|
|
- params.getKnowledge_info().setRerank_index_type_list(reankList);
|
|
|
- }
|
|
|
- if(params != null && Objects.nonNull(params.getKnowledge_info().getRecall_method()) &&
|
|
|
- ("embedding".equals(params.getKnowledge_info().getRecall_method()) || "mixed".equals(params.getKnowledge_info().getRecall_method()))){
|
|
|
- List<IndexType> recallList = new ArrayList();
|
|
|
- for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
- IndexType type = new IndexType();
|
|
|
- type.setIndex_type_id(i);
|
|
|
- type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
- recallList.add(type);
|
|
|
- }
|
|
|
- params.getKnowledge_info().setRecall_index_type_list(recallList);
|
|
|
- }
|
|
|
+// if(params != null && Objects.nonNull(params.getKnowledge_info().getRerank_status()) && params.getKnowledge_info().getRerank_status() == 1){
|
|
|
+// List<IndexType> reankList = new ArrayList();
|
|
|
+// for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
+// IndexType type = new IndexType();
|
|
|
+// type.setIndex_type_id(i);
|
|
|
+// type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
+// reankList.add(type);
|
|
|
+// }
|
|
|
+// params.getKnowledge_info().setRerank_index_type_list(reankList);
|
|
|
+// }
|
|
|
+// if(params != null && Objects.nonNull(params.getKnowledge_info().getRecall_method()) &&
|
|
|
+// ("embedding".equals(params.getKnowledge_info().getRecall_method()) || "mixed".equals(params.getKnowledge_info().getRecall_method()))){
|
|
|
+// List<IndexType> recallList = new ArrayList();
|
|
|
+// for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
+// IndexType type = new IndexType();
|
|
|
+// type.setIndex_type_id(i);
|
|
|
+// type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
+// recallList.add(type);
|
|
|
+// }
|
|
|
+// params.getKnowledge_info().setRecall_index_type_list(recallList);
|
|
|
+// }
|
|
|
JSONObject jsonObject = JSONObject.from(params);
|
|
|
RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8") , jsonObject.toJSONString());
|
|
|
Request request = buildPostRequest(url, requestBody);
|
|
|
@@ -1466,12 +1466,14 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
//调用列表接口将应用数据写入数据库
|
|
|
getValidAppList();
|
|
|
//预设问题写入数据库
|
|
|
- List<QuestionInfo> list = params.getQuestionList();
|
|
|
+ List<String> list = params.getQuestionList();
|
|
|
if(!list.isEmpty() && list.size() > 0){
|
|
|
- for(QuestionInfo vo : list){
|
|
|
- String uuid = IdUtils.simpleUUID();
|
|
|
- Question question = Question.builder().id(uuid).question(vo.getQuestion()).appId(appId).build();
|
|
|
- questionMapper.insertQuestion(question);
|
|
|
+ for(String str : list){
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotBlank(str)){
|
|
|
+ String uuid = IdUtils.simpleUUID();
|
|
|
+ Question question = Question.builder().id(uuid).question(str).appId(appId).build();
|
|
|
+ questionMapper.insertQuestion(question);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1487,27 +1489,27 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
@Override
|
|
|
public JSONObject updateApplication(ApplicationParams params, String appId) {
|
|
|
String url = bigModelConfig.getBaseurl() + bigModelConfig.getApplication() + "/" + appId;
|
|
|
- if(params != null && Objects.nonNull(params.getKnowledge_info().getRerank_status()) && params.getKnowledge_info().getRerank_status() == 1){
|
|
|
- List<IndexType> reankList = new ArrayList();
|
|
|
- for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
- IndexType type = new IndexType();
|
|
|
- type.setIndex_type_id(i);
|
|
|
- type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
- reankList.add(type);
|
|
|
- }
|
|
|
- params.getKnowledge_info().setRerank_index_type_list(reankList);
|
|
|
- }
|
|
|
- if(params != null && Objects.nonNull(params.getKnowledge_info().getRecall_method()) &&
|
|
|
- ("embedding".equals(params.getKnowledge_info().getRecall_method()) || "mixed".equals(params.getKnowledge_info().getRecall_method()))){
|
|
|
- List<IndexType> recallList = new ArrayList();
|
|
|
- for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
- IndexType type = new IndexType();
|
|
|
- type.setIndex_type_id(i);
|
|
|
- type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
- recallList.add(type);
|
|
|
- }
|
|
|
- params.getKnowledge_info().setRecall_index_type_list(recallList);
|
|
|
- }
|
|
|
+// if(params != null && Objects.nonNull(params.getKnowledge_info().getRerank_status()) && params.getKnowledge_info().getRerank_status() == 1){
|
|
|
+// List<IndexType> reankList = new ArrayList();
|
|
|
+// for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
+// IndexType type = new IndexType();
|
|
|
+// type.setIndex_type_id(i);
|
|
|
+// type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
+// reankList.add(type);
|
|
|
+// }
|
|
|
+// params.getKnowledge_info().setRerank_index_type_list(reankList);
|
|
|
+// }
|
|
|
+// if(params != null && Objects.nonNull(params.getKnowledge_info().getRecall_method()) &&
|
|
|
+// ("embedding".equals(params.getKnowledge_info().getRecall_method()) || "mixed".equals(params.getKnowledge_info().getRecall_method()))){
|
|
|
+// List<IndexType> recallList = new ArrayList();
|
|
|
+// for(int i=0; i<params.getKnowledge_ids().size(); i++){
|
|
|
+// IndexType type = new IndexType();
|
|
|
+// type.setIndex_type_id(i);
|
|
|
+// type.setKnowledge_id(params.getKnowledge_ids().get(i));
|
|
|
+// recallList.add(type);
|
|
|
+// }
|
|
|
+// params.getKnowledge_info().setRecall_index_type_list(recallList);
|
|
|
+// }
|
|
|
JSONObject json = JSONObject.from(params);
|
|
|
RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8") , json.toJSONString());
|
|
|
Request request = buildPutRequest(url, requestBody);
|
|
|
@@ -1524,28 +1526,15 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
getValidAppList();
|
|
|
//预设问题写入数据库
|
|
|
questionMapper.delQuestionByAppId(appId);
|
|
|
- List<QuestionInfo> list = params.getQuestionList();
|
|
|
+ List<String> list = params.getQuestionList();
|
|
|
if(!list.isEmpty() && list.size() > 0){
|
|
|
- for(QuestionInfo vo : list){
|
|
|
+ for(String str : list){
|
|
|
// 新增预设问题
|
|
|
- String uuid = IdUtils.simpleUUID();
|
|
|
- Question question = Question.builder().id(uuid).question(vo.getQuestion()).appId(appId).build();
|
|
|
- questionMapper.insertQuestion(question);
|
|
|
- //删除预设问题
|
|
|
-// if(com.takai.common.utils.StringUtils.isNotEmpty(vo.getDelFlag()) && "1".equals(vo.getDelFlag())){
|
|
|
-// questionMapper.delQuestion(vo.getId());
|
|
|
-// }else{
|
|
|
-// if(com.takai.common.utils.StringUtils.isNotEmpty(vo.getId())){
|
|
|
-// // 更新预设问题
|
|
|
-// Question question = Question.builder().question(vo.getQuestion()).build();
|
|
|
-// questionMapper.updateQuestion(question);
|
|
|
-// }else{
|
|
|
-// // 新增预设问题
|
|
|
-// String uuid = IdUtils.simpleUUID();
|
|
|
-// Question question = Question.builder().id(uuid).question(vo.getQuestion()).appId(appId).build();
|
|
|
-// questionMapper.insertQuestion(question);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotBlank(str)){
|
|
|
+ String uuid = IdUtils.simpleUUID();
|
|
|
+ Question question = Question.builder().id(uuid).question(str).appId(appId).build();
|
|
|
+ questionMapper.insertQuestion(question);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1615,7 +1604,8 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
|
|
|
@Override
|
|
|
public JSONObject selectApplication(String appId) {
|
|
|
- String url = "https://open.bigmodel.cn/api/llm-application" + bigModelConfig.getApplication() + "/" + appId;
|
|
|
+ String url = bigModelConfig.getBaseurl() + bigModelConfig.getApplication() + "/" + appId;
|
|
|
+ System.out.println(url);
|
|
|
Request request = buildGetRequest(url);
|
|
|
OkHttpClient client = buildOkHttpClient();
|
|
|
try {
|
|
|
@@ -1623,6 +1613,7 @@ public class BigModelServiceImpl implements IBigModelService
|
|
|
if(response.isSuccessful()){
|
|
|
String result = response.body().string();
|
|
|
JSONObject object = JSON.parseObject(result);
|
|
|
+ log.info(object.toJSONString());
|
|
|
if(object != null){
|
|
|
String code = String.valueOf(object.get("code"));
|
|
|
if("200".equals(code)){
|