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 org.springframework.core.io.Resource; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; 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; @HttpExchange public interface LangChainChatService { /** * 创建知识库 * @param createBaseDTO 知识库对象 * @return 结果 */ @PostExchange(url = "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 = "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 = "delete_docs", contentType = MediaType.APPLICATION_JSON_VALUE) LangChainChatRes deleteFile(@RequestBody DeleteFileDTO deleteFileDTO); @GetExchange(url = "list_files") LangChainChatRes queryFileList(@RequestParam String knowledge_base_name); }