diff options
author | 2025-02-10 16:29:57 +0800 | |
---|---|---|
committer | 2025-02-10 16:39:51 +0800 | |
commit | 2abd67671a9380f72984100f05e45a171d1d7f86 (patch) | |
tree | 6c8a7df2aa684d7e1c306a482496822248442b54 | |
parent | 93aa1fb7f0184dab8ab0810dbe33035e0fc3d0c9 (diff) |
Add a logout interface for the mass platform
Issue-ID: USECASEUI-844
Change-Id: I23b643b37bb489658739fd288c890405cf797e48
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
18 files changed, 107 insertions, 43 deletions
diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/BiShengCreateDatasetResponse.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/BiShengCreateDatasetResponse.java index 3047376..16f2954 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/BiShengCreateDatasetResponse.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/BiShengCreateDatasetResponse.java @@ -6,4 +6,11 @@ import lombok.Data; @Data public class BiShengCreateDatasetResponse extends ResponseStatus { private JSONObject data; + + @Override + public String toString() { + return "BiShengCreateDatasetResponse{" + + "data=" + data + + "} " + super.toString(); + } } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/ProcessFileResponse.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/ProcessFileResponse.java index 829f8cd..aa6ade3 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/ProcessFileResponse.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/bean/bisheng/ProcessFileResponse.java @@ -9,4 +9,11 @@ import java.util.List; @Data public class ProcessFileResponse extends ResponseStatus{ private List<JSONObject> data; + + @Override + public String toString() { + return "ProcessFileResponse{" + + "data=" + data + + "} " + super.toString(); + } } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/controller/MaaSController.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/controller/MaaSController.java index 2884f7b..403238e 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/controller/MaaSController.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/controller/MaaSController.java @@ -27,4 +27,9 @@ public class MaaSController { public ServiceResult registerMaaSPlatform(@RequestBody MaaSPlatform maaSPlatform) { return maaSService.registerMaaSPlatform(maaSPlatform); } + + @DeleteMapping(value = "/maas/delete/{maaSPlatformId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ServiceResult registerMaaSPlatform(@PathVariable("maaSPlatformId") String maaSPlatformId) { + return maaSService.deleteMaaSPlatform(maaSPlatformId); + } } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/ApplicationMapper.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/ApplicationMapper.java index 22aeef2..57edf5d 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/ApplicationMapper.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/ApplicationMapper.java @@ -16,7 +16,5 @@ public interface ApplicationMapper { Application getApplicationById(@Param(value = "applicationId") String applicationId); - int updateApplication(@Param(value = "application") Application application); - List<Application> getApplicationByDatasetId(@Param(value = "knowledgeBaseId") String knowledgeBaseId); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/DatasetMapper.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/DatasetMapper.java index 575bae9..6055e52 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/DatasetMapper.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/DatasetMapper.java @@ -30,4 +30,6 @@ public interface DatasetMapper { int deleteFileByFileId(@Param(value = "fileId") String fileId); String getKnowledgeIdByFileId(@Param(value = "fileId") String fileId); + + File getFileMessageByName(@Param(value = "fileName") String fileName, @Param(value = "knowledgeBaseId") String knowledgeBaseId); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/MaaSPlatformMapper.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/MaaSPlatformMapper.java index d4eb21b..7e692b3 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/MaaSPlatformMapper.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/mapper/MaaSPlatformMapper.java @@ -21,5 +21,9 @@ public interface MaaSPlatformMapper { MaaSPlatform getMaaSPlatformById(@Param(value = "maaSPlatformId") String maaSPlatformId); - ModelInformation getModelById(@Param(value = "modelId") String modelId); + ModelInformation getModelById(@Param(value = "modelId") String modelId, @Param(value = "maaSPlatformId") String maaSPlatformId); + + int deleteMaaSPlatformById(@Param(value = "maaSPlatformId") String maaSPlatformId); + + int deleteModelByMaaSPlatformId(@Param(value = "maaSPlatformId") String maaSPlatformId); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/MaaSService.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/MaaSService.java index 026666a..b27c58d 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/MaaSService.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/MaaSService.java @@ -10,4 +10,6 @@ public interface MaaSService { List<Operator> getAllMaaSPlatform(); ServiceResult registerMaaSPlatform(MaaSPlatform maaSPlatform); + + ServiceResult deleteMaaSPlatform(String maaSPlatformId); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/ApplicationServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/ApplicationServiceImpl.java index be3411a..90de2c7 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/ApplicationServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/ApplicationServiceImpl.java @@ -79,7 +79,7 @@ public class ApplicationServiceImpl implements ApplicationService { public ServiceResult getApplications() { List<Application> allApplication = applicationMapper.getAllApplication(); if (CollectionUtils.isEmpty(allApplication)) { - return new ServiceResult(new ResultHeader(500, "no application"), allApplication); + return new ServiceResult(new ResultHeader(200, "no application"), allApplication); } allApplication.forEach(application -> { KnowledgeBase knowledgeBaseRecordById = datasetMapper.getKnowledgeBaseRecordById(application.getKnowledgeBaseId()); diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengApplicationServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengApplicationServiceImpl.java index 309e013..1486a99 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengApplicationServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengApplicationServiceImpl.java @@ -2,6 +2,7 @@ package org.onap.usecaseui.llmadaptation.service.impl; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import io.netty.util.internal.StringUtil; import lombok.extern.slf4j.Slf4j; import org.onap.usecaseui.llmadaptation.bean.Application; import org.onap.usecaseui.llmadaptation.bean.ResultHeader; @@ -33,7 +34,7 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService private WebClient webClient; @Override - public Mono<ServiceResult> createApplication(Application application, String serverIp) { + public Mono<ServiceResult> createApplication(Application application, String serverIp) { JSONObject createParam = new JSONObject(); createParam.put("logo", ""); createParam.put("name", application.getApplicationName()); @@ -51,7 +52,10 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService return Mono.just(new ServiceResult(new ResultHeader(createResponse.getStatus_code(), createResponse.getStatus_message()))); } String applicationId = data.getString("id"); - data.put("desc", application.getApplicationDescription()); + String applicationDescription = application.getApplicationDescription(); + if (!StringUtil.isNullOrEmpty(applicationDescription)) { + data.put("desc", applicationDescription); + } data.put("model_name", application.getLargeModelId()); data.put("temperature", application.getTemperature() / 10); List<Integer> list = new ArrayList<>(); @@ -67,13 +71,17 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService .retrieve() .bodyToMono(BiShengCreateDatasetResponse.class) .flatMap(updateResponse -> { - application.setApplicationId(applicationId); - applicationMapper.insertApplication(application); - return Mono.just(new ServiceResult(new ResultHeader(200, "Application created successfully"))); + if (updateResponse.getStatus_code() == 200) { + application.setApplicationId(applicationId); + applicationMapper.insertApplication(application); + return Mono.just(new ServiceResult(new ResultHeader(200, "Application created successfully"))); + } + log.error("error is {}",updateResponse.getStatus_message()); + return Mono.just(new ServiceResult(new ResultHeader(updateResponse.getStatus_code(), "Application created failed"))); }); }).onErrorResume(e -> { log.error("Error occurred while creating application: {}", e.getMessage()); - return Mono.just(new ServiceResult(new ResultHeader(500, "Application creation failed"))); + return Mono.just(new ServiceResult(new ResultHeader(500, "Application created failed"))); }); } @@ -95,7 +103,7 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService .retrieve() .bodyToFlux(String.class) .flatMap(response -> { - if("[DONE]".equals(response)){ + if ("[DONE]".equals(response)) { return Flux.just(response); } JSONArray choices = JSONObject.parseObject(response).getJSONArray("choices"); @@ -119,7 +127,7 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService .retrieve() .bodyToMono(BiShengCreateDatasetResponse.class) .flatMap(response -> { - if (response.getStatus_code() == 200) { + if (response.getStatus_code() == 200 || response.getStatus_code() == 10400) { return Mono.fromRunnable(() -> { try { applicationMapper.deleteApplicationById(applicationId); @@ -158,7 +166,7 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService data.put("knowledge_list", list); data.put("model_name", application.getLargeModelId()); data.put("temperature", application.getTemperature() / 10); - data.put("prompt",application.getPrompt()); + data.put("prompt", application.getPrompt()); data.put("guide_word", application.getOpeningRemarks()); return webClient.put() .uri(serverIp + BiShengConstant.APPLICATION_URL) @@ -168,8 +176,12 @@ public class BiShengApplicationServiceImpl implements BiShengApplicationService .retrieve() .bodyToMono(BiShengCreateDatasetResponse.class) .flatMap(updateResponse -> { - applicationMapper.updateApplication(application); - return Mono.just(new ServiceResult(new ResultHeader(200, "Application update successfully"))); + if (updateResponse.getStatus_code() == 200) { + applicationMapper.insertApplication(application); + return Mono.just(new ServiceResult(new ResultHeader(200, "Application update successfully"))); + } + log.error("error is {}", updateResponse.getStatus_message()); + return Mono.just(new ServiceResult(new ResultHeader(updateResponse.getStatus_code(), "Application update failed"))); }); }).onErrorResume(e -> { log.error("Error occurred while update application: {}", e.getMessage()); diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengDatasetServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengDatasetServiceImpl.java index f12be8d..6d71d4e 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengDatasetServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/BiShengDatasetServiceImpl.java @@ -118,8 +118,11 @@ public class BiShengDatasetServiceImpl implements BiShengDatasetService { if (lastResponse.getStatus_code() == 200) { JSONObject data = lastResponse.getData().get(0); int fileId = data.getIntValue("id"); - File file = new File(String.valueOf(fileId), filename); - datasetMapper.insertFileName(List.of(file), String.valueOf(knowledgeBaseId)); + File fileMessageByName = datasetMapper.getFileMessageByName(filename, String.valueOf(knowledgeBaseId)); + if (fileMessageByName == null) { + File file = new File(String.valueOf(fileId), filename); + datasetMapper.insertFileName(List.of(file), String.valueOf(knowledgeBaseId)); + } } return Mono.empty(); }); @@ -134,7 +137,7 @@ public class BiShengDatasetServiceImpl implements BiShengDatasetService { .retrieve() .bodyToMono(BiShengCreateDatasetResponse.class) .flatMap(response -> { - if (response.getStatus_code() == 200) { + if (response.getStatus_code() == 200 || response.getStatus_code() == 404) { return Mono.fromRunnable(() -> { try { datasetMapper.deleteKnowledgeBaseByUuid(knowledgeBaseId); @@ -177,6 +180,8 @@ public class BiShengDatasetServiceImpl implements BiShengDatasetService { knowledgeBase.setUpdateTime(TimeUtil.getNowTime()); datasetMapper.updateKnowledgeBase(knowledgeBase); }).then(Mono.just(new ServiceResult(new ResultHeader(200, "update success")))); + } else if (response.getStatus_code() == 404) { + return Mono.just(new ServiceResult(new ResultHeader(404, "The resource does not exist,please delete"))); } else { return Mono.just(new ServiceResult(new ResultHeader(500, response.getStatus_message()))); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/DatasetServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/DatasetServiceImpl.java index 27967a9..f80e929 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/DatasetServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/DatasetServiceImpl.java @@ -45,7 +45,7 @@ public class DatasetServiceImpl implements DatasetService { if (!CollectionUtils.isEmpty(knowledgeBaseRecords)) { List<KnowledgeBase> collect = knowledgeBaseRecords.stream().filter(base -> base.getKnowledgeBaseName().equals(knowledgeBase.getKnowledgeBaseName())).toList(); if (!collect.isEmpty()) { - return Mono.just(new ServiceResult(new ResultHeader(200, "name exists"), knowledgeBaseRecords)); + return Mono.just(new ServiceResult(new ResultHeader(500, "name exists"), knowledgeBaseRecords)); } } MaaSPlatform maaSPlatformById = maaSPlatformMapper.getMaaSPlatformById(knowledgeBase.getMaaSPlatformId()); @@ -74,7 +74,7 @@ public class DatasetServiceImpl implements DatasetService { public ServiceResult getDataSetRecord() { List<KnowledgeBase> knowledgeBaseRecords = datasetMapper.getKnowledgeBaseRecords(); if (CollectionUtils.isEmpty(knowledgeBaseRecords)) { - return new ServiceResult(new ResultHeader(500, "get datasets failed"), knowledgeBaseRecords); + return new ServiceResult(new ResultHeader(200, "no dataset"), knowledgeBaseRecords); } knowledgeBaseRecords.forEach(knowledgeBase -> { diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptApplicationServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptApplicationServiceImpl.java index 5a3ab79..22a54a6 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptApplicationServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptApplicationServiceImpl.java @@ -97,8 +97,11 @@ public class FastGptApplicationServiceImpl implements FastGptApplicationService .flatMap(response -> { if (response.getCode() == 200) { return publishApplication(application, dataId, serverIp); + } else if (response.getCode() == 502000) { + return Mono.just(new ServiceResult(new ResultHeader(404, "The resource does not exist,please delete"))); + } else { + return Mono.just(new ServiceResult(new ResultHeader(500, response.getStatusText()))); } - return Mono.just(new ServiceResult(new ResultHeader(500, response.getStatusText()))); }); } @@ -222,7 +225,7 @@ public class FastGptApplicationServiceImpl implements FastGptApplicationService .retrieve() .bodyToMono(CreateDataSetResponse.class) .flatMap(response -> { - if (response.getCode() == 200) { + if (response.getCode() == 200 || response.getCode() == 502000) { return Mono.fromRunnable(() -> { try { applicationMapper.deleteApplicationById(applicationId); diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptDatasetServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptDatasetServiceImpl.java index 8c81a7a..8eba3ae 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptDatasetServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/FastGptDatasetServiceImpl.java @@ -157,8 +157,11 @@ public class FastGptDatasetServiceImpl implements FastGptDatasetService { .bodyToMono(CreateDataSetResponse.class) .flatMap(responseData -> { if (responseData.getCode() == 200) { - File file = new File(String.valueOf(fileId), filename); - datasetMapper.insertFileName(List.of(file), String.valueOf(knowledgeBaseId)); + File fileMessageByName = datasetMapper.getFileMessageByName(filename, knowledgeBaseId); + if (fileMessageByName == null) { + File file = new File(fileId, filename); + datasetMapper.insertFileName(List.of(file), knowledgeBaseId); + } } return Mono.empty(); }); @@ -187,7 +190,7 @@ public class FastGptDatasetServiceImpl implements FastGptDatasetService { .retrieve() .bodyToMono(CreateDataSetResponse.class) .flatMap(response -> { - if (response.getCode() == 200) { + if (response.getCode() == 200 || response.getCode() == 501000) { return Mono.fromRunnable(() -> { try { datasetMapper.deleteKnowledgeBaseByUuid(knowledgeBaseId); @@ -231,6 +234,8 @@ public class FastGptDatasetServiceImpl implements FastGptDatasetService { knowledgeBase.setUpdateTime(TimeUtil.getNowTime()); datasetMapper.updateKnowledgeBase(knowledgeBase); }).then(Mono.just(new ServiceResult(new ResultHeader(200, "update success")))); + } else if (response.getCode() == 501000) { + return Mono.just(new ServiceResult(new ResultHeader(404, "The resource does not exist,please delete"))); } else { return Mono.just(new ServiceResult(new ResultHeader(500, response.getStatusText()))); } diff --git a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/MaaSServiceImpl.java b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/MaaSServiceImpl.java index 6823e1a..f538a6c 100644 --- a/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/MaaSServiceImpl.java +++ b/llm-adaptation/src/main/java/org/onap/usecaseui/llmadaptation/service/impl/MaaSServiceImpl.java @@ -6,7 +6,6 @@ import org.onap.usecaseui.llmadaptation.mapper.MaaSPlatformMapper; import org.onap.usecaseui.llmadaptation.service.MaaSService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.web.reactive.function.client.WebClient; import java.util.ArrayList; import java.util.List; @@ -16,8 +15,6 @@ import java.util.stream.Collectors; @Slf4j @Service public class MaaSServiceImpl implements MaaSService { - @Autowired - private WebClient webClient; @Autowired private MaaSPlatformMapper maaSPlatformMapper; @@ -44,13 +41,14 @@ public class MaaSServiceImpl implements MaaSService { @Override public ServiceResult registerMaaSPlatform(MaaSPlatform maaSPlatform) { - MaaSPlatform maaSPlatformById = maaSPlatformMapper.getMaaSPlatformById(maaSPlatform.getMaaSPlatformId()); + String maaSPlatformId = maaSPlatform.getMaaSPlatformId(); + MaaSPlatform maaSPlatformById = maaSPlatformMapper.getMaaSPlatformById(maaSPlatformId); if (maaSPlatformById != null) { return new ServiceResult(new ResultHeader(500, maaSPlatform.getMaaSPlatformName() + "already exists")); } List<ModelInformation> modelList = maaSPlatform.getModelList(); for (ModelInformation model : modelList) { - ModelInformation modelById = maaSPlatformMapper.getModelById(model.getModelId()); + ModelInformation modelById = maaSPlatformMapper.getModelById(model.getModelId(), maaSPlatformId); if (modelById != null) { return new ServiceResult(new ResultHeader(500, model.getModelName() + " already exists")); } @@ -59,4 +57,19 @@ public class MaaSServiceImpl implements MaaSService { maaSPlatformMapper.insertModel(maaSPlatform.getMaaSPlatformId(), maaSPlatform.getModelList()); return new ServiceResult(new ResultHeader(200, "register success")); } + + @Override + public ServiceResult deleteMaaSPlatform(String maaSPlatformId) { + MaaSPlatform maaSPlatformById = maaSPlatformMapper.getMaaSPlatformById(maaSPlatformId); + if (maaSPlatformById == null) { + return new ServiceResult(new ResultHeader(500, maaSPlatformId + "does not exist")); + } + if (maaSPlatformMapper.deleteMaaSPlatformById(maaSPlatformId) < 1) { + return new ServiceResult(new ResultHeader(500, " delete failed")); + } + if (maaSPlatformMapper.deleteModelByMaaSPlatformId(maaSPlatformId) < 1) { + return new ServiceResult(new ResultHeader(500, " delete failed")); + } + return new ServiceResult(new ResultHeader(200, " delete success")); + } } diff --git a/llm-adaptation/src/main/resources/llm-adaptation-init.sql b/llm-adaptation/src/main/resources/llm-adaptation-init.sql index 2ce4511..7ab2ebc 100644 --- a/llm-adaptation/src/main/resources/llm-adaptation-init.sql +++ b/llm-adaptation/src/main/resources/llm-adaptation-init.sql @@ -19,7 +19,7 @@ create table if not exists model_information( create table if not exists knowledge_base( knowledge_base_id varchar(255) primary key, knowledge_base_name varchar(255), - knowledge_base_description VARCHAR (225), + knowledge_base_description VARCHAR (255), operator_id varchar(255), operator_name varchar(255), maas_platform_id varchar(255), @@ -41,9 +41,9 @@ create table if not exists application( knowledge_base_id varchar(255), model_id varchar(255), model_name varchar(255), - prompt varchar(255), + prompt varchar(1000), temperature float, top_p float, - opening_remarks varchar(255) + opening_remarks varchar(500) ) diff --git a/llm-adaptation/src/main/resources/mapper/ApplicationMapper.xml b/llm-adaptation/src/main/resources/mapper/ApplicationMapper.xml index 08a4644..48bf663 100644 --- a/llm-adaptation/src/main/resources/mapper/ApplicationMapper.xml +++ b/llm-adaptation/src/main/resources/mapper/ApplicationMapper.xml @@ -74,15 +74,6 @@ from application where application_id = #{applicationId} </select> - <update id="updateApplication"> - update application - <trim prefix="set" suffixOverrides=","> - <if test="application.applicationName != null">application_name = #{application.applicationName},</if> - <if test="application.applicationDescription != null">application_description = #{application.applicationDescription},</if> - </trim> - where application_id = #{application.applicationId} - </update> - <select id="getApplicationByDatasetId" resultType="org.onap.usecaseui.llmadaptation.bean.Application"> select application_id as applicationId, application_name as applicationName, diff --git a/llm-adaptation/src/main/resources/mapper/DatasetMapper.xml b/llm-adaptation/src/main/resources/mapper/DatasetMapper.xml index 35b2202..ced3c9f 100644 --- a/llm-adaptation/src/main/resources/mapper/DatasetMapper.xml +++ b/llm-adaptation/src/main/resources/mapper/DatasetMapper.xml @@ -87,4 +87,8 @@ <select id="getKnowledgeIdByFileId" resultType="java.lang.String"> select knowledge_base_id from file where file_id = #{fileId} </select> + <select id="getFileMessageByName" resultType="org.onap.usecaseui.llmadaptation.bean.File"> + select file_id as fileId,file_name as fileName + from file where file_name = #{fileName} and knowledge_base_id = #{knowledgeBaseId} + </select> </mapper>
\ No newline at end of file diff --git a/llm-adaptation/src/main/resources/mapper/MaaSPlatformMapper.xml b/llm-adaptation/src/main/resources/mapper/MaaSPlatformMapper.xml index 63b9c70..6377398 100644 --- a/llm-adaptation/src/main/resources/mapper/MaaSPlatformMapper.xml +++ b/llm-adaptation/src/main/resources/mapper/MaaSPlatformMapper.xml @@ -51,6 +51,12 @@ <select id="getModelById" resultType="org.onap.usecaseui.llmadaptation.bean.ModelInformation"> select model_id as modelId, model_name as modelName - from model_information where model_id = #{modelId} + from model_information where model_id = #{modelId} and maas_platform_id = #{maaSPlatformId} </select> + <delete id="deleteMaaSPlatformById"> + delete from maas_platform where maas_platform_id = #{maaSPlatformId} + </delete> + <delete id="deleteModelByMaaSPlatformId"> + delete from model_information where maas_platform_id = #{maaSPlatformId} + </delete> </mapper>
\ No newline at end of file |