Browse Source

LlmOrgConfigVO增加PromptTemplate字段

luoshi 1 year ago
parent
commit
ff3c3bdc97

+ 6 - 5
src/main/java/com/qmth/ops/api/controller/admin/LlmOrgConfigController.java

@@ -10,10 +10,7 @@ import com.qmth.ops.biz.domain.LlmModel;
 import com.qmth.ops.biz.domain.LlmOrgConfig;
 import com.qmth.ops.biz.domain.Org;
 import com.qmth.ops.biz.query.LlmOrgConfigQuery;
-import com.qmth.ops.biz.service.LlmModelService;
-import com.qmth.ops.biz.service.LlmOrgConfigService;
-import com.qmth.ops.biz.service.LlmSupplierService;
-import com.qmth.ops.biz.service.OrgService;
+import com.qmth.ops.biz.service.*;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,6 +31,9 @@ public class LlmOrgConfigController {
     @Resource
     private LlmModelService llmModelService;
 
+    @Resource
+    private LlmPromptTemplateService llmPromptTemplateService;
+
     @Resource
     private LlmOrgConfigService llmOrgConfigService;
 
@@ -42,7 +42,8 @@ public class LlmOrgConfigController {
         return llmOrgConfigService.query(query).convert(config -> {
             LlmModel model = llmModelService.getById(config.getModelId());
             Org org = orgService.getById(config.getOrgId());
-            return new LlmOrgConfigVO(llmSupplierService.getById(model.getSupplierId()), model, new OrgVO(org), config);
+            return new LlmOrgConfigVO(llmSupplierService.getById(model.getSupplierId()), model,
+                    llmPromptTemplateService.findById(config.getPromptId()), new OrgVO(org), config);
         });
     }
 

+ 14 - 1
src/main/java/com/qmth/ops/api/vo/LlmOrgConfigVO.java

@@ -3,6 +3,7 @@ package com.qmth.ops.api.vo;
 import com.qmth.boot.core.ai.model.llm.LlmAppType;
 import com.qmth.ops.biz.domain.LlmModel;
 import com.qmth.ops.biz.domain.LlmOrgConfig;
+import com.qmth.ops.biz.domain.LlmPromptTemplate;
 import com.qmth.ops.biz.domain.LlmSupplier;
 
 public class LlmOrgConfigVO {
@@ -15,13 +16,17 @@ public class LlmOrgConfigVO {
 
     private LlmAppType appType;
 
+    private LlmPromptTemplate promptTemplate;
+
     private int permitCount;
 
     private int leftCount;
 
-    public LlmOrgConfigVO(LlmSupplier supplier, LlmModel model, OrgVO org, LlmOrgConfig llmOrgConfig) {
+    public LlmOrgConfigVO(LlmSupplier supplier, LlmModel model, LlmPromptTemplate promptTemplate, OrgVO org,
+            LlmOrgConfig llmOrgConfig) {
         this.org = org;
         this.model = model;
+        this.promptTemplate = promptTemplate;
         this.supplier = new LlmSupplierVO(supplier);
         this.appType = llmOrgConfig.getAppType();
         this.permitCount = llmOrgConfig.getPermitCount();
@@ -60,6 +65,14 @@ public class LlmOrgConfigVO {
         this.appType = appType;
     }
 
+    public LlmPromptTemplate getPromptTemplate() {
+        return promptTemplate;
+    }
+
+    public void setPromptTemplate(LlmPromptTemplate promptTemplate) {
+        this.promptTemplate = promptTemplate;
+    }
+
     public int getPermitCount() {
         return permitCount;
     }