添加Prompt优化接口。

This commit is contained in:
Edward_89 2025-01-13 13:33:21 +08:00
parent f8b9f1bfee
commit 5eb2d7c908
6 changed files with 31 additions and 0 deletions

View File

@ -92,4 +92,10 @@ public class PromptTemplatesController {
promptTemplatesService.unbackupPromptTemplates(updateReqVO);
return success(true);
}
@PostMapping("/optimize-prompt")
@Operation(summary = "Prompt优化")
public CommonResult<String> optimizePrompt(@Valid @RequestBody OptimizePromptReqVO reqVO) {
return success(promptTemplatesService.optimizePrompt(reqVO));
}
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.llm.controller.admin.prompttemplates.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - Prompt优化 Request VO")
@Data
public class OptimizePromptReqVO {
private String prompt;
}

View File

@ -90,4 +90,6 @@ public class LLMBackendProperties {
private String modelFileList;
private String modelFileDownload;
private String optimizePrompt;
}

View File

@ -26,4 +26,6 @@ public interface PromptTemplatesService {
void updatePromptTemplatesById(@Valid PromptTemplatesDO promptTemplatesDO);
String optimizePrompt(OptimizePromptReqVO reqVO);
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.llm.service.prompttemplates;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.llm.controller.admin.prompttemplatesbackup.vo.PromptTemplatesBackupSaveReqVO;
import cn.iocoder.yudao.module.llm.dal.dataobject.application.ApplicationDO;
@ -10,6 +11,7 @@ import cn.iocoder.yudao.module.llm.dal.dataobject.prompttemplatesbackup.PromptTe
import cn.iocoder.yudao.module.llm.dal.dataobject.prompttemplatestags.PromptTemplatesTagsDO;
import cn.iocoder.yudao.module.llm.dal.mysql.prompttemplatesapplications.PromptTemplatesApplicationsMapper;
import cn.iocoder.yudao.module.llm.dal.mysql.prompttemplatestags.PromptTemplatesTagsMapper;
import cn.iocoder.yudao.module.llm.framework.backend.config.LLMBackendProperties;
import cn.iocoder.yudao.module.llm.service.application.ApplicationService;
import cn.iocoder.yudao.module.llm.service.label.LabelService;
import cn.iocoder.yudao.module.llm.service.prompttemplatesbackup.PromptTemplatesBackupService;
@ -52,6 +54,8 @@ public class PromptTemplatesServiceImpl implements PromptTemplatesService {
private LabelService labelService;
@Resource
private PromptTemplatesBackupService promptTemplatesBackupService;
@Resource
private LLMBackendProperties llmBackendProperties;
@Lazy
@Resource
@ -361,4 +365,9 @@ public class PromptTemplatesServiceImpl implements PromptTemplatesService {
public void updatePromptTemplatesById(PromptTemplatesDO promptTemplatesDO) {
promptTemplatesMapper.updateById(promptTemplatesDO);
}
@Override
public String optimizePrompt(OptimizePromptReqVO reqVO) {
return HttpUtils.post(llmBackendProperties.getOptimizePrompt(), null, JSON.toJSONString(reqVO));
}
}

View File

@ -309,6 +309,8 @@ llm:
model_file_list: http://36.133.1.230:5123/models/?path=
model_file_download: http://36.133.1.230:5123/models/download/?file_path=
# 提示词优化
optimize_prompt: http://36.133.1.230:5123/optimize-prompt
--- #################### iot相关配置 TODO 芋艿:再瞅瞅 ####################
iot: