Skip to content

Commit

Permalink
removed inconsistent publishing from Gpt3
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Oct 12, 2023
1 parent 11f47e3 commit 74337a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/org/myrobotlab/service/Gpt3.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ public Response getResponse(String text) {
@SuppressWarnings({ "unchecked", "rawtypes" })
Map<String, Object> textObject = (Map) choices.get(0);
responseText = (String) textObject.get("text");
if (responseText != null) {
// /completions
invoke("publishText", responseText);
} else {
if (responseText == null) {
// /chat/completions
@SuppressWarnings({ "unchecked", "rawtypes" })
Map<String, Object> content = (Map)textObject.get("message");
Expand Down Expand Up @@ -156,6 +153,7 @@ public Response getResponse(String text) {
if (responseText != null && responseText.length() > 0) {
invoke("publishUtterance", utterance);
invoke("publishResponse", response);
invoke("publishText", responseText);
}

return response;
Expand Down

0 comments on commit 74337a1

Please sign in to comment.