|
|
@@ -37,6 +37,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -288,6 +289,7 @@ public class BizQuestionGroupServiceImpl implements IBizQuestionGroupService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Cacheable(value = "aiQuestionnaire", key = "#source.toString()")
|
|
|
public List<BizQuestionDTO> generateAi(BizQuestionGroupAiDTO source) throws NoApiKeyException, InputRequiredException {
|
|
|
Generation gen = new Generation();
|
|
|
Message systemMsg = Message.builder()
|
|
|
@@ -295,9 +297,7 @@ public class BizQuestionGroupServiceImpl implements IBizQuestionGroupService {
|
|
|
.content("你是一名专业的医疗问卷设计师,专注于手术患者管理。")
|
|
|
.build();
|
|
|
//使用缓存模版
|
|
|
- String prompt = promptTemplate;
|
|
|
-
|
|
|
- prompt = promptTemplate.replace("${name}", source.getName())
|
|
|
+ String prompt = promptTemplate.replace("${name}", source.getName())
|
|
|
.replace("${type}", QuestionGroupTypeEnums.AFTER.equals(source.getType()) ? "术前问卷" : "术后问卷")
|
|
|
.replace("${frequency}", String.valueOf(source.getFrequency()))
|
|
|
.replace("${interval}", String.valueOf(source.getInterval()));
|