You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fu-hsi-service/src/main/java/com/supervision/chat/client/LangChainChatService.java

77 lines
3.3 KiB
Java

package com.supervision.chat.client;
import com.supervision.chat.client.dto.CreateBaseDTO;
import com.supervision.chat.client.dto.DeleteFileDTO;
import com.supervision.chat.client.dto.LangChainChatRes;
import com.supervision.chat.client.dto.chat.ChatReqDTO;
import com.supervision.chat.client.dto.chat.ChatResDTO;
import com.supervision.common.domain.R;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.List;
@HttpExchange
public interface LangChainChatService {
/**
* 创建知识库
* @param createBaseDTO 知识库对象
* @return 结果
*/
@PostExchange(url = "/knowledge_base/create_knowledge_base", contentType = MediaType.APPLICATION_JSON_VALUE)
LangChainChatRes createBase(@RequestBody CreateBaseDTO createBaseDTO);
/**
* 上传文档接口
* @param knowledge_base_name 需要上传的知识库库名
* @param files 文件,multipartFile
* @param text_splitter_type 问讯笔录
* @param to_vector_store true 固定值
* @param override false 固定值
* @param not_refresh_vs_cache false 固定值
* @param chunk_size 250 固定值
* @param chunk_overlap 50 固定值
* @param zh_title_enhance false 固定值
* @param docs {"test.txt":[{"page_content":"custom doc","metadata":{},"type":"Document"}]} 固定值
* @return 调用的结果
*/
@PostExchange(url = "/knowledge_base/upload_docs", contentType = MediaType.MULTIPART_FORM_DATA_VALUE)
LangChainChatRes uploadFile(@RequestPart String knowledge_base_name,
@RequestPart MultipartFile files,
@RequestPart String text_splitter_type,
@RequestPart Boolean to_vector_store,
@RequestPart Boolean override,
@RequestPart Boolean not_refresh_vs_cache,
@RequestPart Integer chunk_size,
@RequestPart Integer chunk_overlap,
@RequestPart Boolean zh_title_enhance,
@RequestPart String docs);
/**
* 删除文件
* @param deleteFileDTO 删除的对象
* @return 返回结果
*/
@PostExchange(url = "/knowledge_base/delete_docs", contentType = MediaType.APPLICATION_JSON_VALUE)
LangChainChatRes<Object> deleteFile(@RequestBody DeleteFileDTO deleteFileDTO);
@GetExchange(url = "/knowledge_base/list_files")
LangChainChatRes<List<String>> queryFileList(@RequestParam String knowledge_base_name);
@PostExchange(url = "/knowledge_base//delete_knowledge_base", contentType = MediaType.APPLICATION_JSON_VALUE)
LangChainChatRes<Object> deleteBase(@RequestBody String knowledge_base_name);
@PostExchange(url = "/chat/knowledge_base_chat", contentType = MediaType.APPLICATION_JSON_VALUE)
ChatResDTO chat(@RequestBody ChatReqDTO chatReq);
}