[feat] local request warn
This commit is contained in:
@@ -231,6 +231,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if advancedBotSettings}
|
{#if advancedBotSettings}
|
||||||
|
{#if !$DataBase.promptTemplate}
|
||||||
<span class="text-textcolor">{language.mainPrompt} <Help key="mainprompt"/></span>
|
<span class="text-textcolor">{language.mainPrompt} <Help key="mainprompt"/></span>
|
||||||
<TextAreaInput fullwidth autocomplete="off" height={"32"} bind:value={$DataBase.mainPrompt}></TextAreaInput>
|
<TextAreaInput fullwidth autocomplete="off" height={"32"} bind:value={$DataBase.mainPrompt}></TextAreaInput>
|
||||||
<span class="text-textcolor2 mb-6 text-sm mt-2">{tokens.mainPrompt} {language.tokens}</span>
|
<span class="text-textcolor2 mb-6 text-sm mt-2">{tokens.mainPrompt} {language.tokens}</span>
|
||||||
@@ -240,6 +241,7 @@
|
|||||||
<span class="text-textcolor">{language.globalNote} <Help key="globalNote"/></span>
|
<span class="text-textcolor">{language.globalNote} <Help key="globalNote"/></span>
|
||||||
<TextAreaInput fullwidth autocomplete="off" height={"32"} bind:value={$DataBase.globalNote}></TextAreaInput>
|
<TextAreaInput fullwidth autocomplete="off" height={"32"} bind:value={$DataBase.globalNote}></TextAreaInput>
|
||||||
<span class="text-textcolor2 mb-6 text-sm mt-2">{tokens.globalNote} {language.tokens}</span>
|
<span class="text-textcolor2 mb-6 text-sm mt-2">{tokens.globalNote} {language.tokens}</span>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<span class="text-textcolor">{language.maxContextSize}</span>
|
<span class="text-textcolor">{language.maxContextSize}</span>
|
||||||
<NumberInput min={0} max={getModelMaxContext($DataBase.aiModel)} marginBottom={true} bind:value={$DataBase.maxContext}/>
|
<NumberInput min={0} max={getModelMaxContext($DataBase.aiModel)} marginBottom={true} bind:value={$DataBase.maxContext}/>
|
||||||
@@ -414,9 +416,11 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{#if !$DataBase.promptTemplate}
|
||||||
<div class="flex items-center mt-4">
|
<div class="flex items-center mt-4">
|
||||||
<Check bind:check={$DataBase.promptPreprocess} name={language.promptPreprocess}/>
|
<Check bind:check={$DataBase.promptPreprocess} name={language.promptPreprocess}/>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
<div class="flex items-center mt-4">
|
<div class="flex items-center mt-4">
|
||||||
{#if $DataBase.promptTemplate}
|
{#if $DataBase.promptTemplate}
|
||||||
<Check check={true} name={language.usePromptTemplate} onChange={()=>{
|
<Check check={true} name={language.usePromptTemplate} onChange={()=>{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { AccessibilityIcon, ActivityIcon, AlignLeft, BookIcon, BotIcon, BoxIcon, CodeIcon, ContactIcon, DiamondIcon, FolderIcon, LanguagesIcon, MonitorIcon, Sailboat, UserIcon, XCircleIcon } from "lucide-svelte";
|
import { AccessibilityIcon, ActivityIcon, AlignLeft, BookIcon, BotIcon, BoxIcon, CodeIcon, ContactIcon, DiamondIcon, FolderIcon, LanguagesIcon, MonitorIcon, Sailboat, ScrollTextIcon, UserIcon, XCircleIcon } from "lucide-svelte";
|
||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
import DisplaySettings from "./Pages/DisplaySettings.svelte";
|
import DisplaySettings from "./Pages/DisplaySettings.svelte";
|
||||||
import UserSettings from "./Pages/UserSettings.svelte";
|
import UserSettings from "./Pages/UserSettings.svelte";
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 13
|
selected = 13
|
||||||
}}>
|
}}>
|
||||||
<BotIcon />
|
<ScrollTextIcon />
|
||||||
<span>{language.prompt}</span>
|
<span>{language.prompt}</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -213,6 +213,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
let throughProxi = (!isTauri) && (!isNodeServer) && (!db.usePlainFetch)
|
let throughProxi = (!isTauri) && (!isNodeServer) && (!db.usePlainFetch)
|
||||||
if(db.useStreaming && arg.useStreaming){
|
if(db.useStreaming && arg.useStreaming){
|
||||||
body.stream = true
|
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)
|
const da = (throughProxi)
|
||||||
? await fetch(hubURL + `/proxy2`, {
|
? await fetch(hubURL + `/proxy2`, {
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
|
|||||||
@@ -511,6 +511,17 @@ export async function globalFetch(url:string, arg:{
|
|||||||
|
|
||||||
const urlHost = (new URL(url)).hostname
|
const urlHost = (new URL(url)).hostname
|
||||||
let forcePlainFetch = (knownHostes.includes(urlHost) && (!isTauri)) || db.usePlainFetch || arg.plainFetchForce
|
let forcePlainFetch = (knownHostes.includes(urlHost) && (!isTauri)) || db.usePlainFetch || arg.plainFetchForce
|
||||||
|
|
||||||
|
console.log(urlHost)
|
||||||
|
//check if the url is a local url like localhost
|
||||||
|
if(urlHost.includes("localhost") || urlHost.includes("172.0.0.1") || urlHost.includes("0.0.0.0")){
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
data: 'You are trying local request on web version. this is not allowed dude to browser security policy. use the desktop version instead, or use tunneling service like ngrok and set the cors to allow all.',
|
||||||
|
headers: {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(forcePlainFetch){
|
if(forcePlainFetch){
|
||||||
try {
|
try {
|
||||||
let headers = arg.headers ?? {}
|
let headers = arg.headers ?? {}
|
||||||
|
|||||||
Reference in New Issue
Block a user