Skip to content

Commit

Permalink
fix chioces npe (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangtianyu authored Aug 27, 2024
1 parent 7e31a42 commit 5141bdc
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.UUID;
import java.util.function.Consumer;

import org.apache.commons.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -97,6 +98,9 @@ public void onEvent(@NotNull EventSource eventSource, @Nullable String id, @Null
}
result.append("</div>\n\n");
} else {
if (CollectionUtils.isEmpty(response.getChoices())) {
return;
}
var choice = response.getChoices().get(0);
var finishReason = choice.getFinishReason();

Expand Down

0 comments on commit 5141bdc

Please sign in to comment.