AI rule node: improve text search to be based on provider and model as well

This commit is contained in:
Dmytro Skarzhynets 2025-06-09 17:33:04 +03:00
parent 109c874861
commit 5e5a7c9e51
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF
2 changed files with 5 additions and 2 deletions

View File

@ -90,7 +90,7 @@ public class ControllerConstants {
protected static final String TENANT_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the tenant profile name."; protected static final String TENANT_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the tenant profile name.";
protected static final String RULE_CHAIN_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the rule chain name."; protected static final String RULE_CHAIN_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the rule chain name.";
protected static final String DEVICE_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the device profile name."; protected static final String DEVICE_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the device profile name.";
protected static final String AI_SETTINGS_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the AI settings name"; protected static final String AI_SETTINGS_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the AI settings name, provider and model.";
protected static final String ASSET_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the asset profile name."; protected static final String ASSET_PROFILE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the asset profile name.";
protected static final String CUSTOMER_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the customer title."; protected static final String CUSTOMER_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'substring' filter based on the customer title.";

View File

@ -33,7 +33,10 @@ public interface AiSettingsRepository extends JpaRepository<AiSettingsEntity, UU
@Query("SELECT ai " + @Query("SELECT ai " +
"FROM AiSettingsEntity ai " + "FROM AiSettingsEntity ai " +
"WHERE ai.tenantId = :tenantId " + "WHERE ai.tenantId = :tenantId " +
"AND (:textSearch IS NULL OR ilike(ai.name, CONCAT('%', :textSearch, '%')) = true)") "AND (:textSearch IS NULL " +
"OR ilike(ai.name, CONCAT('%', :textSearch, '%')) = true " +
"OR ilike(ai.provider, CONCAT('%', :textSearch, '%')) = true " +
"OR ilike(ai.model, CONCAT('%', :textSearch, '%')) = true)")
Page<AiSettingsEntity> findByTenantId(@Param("tenantId") UUID tenantId, @Param("textSearch") String textSearch, Pageable pageable); Page<AiSettingsEntity> findByTenantId(@Param("tenantId") UUID tenantId, @Param("textSearch") String textSearch, Pageable pageable);
Optional<AiSettingsEntity> findByTenantIdAndId(UUID tenantId, UUID id); Optional<AiSettingsEntity> findByTenantIdAndId(UUID tenantId, UUID id);