mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-13 21:27:19 +08:00
Long libraryId
This commit is contained in:
@@ -85,7 +85,7 @@ public class LibraryController {
|
||||
Long libraryDocId =
|
||||
ragService.createLibraryDocBy(
|
||||
Long.valueOf(libraryId), objectName, multipartFile.getOriginalFilename());
|
||||
ragService.embeddingAndCreateDocSegment(libraryDocId, objectName);
|
||||
ragService.embeddingAndCreateDocSegment(Long.valueOf(libraryId), libraryDocId, objectName);
|
||||
return objectName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class RagService {
|
||||
}
|
||||
|
||||
@Async
|
||||
public void embeddingAndCreateDocSegment(Long libraryDocId, String objectName) {
|
||||
public void embeddingAndCreateDocSegment(Long libraryId, Long libraryDocId, String objectName) {
|
||||
Document document =
|
||||
amazonS3DocumentLoader.loadDocument(
|
||||
minIoConfig.getDefaultBucket(), objectName, new ApacheTikaDocumentParser());
|
||||
@@ -123,6 +123,7 @@ public class RagService {
|
||||
Response<Embedding> embed = zhipuEmbeddingModel.embed(textSegment);
|
||||
Integer tokenUsage = embed.tokenUsage().totalTokenCount();
|
||||
Embedding vector = embed.content();
|
||||
textSegment.metadata().put("libraryId", libraryId);
|
||||
String embeddingId = zhiPuLibraryEmbeddingStore.add(vector, textSegment);
|
||||
LibraryDocSegment libraryDocSegment = new LibraryDocSegment();
|
||||
libraryDocSegment.setEmbeddingId(embeddingId);
|
||||
|
||||
Reference in New Issue
Block a user