Class SlingCaConfigPluginImpl
- java.lang.Object
-
- com.composum.ai.backend.slingbase.impl.SlingCaConfigPluginImpl
-
- All Implemented Interfaces:
AIConfigurationPlugin
public class SlingCaConfigPluginImpl extends Object implements AIConfigurationPlugin
Reads configurations using Sling context aware configuration. Higher precedence thanOsgiAIConfigurationPluginImpl
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SlingCaConfigPluginImpl.Config
-
Constructor Summary
Constructors Constructor Description SlingCaConfigPluginImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(SlingCaConfigPluginImpl.Config config)
List<GPTPermissionConfiguration>
allowedServices(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull String contentPath)
Determines the allowed services based on the provided request, content path, and editor URL.void
deactivate()
GPTConfiguration
getGPTConfiguration(org.apache.sling.api.resource.ResourceResolver resourceResolver, String contentPath)
Reads the GPTConfiguration from sling context aware configurations.GPTPromptLibrary
getGPTPromptLibraryPaths(@NotNull org.apache.sling.api.SlingHttpServletRequest request, String contentPath)
Reads the GPTPromptLibrary from sling context aware configurations or OSGI configurations, falling back to default values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.composum.ai.backend.slingbase.AIConfigurationPlugin
getGPTConfigurationMap, getGPTPromptLibraryPathsDefault
-
-
-
-
Method Detail
-
allowedServices
@Nullable public List<GPTPermissionConfiguration> allowedServices(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull String contentPath)
Description copied from interface:AIConfigurationPlugin
Determines the allowed services based on the provided request, content path, and editor URL.- Specified by:
allowedServices
in interfaceAIConfigurationPlugin
- Parameters:
request
- The SlingHttpServletRequest representing the current request.contentPath
- The path of the content being edited.- Returns:
- A set of allowed services; null if this plugin doesn't implement this method.
- See Also:
GPTPermissionInfo.SERVICE_CATEGORIZE
,GPTPermissionInfo.SERVICE_CREATE
,GPTPermissionInfo.SERVICE_SIDEPANEL
,GPTPermissionInfo.SERVICE_TRANSLATE
-
getGPTConfiguration
@Nullable public GPTConfiguration getGPTConfiguration(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull String contentPath) throws IllegalArgumentException
Description copied from interface:AIConfigurationPlugin
Reads the GPTConfiguration from sling context aware configurations.- Specified by:
getGPTConfiguration
in interfaceAIConfigurationPlugin
- Parameters:
resourceResolver
- the resource resolvercontentPath
- if that's given we read the configuration for this path, otherwise we take the requests path, as long as it starts with /content/- Returns:
- if the configuration could be determined we return it, otherwise null.
- Throws:
IllegalArgumentException
- if none of the paths is a /content/ path.
-
getGPTPromptLibraryPaths
@Nullable public GPTPromptLibrary getGPTPromptLibraryPaths(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @Nullable String contentPath)
Description copied from interface:AIConfigurationPlugin
Reads the GPTPromptLibrary from sling context aware configurations or OSGI configurations, falling back to default values.- Specified by:
getGPTPromptLibraryPaths
in interfaceAIConfigurationPlugin
- Parameters:
request
- the requestcontentPath
- if that's given we read the configuration for this path, otherwise we take the requests path, as long as it starts with /content/
-
activate
public void activate(SlingCaConfigPluginImpl.Config config)
-
deactivate
public void deactivate()
-
-