mirror of
https://github.com/jackhh66/ChatGPT_Web_accessToken.git
synced 2026-12-03 21:39:32 +00:00
fix line end with new-line in some backend (#474)
* fix line end with new-line in some backend In backend with golang (like https://github.com/sashabaranov/go-openai), the responseText always has '\n'. * feat: 补全遗漏 --------- Co-authored-by: ChenZhaoYu <790348264@qq.com>
This commit is contained in:
1 parent
1edf591721
commit
e30217542d
1 file changed
+2
-2
@@ -115,7 +115,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)
|
||||
@@ -245,7 +245,7 @@ async function onRegenerate(index: number) {
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user