Skip to content

Commit 1f39a24

Browse files
committed
Use first choice when setting or getting response
1 parent 15f634f commit 1f39a24

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugins/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,14 @@ function setResponseContentPart(
179179

180180
if (requestType === 'chatComplete') {
181181
updatedJson.choices = [...json.choices];
182-
const lastChoice = {
183-
...updatedJson.choices[updatedJson.choices.length - 1],
182+
const firstChoice = {
183+
...updatedJson.choices[0],
184184
};
185-
lastChoice.message = {
186-
...lastChoice.message,
187-
content: textArray[0] || lastChoice.message.content,
185+
firstChoice.message = {
186+
...firstChoice.message,
187+
content: textArray[0] || firstChoice.message.content,
188188
};
189-
updatedJson.choices[updatedJson.choices.length - 1] = lastChoice;
189+
updatedJson.choices[0] = firstChoice;
190190
} else if (requestType === 'complete') {
191191
updatedJson.choices = [...json.choices];
192192
updatedJson.choices[json.choices.length - 1].text =

0 commit comments

Comments
 (0)