[feat] better proxy resolve
This commit is contained in:
@@ -88,9 +88,17 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
if(replacerURL.endsWith('v1')){
|
if(replacerURL.endsWith('v1')){
|
||||||
replacerURL += '/chat/completions'
|
replacerURL += '/chat/completions'
|
||||||
}
|
}
|
||||||
if(replacerURL.endsWith('v1/')){
|
else if(replacerURL.endsWith('v1/')){
|
||||||
replacerURL += 'chat/completions'
|
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){
|
if(db.useStreaming && arg.useStreaming){
|
||||||
body.stream = true
|
body.stream = true
|
||||||
@@ -127,6 +135,8 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
control.enqueue(readed)
|
control.enqueue(readed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(rawChunk)
|
||||||
const chunk = JSON.parse(rawChunk).choices[0].delta.content
|
const chunk = JSON.parse(rawChunk).choices[0].delta.content
|
||||||
if(chunk){
|
if(chunk){
|
||||||
readed += chunk
|
readed += chunk
|
||||||
|
|||||||
Reference in New Issue
Block a user