Skip to content

Commit

Permalink
#29284: apllying feedback and fixing dirty models from being updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
victoralfaro-dotcms committed Aug 2, 2024
1 parent 234cf97 commit 9065444
Show file tree
Hide file tree
Showing 33 changed files with 59 additions and 110 deletions.
36 changes: 2 additions & 34 deletions core-web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11057,7 +11057,7 @@ debug@^3.1.0, debug@^3.2.7:
dependencies:
ms "^2.1.1"

debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==
Expand Down Expand Up @@ -14187,7 +14187,7 @@ import-local@^3.0.2:
pkg-dir "^4.2.0"
resolve-cwd "^3.0.0"

imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==
Expand Down Expand Up @@ -16287,11 +16287,6 @@ lodash-es@^4.17.21:
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha512-bSYo8Pc/f0qAkr8fPJydpJjtrHiSynYfYBjtANIgXv5xEf1WlTC63dIDlgu0s9dmTvzRu1+JJTxcIAHe+sH0FQ==

lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
Expand All @@ -16300,33 +16295,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"

lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha512-2wlI0JRAGX8WEf4Gm1p/mv/SZ+jLijpj0jyaE/AXeuQphzCgD8ZQW4oSpoN8JAopujOFGU3KMuq7qfHBWlGpjQ==

lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha512-S8dUjWr7SUT/X6TBIQ/OYoCHo1Stu1ZRy6uMUSKqzFnZp5G5RyQizSm6kvxD2Ewyy6AVfMg4AToeZzKfF99T5w==

lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha512-ev5SP+iFpZOugyab/DEUQxUeZP5qyciVTlgQ1f4Vlw7VUcCD8fVnyIqVUEIaoFH9zjAqdgi69KiofzvVmda/ZQ==
dependencies:
lodash._getnative "^3.0.0"

lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA==

lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA==

lodash._root@~3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
Expand Down Expand Up @@ -16402,11 +16375,6 @@ lodash.once@^4.0.0, lodash.once@^4.1.1:
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==

lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha512-L4/arjjuq4noiUJpt3yS6KIKDtJwNe2fIYgMqyYYKoeIfV1iEqvPwhCx23o+R9dzouGihDAPN1dTIRWa7zk8tw==

lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
Expand Down
5 changes: 3 additions & 2 deletions dotCMS/src/main/java/com/dotcms/ai/api/AIClientAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import com.dotcms.ai.model.request.AIRequest;

import java.io.OutputStream;
import java.io.Serializable;

public interface AIClientAPI {

void sendRequest(final AIRequest request, final OutputStream output);
<T extends Serializable> void sendRequest(final AIRequest<T> request, final OutputStream output);

void sendRequest(final AIRequest request);
<T extends Serializable> void sendRequest(final AIRequest<T> request);

}
2 changes: 1 addition & 1 deletion dotCMS/src/main/java/com/dotcms/ai/api/AIModels.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.api;

import com.dotcms.ai.app.AIModelType;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.model.OpenAIModel;
Expand Down
17 changes: 17 additions & 0 deletions dotCMS/src/main/java/com/dotcms/ai/api/AIProxy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.dotcms.ai.api;

import com.dotcms.ai.model.AIProvider;
import com.dotmarketing.util.Logger;

public class AIProxy {

public void attemptToConsumeAI(final AIProvider provider) {
if (!provider.isEnabled()) {
Logger.debug(this, "Provider " + provider.getProvider() + " is not enabled.");
return;
}


}

}
12 changes: 9 additions & 3 deletions dotCMS/src/main/java/com/dotcms/ai/api/AIServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

import com.dotcms.ai.model.AIProvider;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;

public class AIServices {

private final ConcurrentMap<AIProvider, List<AIClientAPI>> clients = new ConcurrentHashMap();
private final ConcurrentMap<AIProvider, List<AIClientAPI>> providerClients = new ConcurrentHashMap<>();

public List<AIProvider> getProviders() {
return List.of();
return new ArrayList<>(providerClients.keySet());
}

public List<AIClientAPI> getClients(final List<AIProvider> providers) {
return List.of();
return providers.stream()
.flatMap(provider -> providerClients.get(provider).stream())
.collect(Collectors.toList());
}



}
2 changes: 1 addition & 1 deletion dotCMS/src/main/java/com/dotcms/ai/api/CompletionsAPI.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dotcms.ai.api;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.rest.forms.CompletionsForm;
import com.dotmarketing.util.json.JSONObject;
import io.vavr.Lazy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.db.EmbeddingsDTO;
Expand Down
4 changes: 2 additions & 2 deletions dotCMS/src/main/java/com/dotcms/ai/api/EmbeddingsAPIImpl.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.api;

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.db.EmbeddingsDTO;
Expand Down Expand Up @@ -54,7 +54,7 @@
import java.util.Optional;
import java.util.stream.Collectors;

import static com.dotcms.ai.config.AppConfig.debugLogger;
import static com.dotcms.ai.app.AppConfig.debugLogger;
import static com.liferay.util.StringPool.BLANK;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.List;
import java.util.Locale;

import static com.dotcms.ai.config.AppConfig.debugLogger;
import static com.dotcms.ai.app.AppConfig.debugLogger;
import static com.liferay.util.StringPool.SPACE;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.dotcms.ai.config;
package com.dotcms.ai.app;

import com.dotcms.ai.api.AIModels;
import com.dotcms.ai.app.AIModelType;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.util.AIAppUtil;
import com.dotcms.security.apps.Secret;
Expand Down
1 change: 0 additions & 1 deletion dotCMS/src/main/java/com/dotcms/ai/app/ConfigService.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.dotcms.ai.app;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.api.web.HttpServletRequestThreadLocal;
import com.dotcms.security.apps.AppSecrets;
import com.dotmarketing.beans.Host;
Expand Down
39 changes: 0 additions & 39 deletions dotCMS/src/main/java/com/dotcms/ai/config/ProviderConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.listener;

import com.dotcms.ai.api.EmbeddingsAPI;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.db.EmbeddingsDTO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dotcms.ai.model.request;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotmarketing.util.json.JSONObject;

public class AIJSONObjectRequest extends AIRequest<JSONObject> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dotcms.ai.model.request;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.dotcms.ai.AiKeys;
import com.dotcms.ai.api.CompletionsAPI;
import com.dotcms.ai.api.AIModels;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.rest.forms.CompletionsForm;
Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/java/com/dotcms/ai/rest/ImageResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.Marshaller;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.model.AIImageRequestDTO;
import com.dotcms.ai.service.OpenAIImageService;
Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/java/com/dotcms/ai/rest/TextResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.api.CompletionsAPI;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.rest.forms.CompletionsForm;
import com.dotcms.rest.WebResource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dotcms.ai.rest.forms;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotmarketing.business.APILocator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dotcms.ai.rest.forms;

import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.util.UtilMethods;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.service;

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.util.OpenAIRequest;
import com.dotmarketing.util.UtilMethods;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.service;

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.model.AIImageRequestDTO;
import com.dotcms.ai.util.OpenAIRequest;
import com.dotcms.ai.util.OpenAiRequestUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import static com.dotcms.ai.config.AppConfig.debugLogger;
import static com.dotcms.ai.app.AppConfig.debugLogger;
import static com.liferay.util.StringPool.BLANK;
import static com.liferay.util.StringPool.SPACE;

Expand Down
2 changes: 1 addition & 1 deletion dotCMS/src/main/java/com/dotcms/ai/util/OpenAIRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotmarketing.exception.DotRuntimeException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.viewtool;

import com.dotcms.ai.AiKeys;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.service.OpenAIChatService;
import com.dotcms.ai.service.OpenAIChatServiceImpl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.viewtool;

import com.dotcms.ai.api.CompletionsAPI;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.rest.forms.CompletionsForm;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dotcms.ai.viewtool;

import com.dotcms.ai.api.EmbeddingsAPI;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.util.EncodingUtil;
import com.dotmarketing.beans.Host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.app.AIModelType;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.app.AppKeys;
import com.dotmarketing.util.json.JSONObject;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.dotcms.ai.model.AIModel;
import com.dotcms.ai.app.AIModelType;
import com.dotcms.ai.config.AppConfig;
import com.dotcms.ai.app.AppConfig;
import com.dotcms.ai.model.AIImageRequestDTO;
import com.dotcms.ai.util.StopWordsUtil;
import com.dotcms.rest.api.v1.temp.DotTempFile;
Expand Down
Loading

0 comments on commit 9065444

Please sign in to comment.