Commit 5751be45 authored by zhouwei's avatar zhouwei

紧急信息周报汇总

parent 8d94fd24
......@@ -48,7 +48,7 @@ public class AIController {
}
@PostMapping("/urgent/notice/week/summary")
public Response<AIResponse<String>> extractUrgentNoticeWeekSummary(@RequestBody AIRequestDTO AIRequestDTO) {
public Response<AIResponse<JSONObject>> extractUrgentNoticeWeekSummary(@RequestBody AIRequestDTO AIRequestDTO) {
return Response.SUCCESS(aiService.extractUrgentNoticeWeekSummary(AIRequestDTO));
}
......
......@@ -26,5 +26,5 @@ public interface AIService {
//提取紧急通知概要信息
AIResponse<JSONObject> extractUrgentNoticeSummary(AIRequestDTO aiRequestDTO);
AIResponse<String> extractUrgentNoticeWeekSummary(AIRequestDTO aiRequestDTO);
AIResponse<JSONObject> extractUrgentNoticeWeekSummary(AIRequestDTO aiRequestDTO);
}
......@@ -441,7 +441,7 @@ public class AIServiceImpl implements AIService {
}
@Override
public AIResponse<String> extractUrgentNoticeWeekSummary(AIRequestDTO aiRequestDTO) {
public AIResponse<JSONObject> extractUrgentNoticeWeekSummary(AIRequestDTO aiRequestDTO) {
ChatInputData chatInputData = new ChatInputData();
String systemPrompt = "```xml\n" +
"<instruction>\n" +
......@@ -488,13 +488,15 @@ public class AIServiceImpl implements AIService {
ChatCompletionResponse chatCompletionResponse = aiRequest(chatInputData, apiKey);
if (CollectionUtils.isNotEmpty(chatCompletionResponse.getChoices())) {
AIResponse<String> aiResponse = new AIResponse<>();
AIResponse<JSONObject> aiResponse = new AIResponse<>();
String content = chatCompletionResponse.getChoices().get(0).getMessage().getContent();
aiResponse.setFinish_reason(chatCompletionResponse.getChoices().get(0).getFinish_reason());
if(StringUtils.isNotEmpty(content)){
ResultVO<String> outputs = new ResultVO<>();
List<String> contents = new ArrayList<>();
contents.add(content);
ResultVO<JSONObject> outputs = new ResultVO<>();
List<JSONObject> contents = new ArrayList<>();
JSONObject jsonObject = new JSONObject();
jsonObject.put("summary", content);
contents.add(jsonObject);
outputs.setResult(contents);
aiResponse.setOutputs(outputs);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment