Skip to content

Commit

Permalink
Don't send title to DALL-E if blank
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Oct 6, 2023
1 parent 5669cb2 commit 84033a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/jasper/component/delta/Dalle.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.List;
import java.util.UUID;

import static org.apache.commons.lang3.StringUtils.isBlank;

@Profile("ai")
@Component
public class Dalle implements Async.AsyncRunner {
Expand Down Expand Up @@ -75,7 +77,7 @@ public void run(Ref ref) throws JsonProcessingException {
var config = objectMapper.convertValue(dallePlugin.getConfig(), OpenAi.DalleConfig.class);
var response = new Ref();
try {
var res = openAi.dale(ref.getTitle() + ": " + ref.getComment(), config);
var res = openAi.dale((isBlank(ref.getTitle()) ? "" : ref.getTitle() + ": ") + ref.getComment(), config);
response.setTitle("Re: " + ref.getTitle());
response.setUrl(res.getData().get(0).getUrl());
} catch (Exception e) {
Expand Down

0 comments on commit 84033a7

Please sign in to comment.