Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api support to try out branding AI feature #668

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sahandilshan
Copy link
Contributor

@CLAassistant
Copy link

CLAassistant commented Sep 28, 2024

CLA assistant check
All committers have signed the CLA.

"Error while updating custom text preference configurations for organization: %s."),
ERROR_CODE_ERROR_GETTING_BRANDING_RESULT_STATUS("65009",
"Error while getting branding preference generation result status.",
"Error while retrieving branding preference generation result status for operation."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we add any information specific to the action in the error description?

if (taskOperationService != null) {
this.brandingAiPreferenceManager = taskOperationService;
} else {
throw new Exception("Unable to retrieve ConfigurationManager service.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Exception("Unable to retrieve ConfigurationManager service.");
throw new Exception("Unable to retrieve BrandingAIPreferenceManager service.");

*/
public class BrandingAIPreferenceManagementService {

private static final Log log = LogFactory.getLog(BrandingAIPreferenceManagementService.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static final Log log = LogFactory.getLog(BrandingAIPreferenceManagementService.class);
private static final Log LOG = LogFactory.getLog(BrandingAIPreferenceManagementService.class);

BrandingGenerationRequestModel brandingGenerationRequestModel) {

try {
String operationId = BrandingPreferenceServiceHolder.getBrandingPreferenceAiManager()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can BrandingPreferenceServiceHolder.getBrandingPreferenceAiManager() return null?

public BrandingGenerationStatusModel getBrandingPreferenceGenerationStatus(String operationId) {

try {
Object generationStatus = BrandingPreferenceServiceHolder.getBrandingPreferenceAiManager()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can BrandingPreferenceServiceHolder.getBrandingPreferenceAiManager() be null?

operationId: getBrandingGenerationStatus
summary: Get the status of a branding generation operation.
description: |
This API endpoint return the status of the AI branding generation process that initiated using the `/generate` endpoint.<br/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This API endpoint return the status of the AI branding generation process that initiated using the `/generate` endpoint.<br/>
This API endpoint returns the status of the AI branding generation process that is initiated using the `/generate` endpoint.<br/>

Comment on lines +209 to +211



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary new lines


if (object instanceof Map) {
Map<String, Object> map = new HashMap<>();
for (Map.Entry<String, Object> entry : ((Map<String, Object>) object).entrySet()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we guarantee that the entry is always <String, Object>

return new HashMap<>();
}

private static Object[] convertListToArray(List<?> list) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we optimize this method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants