Skip to content
Merged

0.3.9 #2244

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d7a21bb
Update TurWCProcess.java
alegauss Nov 27, 2024
1dc9547
- WC: Starting Points and Wildcard
alegauss Nov 27, 2024
9d15e22
- WC indexedQueue
alegauss Nov 27, 2024
880fa83
- WEM: Code Smells
alegauss Nov 28, 2024
c1aeea5
Update TurWCProcess.java
alegauss Nov 28, 2024
1ec072c
Bump the java group with 4 updates
dependabot[bot] Dec 2, 2024
3455fae
Bump the react group in /turing-react with 3 updates
dependabot[bot] Dec 2, 2024
b6c1501
Merge pull request #2230 from openturing/dependabot/npm_and_yarn/turi…
alegauss Dec 2, 2024
08a83e2
Merge pull request #2229 from openturing/dependabot/maven/0.3.9/java-…
alegauss Dec 2, 2024
885436f
- AEM: Fixed using cq:tags with CustomClass.
alegauss Dec 4, 2024
69e5921
Merge branch '0.3.9' of https://github.com/openturing/turing into 0.3.9
alegauss Dec 4, 2024
dd7d008
- TurCommonsUtils.getKeyValueFromColon and AEM - cq:template
alegauss Dec 4, 2024
161dfc8
- Moved new files from sprinklr-app plugins to sprinklr-java-sdk plugins
gLeirbag Dec 5, 2024
604a419
Bump the java group with 2 updates
dependabot[bot] Dec 9, 2024
c918d0c
Bump the react group in /turing-react with 8 updates
dependabot[bot] Dec 9, 2024
ddf7ef5
Merge pull request #2234 from openturing/dependabot/npm_and_yarn/turi…
alegauss Dec 9, 2024
e2ab67d
Merge pull request #2233 from openturing/dependabot/maven/0.3.9/java-…
alegauss Dec 9, 2024
dc45ad9
- Created Plugin for key value transform, bugfixes
gLeirbag Dec 11, 2024
b10037b
- Turing Connector Initial Commit
alegauss Dec 11, 2024
31d9ff9
- WC Plugin
alegauss Dec 11, 2024
114cbdf
Merge remote-tracking branch 'origin/feature/sprinklr/tags-mapping' i…
alegauss Dec 11, 2024
fc36320
- Sprinklr Code Smells
alegauss Dec 11, 2024
8be0482
- Sprinklr: Move some classes between modules
alegauss Dec 11, 2024
6260ed8
- Sprinklr: Tag Mapping
alegauss Dec 11, 2024
94423c4
- Sprinklr: Renew Token
alegauss Dec 11, 2024
a584452
Sprinklr KV Transf - getKey()
alegauss Dec 12, 2024
282a4b6
Bump the java group with 4 updates
dependabot[bot] Dec 16, 2024
f43b1e1
Bump the react group in /turing-react with 4 updates
dependabot[bot] Dec 16, 2024
3704650
Merge pull request #2240 from openturing/dependabot/maven/0.3.9/java-…
alegauss Dec 16, 2024
7f2a898
Merge pull request #2241 from openturing/dependabot/npm_and_yarn/turi…
alegauss Dec 16, 2024
f86fc88
- Exact Match
alegauss Dec 16, 2024
15c095a
Merge branch '0.3.9' of https://github.com/openturing/turing into 0.3.9
alegauss Dec 16, 2024
b10a163
Update sn-site-ui-page.component.html
alegauss Dec 17, 2024
ff6e5a9
Update wc-plugin without extra libs
alegauss Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.1</version>
<version>3.11.2</version>
<configuration>
<!-- Default configuration for all reports -->
<noqualifier>all</noqualifier>
Expand Down Expand Up @@ -189,6 +189,11 @@
<artifactId>turing-java-sdk</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.viglet.turing</groupId>
<artifactId>turing-commons</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand Down Expand Up @@ -237,17 +242,17 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.47.0.0</version>
<version>3.47.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.24.2</version>
<version>2.24.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.1</version>
<version>2.18.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
Expand All @@ -262,7 +267,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.18.1</version>
<version>1.18.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
2 changes: 1 addition & 1 deletion turing-aem/aem-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.26</version>
<version>2.2.27</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion turing-aem/aem-cli-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<jackson.version>2.18.1</jackson.version>
<jackson.version>2.18.2</jackson.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion turing-aem/aem-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.18.1</version>
<version>2.18.2</version>
</dependency>
<dependency>
<groupId>com.viglet.turing</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
public class TurAemAttrProcess {
public static final String JCR_TITLE = "jcr:title";
public static final String CQ_TAGS = "cq:tags";
public static final String TAG_SEPARATOR = ":";
public static final String DEFAULT = "default";
public static final String TEXT = "text";
public static final String JCR = "jcr:";
Expand Down Expand Up @@ -233,7 +232,7 @@ public TurCmsTargetAttrValueMap process(TurCmsContext context,
attributeByClass(context, turAemSourceContext) :
attributeByCMS(context);
turCmsTargetAttrValueMap.merge(generateNewAttributesFromCqTags(context,
turAemSourceContext, turSNAttributeSpecList));
turAemSourceContext, turSNAttributeSpecList, turCmsTargetAttrValueMap));
return turCmsTargetAttrValueMap;
}

Expand All @@ -252,29 +251,58 @@ private TurCmsTargetAttrValueMap attributeByCMS(TurCmsContext context) {

private TurCmsTargetAttrValueMap generateNewAttributesFromCqTags(TurCmsContext context,
TurAemSourceContext turAemSourceContext,
List<TurSNAttributeSpec> turSNAttributeSpecList) {
List<TurSNAttributeSpec> turSNAttributeSpecList,
TurCmsTargetAttrValueMap turCmsTargetAttrValueMapFromClass) {
TurCmsTargetAttrValueMap turCmsTargetAttrValueMap = new TurCmsTargetAttrValueMap();
String attributeName = context.getTurCmsSourceAttr().getName();
Object jcrProperty = getJcrProperty(context, attributeName);
if (CQ_TAGS.equals(attributeName)) {
Optional.ofNullable((JSONArray) jcrProperty).ifPresent(property ->
property.forEach(tag -> {
String[] tagSplit = tag.toString().split(TAG_SEPARATOR);
if (tagSplit.length >= 2) {
Optional.ofNullable(tagSplit[0]).ifPresent(facet -> {
turSNAttributeSpecList.add(setTagFacet(turAemSourceContext, facet));
Optional.ofNullable(tagSplit[1]).ifPresent(value ->
turCmsTargetAttrValueMap.addWithSingleValue(facet,
addTagToAttrValueList(context, turAemSourceContext, facet, value), false)
);
});
}
})
);
String targetName = context.getTurCmsTargetAttr().getName();
if (turCmsTargetAttrValueMapFromClass.containsKey(targetName)) {
processTagsFromTargetAttr(context, turAemSourceContext, turSNAttributeSpecList,
turCmsTargetAttrValueMapFromClass, targetName, turCmsTargetAttrValueMap);
} else {
processTagsFromSourceAttr(context, turAemSourceContext, turSNAttributeSpecList, attributeName,
turCmsTargetAttrValueMap);
}
}
return turCmsTargetAttrValueMap;
}

private static void processTagsFromSourceAttr(TurCmsContext context, TurAemSourceContext turAemSourceContext,
List<TurSNAttributeSpec> turSNAttributeSpecList,
String attributeName,
TurCmsTargetAttrValueMap turCmsTargetAttrValueMap) {
Optional.ofNullable((JSONArray) getJcrProperty(context, attributeName))
.ifPresent(property ->
property.forEach(tag ->
formatTags(context, turAemSourceContext, turSNAttributeSpecList,
tag.toString(), turCmsTargetAttrValueMap))
);
}

private static void processTagsFromTargetAttr(TurCmsContext context, TurAemSourceContext turAemSourceContext,
List<TurSNAttributeSpec> turSNAttributeSpecList,
TurCmsTargetAttrValueMap turCmsTargetAttrValueMapFromClass,
String targetName,
TurCmsTargetAttrValueMap turCmsTargetAttrValueMap) {
turCmsTargetAttrValueMapFromClass.get(targetName).forEach(tag ->
formatTags(context, turAemSourceContext, turSNAttributeSpecList,
tag, turCmsTargetAttrValueMap));
}

private static void formatTags(TurCmsContext context, TurAemSourceContext turAemSourceContext,
List<TurSNAttributeSpec> turSNAttributeSpecList, String tag,
TurCmsTargetAttrValueMap turCmsTargetAttrValueMap) {
TurCommonsUtils.getKeyValueFromColon(tag).ifPresent(kv ->
Optional.ofNullable(kv.getKey()).ifPresent(facet -> {
turSNAttributeSpecList.add(setTagFacet(turAemSourceContext, facet));
Optional.ofNullable(kv.getValue()).ifPresent(value ->
turCmsTargetAttrValueMap.addWithSingleValue(facet,
addTagToAttrValueList(context, turAemSourceContext, facet, value), false)
);
}));
}

private TurCmsTargetAttrValueMap attributeByClass(TurCmsContext context, TurAemSourceContext turAemSourceContext) {
String className = context.getTurCmsSourceAttr().getClassName();
log.debug("ClassName : {}", className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ public class TurAemObject {
private final String type;
private final String path;
private final String url;
private String model;
private final JSONObject jcrNode;
private JSONObject jcrContentNode = new JSONObject();
private String title;
private String template;
private String model;
private final Map<String, Object> attributes = new HashMap<>();

public static final String CONTENT_FRAGMENT = "contentFragment";
public static final String CQ_LAST_REPLICATION_ACTION = "cq:lastReplicationAction";
public static final String CQ_LAST_REPLICATION_ACTION_PUBLISH = "cq:lastReplicationAction_publish";
public static final String CQ_LAST_MODIFIED = "cq:lastModified";
public static final String CQ_MODEL = "cq:model";
public static final String CQ_TEMPLATE = "cq:template";
public static final String DATA_FOLDER = "data";
public static final String DATE_JSON_FORMAT = "E MMM dd yyyy HH:mm:ss 'GMT'Z";
public static final String EMPTY_VALUE = "";
Expand All @@ -71,6 +73,7 @@ public TurAemObject(String nodePath, JSONObject jcrNode) {
try {
if (jcrNode.has(JCR_CONTENT)) {
this.jcrContentNode = jcrNode.getJSONObject(JCR_CONTENT);
this.template = jcrContentNode.has(CQ_TEMPLATE) ? this.jcrContentNode.getString(CQ_TEMPLATE) : EMPTY_VALUE;
this.delivered = isActivated(CQ_LAST_REPLICATION_ACTION)
&& isActivated(CQ_LAST_REPLICATION_ACTION_PUBLISH);
this.title = jcrContentNode.has(JCR_TITLE) ? this.jcrContentNode.getString(JCR_TITLE) : EMPTY_VALUE;
Expand Down
4 changes: 2 additions & 2 deletions turing-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>8.16.1</version>
<version>8.17.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -178,7 +178,7 @@
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>2.5.0</version>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,15 @@ public TurSNSite turSNSiteUpdate(@PathVariable String id, @RequestBody TurSNSite
turSNSiteEdit.setSpotlightWithResults(turSNSite.getSpotlightWithResults());
turSNSiteEdit.setWildcardNoResults(turSNSite.getWildcardNoResults());
turSNSiteEdit.setWildcardAlways(turSNSite.getWildcardAlways());
turSNSiteEdit.setExactMatchField(turSNSite.getExactMatchField());
turSNSiteEdit.setDefaultField(turSNSite.getDefaultField());
turSNSiteEdit.setDefaultTitleField(turSNSite.getDefaultTitleField());
turSNSiteEdit.setDefaultTextField(turSNSite.getDefaultTextField());
turSNSiteEdit.setDefaultDescriptionField(turSNSite.getDefaultDescriptionField());
turSNSiteEdit.setDefaultDateField(turSNSite.getDefaultDateField());
turSNSiteEdit.setDefaultImageField(turSNSite.getDefaultImageField());
turSNSiteEdit.setDefaultURLField(turSNSite.getDefaultURLField());

turSNSiteEdit.setExactMatch(turSNSite.getExactMatch());
turSNSiteRepository.save(turSNSiteEdit);
return turSNSiteEdit;
}).orElse(new TurSNSite());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

import com.google.inject.Inject;
import com.viglet.turing.bean.converse.TurConverseAgentResponse;
import com.viglet.turing.commons.utils.TurCommonsUtils;
import com.viglet.turing.persistence.model.converse.chat.TurConverseChat;
import com.viglet.turing.persistence.model.converse.chat.TurConverseChatResponse;
import com.viglet.turing.persistence.repository.converse.chat.TurConverseChatResponseRepository;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.security.SecureRandom;
Expand Down Expand Up @@ -71,7 +71,7 @@ public void saveChatResponseUser(String q, TurConverseChat chat, HttpSession ses
String nextContext = (String) session.getAttribute(TurConverseConstants.NEXT_CONTEXT);
SolrDocumentList results = turConverseSE.askPhrase(chat.getAgent(), q, nextContext);
if (!results.isEmpty()) {
SolrDocument firstResult = results.get(0);
SolrDocument firstResult = results.getFirst();
String intentId = (String) firstResult.getFieldValue(TurConverseConstants.ID);
SimpleEntry<String, String> parameter = this.getParameterValue(q, chat, intentId);
if (parameter != null) {
Expand All @@ -91,11 +91,10 @@ public AbstractMap.SimpleEntry<String, String> getParameterValue(String text, Tu
String intentId) {
SolrDocumentList termDocumentList = turConverseSE.sorlGetParameterValue(text, turConverseChat, intentId);
if (!termDocumentList.isEmpty()) {
String parameter = (String) termDocumentList.get(0).getFirstValue(TurConverseConstants.PARAMETERS);

String[] parameterKV = parameter.split(":");

return new AbstractMap.SimpleEntry<>(parameterKV[0], parameterKV[1]);
String parameter = (String) termDocumentList.getFirst().getFirstValue(TurConverseConstants.PARAMETERS);
return TurCommonsUtils.getKeyValueFromColon(parameter).map(p ->
new SimpleEntry<>(p.getKey(), p.getValue()))
.orElse(null);

}
return null;
Expand Down Expand Up @@ -127,7 +126,6 @@ public void saveChatResponseBot(TurConverseChat chat, TurConverseAgentResponse t

}

@SuppressWarnings("unchecked")
public void getChatParameter(TurConverseChat chat, HttpSession session,
TurConverseAgentResponse turConverseAgentResponse) {

Expand Down Expand Up @@ -172,7 +170,7 @@ public TurConverseAgentResponse interactionNested(TurConverseChat chat, String q
results = turConverseSE.askPhrase(chat.getAgent(), q, nextContext);

if (!results.isEmpty()) {
SolrDocument firstResult = results.get(0);
SolrDocument firstResult = results.getFirst();

if ((boolean) firstResult.getFieldValue(TurConverseConstants.HAS_PARAMETER)) {
session.setAttribute(TurConverseConstants.INTENT, firstResult.getFieldValue(TurConverseConstants.ID));
Expand All @@ -192,22 +190,17 @@ public TurConverseAgentResponse interactionNested(TurConverseChat chat, String q
return turConverseAgentResponse;
}

@SuppressWarnings("unchecked")
private void getIntentFlow(TurConverseChat chat, HttpSession session,
TurConverseAgentResponse turConverseAgentResponse, SolrDocument firstResult) {

List<String> contextOutputs = (List<String>) firstResult.getFieldValue(TurConverseConstants.CONTEXT_OUTPUT);

turConverseAgentResponse.setResponse(this.getIntentResponse(chat, firstResult));
turConverseAgentResponse.setIntentId(firstResult.getFieldValue(TurConverseConstants.ID).toString());
turConverseAgentResponse.setIntentName(firstResult.getFieldValue(TurConverseConstants.NAME).toString());

if (contextOutputs != null && !contextOutputs.isEmpty()) {
session.setAttribute(TurConverseConstants.NEXT_CONTEXT, contextOutputs.get(0));
session.setAttribute(TurConverseConstants.NEXT_CONTEXT, contextOutputs.getFirst());
}
}

@SuppressWarnings("unchecked")
private String getIntentResponse(TurConverseChat chat, SolrDocument firstResult) {
List<String> responses = (List<String>) firstResult.getFieldValue(TurConverseConstants.RESPONSES);
int rnd = random.nextInt(responses.size());
Expand All @@ -217,12 +210,15 @@ private String getIntentResponse(TurConverseChat chat, SolrDocument firstResult)
StringBuilder responseModified = new StringBuilder();
for (String word : words) {
if (word.startsWith("$")) {
String parameterName = word.replace("\\$", "").replace(",", "").replace(";", "").replace("\\.", "");
String parameterName = word.replace("\\$", "")
.replace(",", "")
.replace(";", "")
.replace("\\.", "");

List<TurConverseChatResponse> values = turConverseChatResponseRepository
.findByChatAndIsUserAndParameterNameOrderByDateDesc(chat, true, parameterName);
if (!values.isEmpty()) {
word = values.get(0).getParameterValue();
word = values.getFirst().getParameterValue();
}
}
responseModified.append(word).append(" ");
Expand All @@ -243,7 +239,7 @@ private String getFallbackResponse(TurConverseChat chat) {
if (fallbackList.isEmpty())
return TurConverseConstants.FALLBACK_DEFAULT_MESSAGE;
else {
SolrDocument fallbackIntent = fallbackList.get(0);
SolrDocument fallbackIntent = fallbackList.getFirst();

Collection<Object> responses = fallbackIntent.getFieldValues(TurConverseConstants.RESPONSES);

Expand All @@ -263,7 +259,7 @@ private void getIntentWhenFinishParameters(TurConverseChat chat, HttpSession ses

SolrDocumentList results = turConverseSE.solrGetIntent(chat.getAgent(), intent);
if (!results.isEmpty()) {
SolrDocument firstResult = results.get(0);
SolrDocument firstResult = results.getFirst();
this.getIntentFlow(chat, session, turConverseAgentResponse, firstResult);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class TurSNSite extends TurAuditable<String> implements Serializable {
@Column
private Integer wildcardAlways = 0;

@Column
private Integer exactMatch = 0;

@Column
private Integer facet;

Expand Down Expand Up @@ -111,6 +114,12 @@ public class TurSNSite extends TurAuditable<String> implements Serializable {
@Column
private Integer thesaurus = 0;

@Column
private String defaultField;

@Column
private String exactMatchField;

@Column
private String defaultTitleField;

Expand Down
Loading
Loading