Package sk.iway.iwcm.components.ai.rest
Class AiAssistantsService
java.lang.Object
sk.iway.iwcm.components.ai.rest.AiAssistantsService
Service for AI Assistants management / datatables, editor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic StringexecutePromptMacro(String instructions, InputDataDTO inputData, Map<Integer, String> replacedIncludes) Execute prompt macro, replaces {inputText}, {userPrompt} and adds rule for INCLUDE protected tokens if includes are usedstatic List<AssistantDefinitionEntity>getAssistantAndFieldFrom(String fieldTo, DataTableColumn column, String srcClass) static List<AssistantDefinitionEntity>Get assistants from the database, it is heavily used for generating AI button in fields, so it is cached for 60 minutesbooleangetAssistantStatus(String providerId) getClassOptions(String term) getFieldOptions(String term, String className) getProviderFields(String provider, String action, Prop prop) voidprotected static booleanisMatching(String text, String fieldName) voidprepareBeforeSave(AssistantDefinitionEntity assistantEnity, Prop prop)
-
Field Details
-
EMPTY_VALUE
- See Also:
-
-
Constructor Details
-
AiAssistantsService
-
-
Method Details
-
getAssistantAndFieldFrom
public static List<AssistantDefinitionEntity> getAssistantAndFieldFrom(String fieldTo, DataTableColumn column, String srcClass) - Parameters:
fieldTo-srcClass-- Returns:
- Pair<String, String> where -> <aiAssistantName, fromField>
-
getFieldOptions
-
getClassOptions
-
prepareBeforeSave
-
getProviderSpecificOptions
public void getProviderSpecificOptions(DatatablePageImpl<AssistantDefinitionEntity> page, Prop prop) -
getProviderFields
-
getAssistantStatus
-
isMatching
-
getAssistantsFromDB
public static List<AssistantDefinitionEntity> getAssistantsFromDB(AssistantDefinitionRepository repo) Get assistants from the database, it is heavily used for generating AI button in fields, so it is cached for 60 minutes- Parameters:
repo-- Returns:
-
clearCache
public static void clearCache() -
executePromptMacro
public static String executePromptMacro(String instructions, InputDataDTO inputData, Map<Integer, String> replacedIncludes) Execute prompt macro, replaces {inputText}, {userPrompt} and adds rule for INCLUDE protected tokens if includes are used- Parameters:
instructions-inputData-replacedIncludes-- Returns:
-