[feat] better proxy resolve

This commit is contained in:
kwaroran
2023-06-14 13:31:41 +09:00
parent e45483a8c6
commit 0b5c765da2

View File

@@ -88,9 +88,17 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
if(replacerURL.endsWith('v1')){
replacerURL += '/chat/completions'
}
if(replacerURL.endsWith('v1/')){
else if(replacerURL.endsWith('v1/')){
replacerURL += 'chat/completions'
}
else if(!(replacerURL.endsWith('completions') || replacerURL.endsWith('completions/'))){
if(replacerURL.endsWith('/')){
replacerURL += 'v1/chat/completions'
}
else{
replacerURL += '/v1/chat/completions'
}
}
if(db.useStreaming && arg.useStreaming){
body.stream = true
@@ -127,6 +135,8 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
control.enqueue(readed)
return
}
console.log(rawChunk)
const chunk = JSON.parse(rawChunk).choices[0].delta.content
if(chunk){
readed += chunk