Package sk.iway.iwcm.rag.rest
Class EmbeddingChunkRestController
java.lang.Object
sk.iway.iwcm.system.datatable.DatatableRestControllerV2<EmbeddingChunkEntity,Long>
sk.iway.iwcm.rag.rest.EmbeddingChunkRestController
@RestController
@RequestMapping("/admin/rest/settings/embedding-chunks")
@PreAuthorize("@WebjetSecurityService.hasPermission(\'embeddingChunks\')")
public class EmbeddingChunkRestController
extends DatatableRestControllerV2<EmbeddingChunkEntity,Long>
REST controller for managing RAG embedding chunks via the admin datatable interface.
Provides CRUD operations, document indexing actions, and statistics endpoints.
Requires 'embeddingChunks' permission.
-
Constructor Summary
ConstructorsConstructorDescriptionEmbeddingChunkRestController(EmbeddingChunkRepository chunkRepository, IndexQueueService indexQueueService, PgVectorStore vectorStore, RagEmbeddingStatService ragEmbeddingStatService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<EmbeddingChunkEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Doplnenie pecialneho vyhladavanie, interne vola: - addSpecSearchUserFullName(searchUserFullName, "userId", predicates, root, builder);org.springframework.data.domain.Page<EmbeddingChunkEntity>findByColumns(Map<String, String> params, org.springframework.data.domain.Pageable pageable, EmbeddingChunkEntity search) Vyhlada zaznamy v databaze podla zadanych kriterii (serverovo strankovane a sortovane).org.springframework.data.domain.Page<EmbeddingChunkEntity>getAllItems(org.springframework.data.domain.Pageable pageable) Ziska z databazy vsetky zaznamygetDocumentStat(int rootDir, boolean includeSubfolders, String action) Get statistics about document indexing status for the specified folder.voidDoplni pri volani getAllItems options polozky pre vyberove poliaintperformDocumentAction(int rootDir, boolean includeSubfolders, String action) Perform an indexing or deletion action on all documents in the specified folder.processFromEntity(EmbeddingChunkEntity entity, ProcessItemAction action) Vykona upravy v entite pred vratenim cez REST rozhranie napr.Methods inherited from class sk.iway.iwcm.system.datatable.DatatableRestControllerV2
action, add, addNotify, addNotify, addSpecSort, afterDelete, afterDuplicate, afterImportChunk, afterSave, allowGeneratedIdOnCreate, beforeDelete, beforeDuplicate, beforeDuplicate, beforeSave, checkAccessAllowed, checkItemPerms, checkRowReorderScope, copyEntityIntoOriginal, delete, deleteItem, edit, editItem, findItemBy, getAll, getAllItemsIncludeSpecSearch, getCleanKey, getCleanValue, getCustomFieldsSearchDto, getDomainId, getImportedColumns, getImportMode, getInvalidImportedRows, getLastImportedRow, getOne, getOneItem, getParamsMap, getProp, getRepo, getRequest, getSearchConditions, getSearchProperties, getSum, getUpdateByColumn, getUser, handleEditor, hasNotify, initBinder, insertItem, isDuplicate, isExporting, isForceReload, isImporting, isSkipWrongData, jpaToBoolean, preImportDataEdit, processAction, processFromEntity, processFromEntity, processFromEntity, processToEntity, rowReorder, searchItem, setForceReload, setRedirect, setRequest, setValidator, sumItems, throwConstraintViolation, throwError, throwError, throwError, throwError, throwError, throwError, validateEditor, validateEditorForCustomFields
-
Constructor Details
-
EmbeddingChunkRestController
@Autowired public EmbeddingChunkRestController(EmbeddingChunkRepository chunkRepository, IndexQueueService indexQueueService, PgVectorStore vectorStore, RagEmbeddingStatService ragEmbeddingStatService)
-
-
Method Details
-
getAllItems
public org.springframework.data.domain.Page<EmbeddingChunkEntity> getAllItems(org.springframework.data.domain.Pageable pageable) Description copied from class:DatatableRestControllerV2Ziska z databazy vsetky zaznamy- Overrides:
getAllItemsin classDatatableRestControllerV2<EmbeddingChunkEntity,Long> - Returns:
-
findByColumns
public org.springframework.data.domain.Page<EmbeddingChunkEntity> findByColumns(Map<String, String> params, org.springframework.data.domain.Pageable pageable, EmbeddingChunkEntity search) Description copied from class:DatatableRestControllerV2Vyhlada zaznamy v databaze podla zadanych kriterii (serverovo strankovane a sortovane). Pouziva EampleMatcher, v Beane NESMU BYT pouzite primitivne typy (vsetko musia byt Objekty)- Overrides:
findByColumnsin classDatatableRestControllerV2<EmbeddingChunkEntity,Long>
-
addSpecSearch
public void addSpecSearch(Map<String, String> params, List<jakarta.persistence.criteria.Predicate> predicates, jakarta.persistence.criteria.Root<EmbeddingChunkEntity> root, jakarta.persistence.criteria.CriteriaBuilder builder) Description copied from class:DatatableRestControllerV2Doplnenie pecialneho vyhladavanie, interne vola: - addSpecSearchUserFullName(searchUserFullName, "userId", predicates, root, builder);- Overrides:
addSpecSearchin classDatatableRestControllerV2<EmbeddingChunkEntity,Long>
-
getOptions
Description copied from class:DatatableRestControllerV2Doplni pri volani getAllItems options polozky pre vyberove polia- Overrides:
getOptionsin classDatatableRestControllerV2<EmbeddingChunkEntity,Long>
-
processFromEntity
public EmbeddingChunkEntity processFromEntity(EmbeddingChunkEntity entity, ProcessItemAction action) Description copied from class:DatatableRestControllerV2Vykona upravy v entite pred vratenim cez REST rozhranie napr. vyvola potrebne editorFields nastavenia (from entity to editorFields)- Overrides:
processFromEntityin classDatatableRestControllerV2<EmbeddingChunkEntity,Long> action- - typ zmeny - create,edit,getall...
-
getCurrentEmbeddingConfiguration
-
performDocumentAction
@PostMapping("/document-action") public int performDocumentAction(@RequestParam("rootDir") int rootDir, @RequestParam("includeSubfolders") boolean includeSubfolders, @RequestParam("action") String action) Perform an indexing or deletion action on all documents in the specified folder. Adds matched document IDs to the RAG indexing queue.- Parameters:
rootDir- the root directory group ID (-1 for all domain documents)includeSubfolders- whether to include documents from subfoldersaction- the action to perform ("INDEX" or "DELETE")- Returns:
- the number of documents queued, or -1 on error
-
getDocumentStat
@GetMapping("/document-stat") public Map<String,Object> getDocumentStat(@RequestParam("rootDir") int rootDir, @RequestParam("includeSubfolders") boolean includeSubfolders, @RequestParam("action") String action) Get statistics about document indexing status for the specified folder. Returns total groups, total documents, already indexed count, and currently queued count.- Parameters:
rootDir- the root directory group ID (-1 for all domain documents)includeSubfolders- whether to include documents from subfoldersaction- the action to check queue status for- Returns:
- map with keys: totalGroups, totalDocuments, indexedDocuments, queuedDocuments
-