mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-31 19:52:54 +08:00
add knowledge support
This commit is contained in:
@ -454,7 +454,7 @@ public class ChatController {
|
||||
* @return
|
||||
*/
|
||||
private String buildPrompt(ChatQueryRequest queryRequest) {
|
||||
if (PromptType.QUESTION_ANSWERING.getCode().equals(queryRequest.getPromptType())) {
|
||||
if (PromptType.TEXT_GENERATION.getCode().equals(queryRequest.getPromptType())) {
|
||||
return queryRequest.getMessage();
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import ai.chat2db.server.tools.common.exception.ParamBusinessException;
|
||||
import ai.chat2db.server.web.api.aspect.ConnectionInfoAspect;
|
||||
import ai.chat2db.server.web.api.controller.ai.DocParser.AbstractParser;
|
||||
import ai.chat2db.server.web.api.controller.ai.DocParser.PdfParse;
|
||||
import ai.chat2db.server.web.api.controller.ai.enums.PromptType;
|
||||
import ai.chat2db.server.web.api.controller.ai.fastchat.embeddings.FastChatEmbeddingResponse;
|
||||
import ai.chat2db.server.web.api.controller.ai.request.ChatQueryRequest;
|
||||
import ai.chat2db.server.web.api.http.GatewayClientService;
|
||||
@ -102,7 +103,7 @@ public class KnowledgeController extends ChatController {
|
||||
|
||||
// search embedding
|
||||
DataResult<KnowledgeResponse> result = gatewayClientService.knowledgeVectorSearch(contentVector);
|
||||
|
||||
queryRequest.setPromptType(PromptType.TEXT_GENERATION.getCode());
|
||||
String prompt = queryRequest.getMessage();
|
||||
if (CollectionUtils.isNotEmpty(result.getData().getKnowledgeList())) {
|
||||
List<String> contents = new ArrayList<>();
|
||||
|
@ -35,9 +35,9 @@ public enum PromptType implements BaseEnum<String> {
|
||||
SQL_2_SQL("进行SQL转换"),
|
||||
|
||||
/**
|
||||
* knowledge qa
|
||||
* text generation
|
||||
*/
|
||||
QUESTION_ANSWERING("问答"),
|
||||
TEXT_GENERATION("文本生成"),
|
||||
;
|
||||
|
||||
final String description;
|
||||
|
Reference in New Issue
Block a user