Skip to content

Commit

Permalink
#28813: initial
Browse files Browse the repository at this point in the history
  • Loading branch information
victoralfaro-dotcms committed Jul 26, 2024
1 parent ad9fe28 commit 12e3630
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 85 deletions.
9 changes: 9 additions & 0 deletions dotCMS/src/main/java/com/dotcms/ai/service/OpenAIService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.dotcms.ai.service;

import com.dotmarketing.util.json.JSONObject;

public interface OpenAIService {

JSONObject getSupportedModels();

}
25 changes: 25 additions & 0 deletions dotCMS/src/main/java/com/dotcms/ai/service/OpenAIServiceImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.dotcms.ai.service;

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

import javax.ws.rs.HttpMethod;

public class OpenAIServiceImpl implements OpenAIService {

private static final String AI_MODELS_URL = "https://api.openai.com/v1/models";

private final AppConfig appConfig;

public OpenAIServiceImpl(final AppConfig appConfig) {
this.appConfig = appConfig;
}

@Override
public JSONObject getSupportedModels() {
final String response = OpenAIRequest.doRequest(AI_MODELS_URL, HttpMethod.GET, appConfig.getApiKey(), null);
return new JSONObject(response);
}

}
78 changes: 0 additions & 78 deletions dotCMS/src/main/java/com/dotcms/ai/util/OpenAIModel.java

This file was deleted.

70 changes: 63 additions & 7 deletions dotCMS/src/main/resources/apps/dotAI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,75 @@ params:
value: "1920x1080"
- label: "256x256 (Small Square 1:1)"
value: "256x256"
model:
value: "gpt-3.5-turbo-16k"
modelName:
value: ""
hidden: false
type: "STRING"
label: "Model"
label: "Model Name"
hint: "Model used to generate ChatGPT API response."
required: true
imageModel:
value: "dall-e-3"
modelTokensPerMinute:
value: ""
hidden: false
type: "STRING"
label: "Tokens per Minute"
hint: "Tokens per minute used to generate ChatGPT API response."
required: true
modelApiPerMinute:
value: ""
hidden: false
type: "STRING"
label: "API per Minute"
hint: "API per minute used to generate ChatGPT API response."
required: true
modelMaxTokens:
value: ""
hidden: false
type: "STRING"
label: "Max Tokens"
hint: "Maximum number of tokens used to generate ChatGPT API response."
required: true
modelCompletion:
value: ""
hidden: false
type: "BOOL"
label: "Completion model enabled"
hint: "Enable completion model used to generate ChatGPT API response."
required: true
imageModelName:
value: ""
hidden: false
type: "STRING"
label: "Image Model"
hint: "Image Model used to generate AI Images"
label: "Image Model Name"
hint: "Model used to generate ChatGPT API response."
required: true
imageModelTokensPerMinute:
value: ""
hidden: false
type: "STRING"
label: "Image Tokens per Minute"
hint: "Tokens per minute used to generate ChatGPT API response."
required: true
imageModelApiPerMinute:
value: ""
hidden: false
type: "STRING"
label: "Image API per Minute"
hint: "API per minute used to generate ChatGPT API response."
required: true
imageModelMaxTokens:
value: ""
hidden: false
type: "STRING"
label: "Image Max Tokens"
hint: "Maximum number of tokens used to generate ChatGPT API response."
required: true
imageModelCompletion:
value: ""
hidden: false
type: "BOOL"
label: "Image Completion model enabled"
hint: "Enable completion model used to generate ChatGPT API response."
required: true
listenerIndexer:
value: ""
Expand Down

0 comments on commit 12e3630

Please sign in to comment.