@PostMapping("/embeddings")
    @CrossOrigin
    public ActionResult embeddings(MultipartFile file, HttpServletRequest request)
        throws Exception {
        AbstractParser pdfParse = new PdfParse();
        List<String> sentenceList = pdfParse.parse(file.getInputStream());

        List<Integer> contentWordCount = new ArrayList<>();
        List<List<BigDecimal>> contentVector = new ArrayList<>();
        for(String str : sentenceList){
            contentWordCount.add(str.length());

            // request embedding
            FastChatEmbeddingResponse response = distributeAIEmbedding(str);
            if(response == null){
                continue;
            }
            contentVector.add(response.getData().get(0).getEmbedding());
        }

        KnowledgeRequest knowledgeRequest = new KnowledgeRequest();
        knowledgeRequest.setContentVector(contentVector);
        knowledgeRequest.setSentenceList(sentenceList);
        // save knowledge embedding
        ActionResult actionResult = gatewayClientService.knowledgeVectorSave(knowledgeRequest);
        return actionResult;
    }
save knowledge from pdf file

@param file
@return
@throws IOException
chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/KnowledgeController.java