Commit 30197cef authored by yangyw's avatar yangyw

feature: 增加DIFY扩展判断助手类型

parent edd3398c
......@@ -224,4 +224,21 @@ public class AiPlatformExtensionService {
private void updateKbHitStat(List<VectorSegment> segments) {
kbService.updateHotQuestion(CollUtil.map(segments, VectorSegment::getId, true));
}
/**
* 判断是否可以使用外部知识
* @param assistantId
* @return
*/
public String canAnswerByLlm(Integer assistantId) {
if (ObjectUtil.isNotNull(assistantId)) {
QaAssistantResponseModel qaAssistantResponseModel = chatCompletionService.qaAssistantDetail(assistantId);
if (ObjectUtil.isNotNull(qaAssistantResponseModel)) {
if (ObjectUtil.equals(qaAssistantResponseModel.getSearchScope(), 1)) {
return "true";
}
}
}
return "false";
}
}
......@@ -4,10 +4,7 @@ import cn.breeze.elleai.application.service.AiPlatformExtensionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author yangyw
......@@ -51,4 +48,11 @@ public class AiPlatformExtensionController {
return extensionService.vectorSearchWithRerank(query, assistantId, topK, score, rerankTopK, rerankScore);
}
@Operation(summary = "判断是否可以使用外部知识")
@GetMapping(value = "/can_answer_by_llm")
public String canAnswerByLlm(@RequestParam(value = "assistant_id", required = false, defaultValue = "0") Integer assistantId) {
return extensionService.canAnswerByLlm(assistantId);
}
}
......@@ -37,6 +37,11 @@ public class QaAssistantResponseModel implements Serializable {
*/
private String visibleRoleIds;
/**
* 检索范围(0内部知识库 1全网)
*/
private Integer searchScope;
/**
* 状态(0禁用 1启用)
*/
......
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