[feat] local request warn

This commit is contained in:
kwaroran
2023-08-03 13:03:23 +09:00
parent ff98951d00
commit 2bb3937d0d
4 changed files with 36 additions and 14 deletions

View File

@@ -213,6 +213,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
let throughProxi = (!isTauri) && (!isNodeServer) && (!db.usePlainFetch)
if(db.useStreaming && arg.useStreaming){
body.stream = true
let urlHost = new URL(replacerURL).host
if(urlHost.includes("localhost") || urlHost.includes("172.0.0.1") || urlHost.includes("0.0.0.0")){
return {
type: 'fail',
result: 'You are trying local request on streaming. this is not allowed dude to browser/os security policy. turn off streaming.',
}
}
const da = (throughProxi)
? await fetch(hubURL + `/proxy2`, {
body: JSON.stringify(body),