Skip to content

Commit

Permalink
fix: access token error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin committed Apr 16, 2023
1 parent f0f1cfb commit c792148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,14 @@ router.post('/chat-process', [auth, limiter], async (req, res) => {
detail: {
choices: [
{
finish_reason: chat.detail.choices[0].finish_reason,
finish_reason: undefined,
},
],
},
}
if (chat.detail && chat.detail.choices.length > 0)
chuck.detail.choices[0].finish_reason = chat.detail.choices[0].finish_reason

res.write(firstChunk ? JSON.stringify(chuck) : `\n${JSON.stringify(chuck)}`)
firstChunk = false
},
Expand Down
4 changes: 2 additions & 2 deletions src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async function onConversation() {
},
)
if (openLongReply && data.detail.choices[0].finish_reason === 'length') {
if (openLongReply && data.detail && data.detail.choices.length > 0 && data.detail.choices[0].finish_reason === 'length') {
options.parentMessageId = data.id
lastText = data.text
message = ''
Expand Down Expand Up @@ -302,7 +302,7 @@ async function onRegenerate(index: number) {
},
)
if (openLongReply && data.detail.choices[0].finish_reason === 'length') {
if (openLongReply && data.detail && data.detail.choices.length > 0 && data.detail.choices[0].finish_reason === 'length') {
options.parentMessageId = data.id
lastText = data.text
message = ''
Expand Down

1 comment on commit c792148

@zhujunsan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Please sign in to comment.