Skip to content

Commit

Permalink
fix chioces npe
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangtianyu committed Aug 26, 2024
1 parent c97a8a4 commit 7c3d098
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 7c3d098

Please sign in to comment.