made ai endpoint url configurable and renamed bean to ai action

This commit is contained in:
SatyamSah5
2025-09-10 10:26:40 +05:30
parent 590d455a7e
commit 92eb9ee90e
3 changed files with 13 additions and 3 deletions

View File

@@ -47,8 +47,9 @@ import org.alfresco.service.namespace.QName;
public class AISummaryActionExecuter extends ActionExecuterAbstractBase public class AISummaryActionExecuter extends ActionExecuterAbstractBase
{ {
public static final String NAME = "ai-summary"; public static final String NAME = "ai-action";
private static final String TARGET_MIMETYPE = "text/plain"; private static final String TARGET_MIMETYPE = "text/plain";
private String AI_ENDPOINT_URL;
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
private ContentService contentService; private ContentService contentService;
@@ -81,6 +82,11 @@ public class AISummaryActionExecuter extends ActionExecuterAbstractBase
this.converter = converter; this.converter = converter;
} }
public void setAI_ENDPOINT_URL(String aiUrl)
{
this.AI_ENDPOINT_URL = aiUrl;
}
@Override @Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{ {
@@ -169,7 +175,7 @@ public class AISummaryActionExecuter extends ActionExecuterAbstractBase
+ "}"; + "}";
// Create connection // Create connection
URL url = new URL("http://alfresco-llm-ai:5000/api/respond"); URL url = new URL(AI_ENDPOINT_URL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST"); conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Content-Type", "application/json");

View File

@@ -449,12 +449,13 @@
</property> </property>
</bean> </bean>
<bean id="ai-summary" class="org.alfresco.repo.action.executer.AISummaryActionExecuter" parent="action-executer"> <bean id="ai-action" class="org.alfresco.repo.action.executer.AISummaryActionExecuter" parent="action-executer">
<property name="dictionaryService" ref="dictionaryService" /> <property name="dictionaryService" ref="dictionaryService" />
<property name="contentService" ref="ContentService" /> <property name="contentService" ref="ContentService" />
<property name="nodeService" ref="NodeService" /> <property name="nodeService" ref="NodeService" />
<property name="synchronousTransformClient" ref="synchronousTransformClient" /> <property name="synchronousTransformClient" ref="synchronousTransformClient" />
<property name="converter" ref="transformOptionsConverter" /> <property name="converter" ref="transformOptionsConverter" />
<property name="AI_ENDPOINT_URL" value="${ai.endpoint.url}" />
<property name="applicableTypes"> <property name="applicableTypes">
<list> <list>
<value>{http://www.alfresco.org/model/content/1.0}content</value> <value>{http://www.alfresco.org/model/content/1.0}content</value>

View File

@@ -1045,6 +1045,9 @@ content.transformer.retryOn.different.mimetype=true
transformer.debug.entries=0 transformer.debug.entries=0
transformer.log.entries=50 transformer.log.entries=50
# AI Endpoint
ai.endpoint.url=http://alfresco-llm-ai:5000/api/respond
# #
# Lock timeout configuration # Lock timeout configuration
# #