[refactor] reverse proxy 2
This commit is contained in:
@@ -162,18 +162,20 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
|
|
||||||
let replacerURL = (aiModel === 'reverse_proxy') ? (db.forceReplaceUrl) : ('https://api.openai.com/v1/chat/completions')
|
let replacerURL = (aiModel === 'reverse_proxy') ? (db.forceReplaceUrl) : ('https://api.openai.com/v1/chat/completions')
|
||||||
|
|
||||||
if(replacerURL.endsWith('v1')){
|
if(aiModel === 'reverse_proxy'){
|
||||||
replacerURL += '/chat/completions'
|
if(replacerURL.endsWith('v1')){
|
||||||
}
|
replacerURL += '/chat/completions'
|
||||||
else if(replacerURL.endsWith('v1/')){
|
|
||||||
replacerURL += 'chat/completions'
|
|
||||||
}
|
|
||||||
else if(!(replacerURL.endsWith('completions') || replacerURL.endsWith('completions/'))){
|
|
||||||
if(replacerURL.endsWith('/')){
|
|
||||||
replacerURL += 'v1/chat/completions'
|
|
||||||
}
|
}
|
||||||
else{
|
else if(replacerURL.endsWith('v1/')){
|
||||||
replacerURL += '/v1/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'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user