Skip to content

Commit

Permalink
fix line end with new-line in some backend
Browse files Browse the repository at this point in the history
In backend with golang (like https://github.com/sashabaranov/go-openai), the responseText always has '\n'.
  • Loading branch information
liut committed Mar 10, 2023
1 parent 24c203f commit 8578ea1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/views/chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function onConversation() {
const xhr = event.target
const { responseText } = xhr
// Always process the final line
const lastIndex = responseText.lastIndexOf('\n')
const lastIndex = responseText.lastIndexOf('\n', responseText.length - 2)
let chunk = responseText
if (lastIndex !== -1)
chunk = responseText.substring(lastIndex)
Expand Down

0 comments on commit 8578ea1

Please sign in to comment.