Change Reverse proxy name to Custom and add additionalParams
This commit is contained in:
@@ -299,7 +299,7 @@ export const languageChinese = {
|
||||
"loadDataFromAccount": "从帐户加载数据",
|
||||
"saveCurrentDataToAccount": "将当前数据保存到帐户",
|
||||
"chatAssumed": "",
|
||||
"proxyAPIKey": "代理API密钥/密码",
|
||||
"proxyAPIKey": "API密钥/密码",
|
||||
"proxyRequestModel": "代理请求模型",
|
||||
"officialWiki": "官方Wiki",
|
||||
"officialWikiDesc": "RisuAI的官方Wiki,随意查看。",
|
||||
|
||||
@@ -329,8 +329,8 @@ export const languageGerman = {
|
||||
loadDataFromAccount: "Daten aus dem Konto laden",
|
||||
saveCurrentDataToAccount: "Aktuelle Daten im Konto speichern",
|
||||
chatAssumed: "",
|
||||
proxyAPIKey: "Proxy-Schlüssel/Passwort",
|
||||
proxyRequestModel: "Proxy-Anforderungsmodell",
|
||||
proxyAPIKey: "Schlüssel/Passwort",
|
||||
proxyRequestModel: "Anforderungsmodell",
|
||||
officialWiki: "Offizielles Wiki",
|
||||
officialWikiDesc: "Offizielles Wiki für RisuAI. Schauen Sie doch gerne bei uns vorbei",
|
||||
officialDiscord: "Offizieller Discord",
|
||||
|
||||
@@ -117,6 +117,7 @@ export const languageEnglish = {
|
||||
requestretrys: "This option is used to set the number of request retrys when request fails.",
|
||||
emotionPrompt: "This option is used to set the prompt that is used to detect emotion. if it is blank, it will use the default prompt.",
|
||||
removePunctuationHypa: "If enabled, it will remove punctuation before executing HypaMemory.",
|
||||
additionalParams: "Additional parameters that would be added to the request body. if you want to exclude some parameters, you can put `{{none}}` to the value. if you want to add a header instead of body, you can put `header::` in front of the key like `header::Authorization`.",
|
||||
},
|
||||
setup: {
|
||||
chooseProvider: "Choose AI Provider",
|
||||
@@ -364,7 +365,7 @@ export const languageEnglish = {
|
||||
saveCurrentDataToAccount: "Save Current Data to Account",
|
||||
chatAssumed: "",
|
||||
proxyAPIKey: "Proxy Key/Password",
|
||||
proxyRequestModel: "Proxy Request Model",
|
||||
proxyRequestModel: "Request Model",
|
||||
officialWiki: "Official Wiki",
|
||||
officialWikiDesc: "Official Wiki for RisuAI. feel free to see.",
|
||||
officialDiscord: "Official Discord",
|
||||
@@ -473,7 +474,7 @@ export const languageEnglish = {
|
||||
depthPrompt: "Depth Prompt",
|
||||
largePortrait: "Portrait",
|
||||
lorePlus: "LoreBook+",
|
||||
reverseProxyOobaMode: "Reverse Proxy Ooba Mode",
|
||||
reverseProxyOobaMode: "Ooba Mode",
|
||||
joinMultiUserRoom: "Join MultiUser Room",
|
||||
exactTokens: "Exact Tokens",
|
||||
fixedTokens: "Approximate Tokens",
|
||||
@@ -547,4 +548,6 @@ export const languageEnglish = {
|
||||
outputTokens: "Output Tokens",
|
||||
tokenWarning: "Token caculation can be inaccurate. it is recommended to use it as a reference.",
|
||||
log: "Log",
|
||||
popularityLevelDesc: "Popularity increases with downloads, etc. to estimate, 3.7 popularity is about 1 downloads.",
|
||||
additionalParams: "Additional Parameters",
|
||||
}
|
||||
@@ -300,8 +300,8 @@ export const languageKorean = {
|
||||
loadDataFromAccount: "계정에서 데이터 불러오기",
|
||||
saveCurrentDataToAccount: "계정에 데이터 현재 덮어쓰기",
|
||||
chatAssumed: "",
|
||||
proxyAPIKey: "프록시 키/패스워드",
|
||||
proxyRequestModel: "프록시 요청 모델",
|
||||
proxyAPIKey: "키/패스워드",
|
||||
proxyRequestModel: "요청 모델",
|
||||
officialWiki: "공식 위키",
|
||||
officialWikiDesc: "리스AI의 공식 위키. 자유롭게 보세요.",
|
||||
officialDiscord: "공식 디스코드",
|
||||
|
||||
@@ -300,7 +300,7 @@ export const LanguageVietnamese = {
|
||||
"loadDataFromAccount": "Tải dữ liệu từ tài khoản",
|
||||
"saveCurrentDataToAccount": "Lưu dữ liệu hiện tại vào tài khoản",
|
||||
"chatAssumed": "--",
|
||||
"proxyAPIKey": "Khóa proxy/Mật khẩu",
|
||||
"proxyAPIKey": "Khóa/Mật khẩu",
|
||||
"proxyRequestModel": "Mô hình yêu cầu proxy",
|
||||
"officialWiki": "Wiki chính thức",
|
||||
"officialWikiDesc": "Wiki chính thức của RisuAI. cứ thoải mái xem nhé.",
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
<TextInput marginBottom={true} size={"sm"} placeholder="..." bind:value={$DataBase.mistralKey}/>
|
||||
{/if}
|
||||
{#if $DataBase.aiModel === 'reverse_proxy' || $DataBase.subModel === 'reverse_proxy'}
|
||||
<span class="text-textcolor mt-2">{language.forceReplaceUrl} URL <Help key="forceUrl"/></span>
|
||||
<span class="text-textcolor mt-2">URL <Help key="forceUrl"/></span>
|
||||
<TextInput marginBottom={false} size={"sm"} bind:value={$DataBase.forceReplaceUrl} placeholder="https//..." />
|
||||
<span class="text-textcolor mt-4"> {language.proxyAPIKey}</span>
|
||||
<TextInput marginBottom={false} size={"sm"} placeholder="leave it blank if it hasn't password" bind:value={$DataBase.proxyKey} />
|
||||
@@ -577,6 +577,46 @@
|
||||
</table>
|
||||
</Arcodion>
|
||||
|
||||
{#if $DataBase.aiModel === 'reverse_proxy'}
|
||||
<Arcodion styled name="{language.additionalParams} " help="additionalParams">
|
||||
<table class="contain w-full max-w-full tabler">
|
||||
<tr>
|
||||
<th class="font-medium">{language.key}</th>
|
||||
<th class="font-medium">{language.value}</th>
|
||||
<th>
|
||||
<button class="font-medium cursor-pointer hover:text-green-500 w-full flex justify-center items-center" on:click={() => {
|
||||
let additionalParams = $DataBase.additionalParams
|
||||
additionalParams.push(['', ''])
|
||||
$DataBase.additionalParams = additionalParams
|
||||
}}><PlusIcon /></button>
|
||||
</th>
|
||||
</tr>
|
||||
{#if $DataBase.bias.length === 0}
|
||||
<tr>
|
||||
<div class="text-textcolor2">{language.noData}</div>
|
||||
</tr>
|
||||
{/if}
|
||||
{#each $DataBase.additionalParams as additionalParams, i}
|
||||
<tr>
|
||||
<td class="font-medium truncate">
|
||||
<TextInput bind:value={$DataBase.additionalParams[i][0]} size="lg" fullwidth/>
|
||||
</td>
|
||||
<td class="font-medium truncate">
|
||||
<TextInput bind:value={$DataBase.additionalParams[i][1]} size="lg" fullwidth/>
|
||||
</td>
|
||||
<td>
|
||||
<button class="font-medium flex justify-center items-center h-full cursor-pointer hover:text-green-500 w-full" on:click={() => {
|
||||
let additionalParams = $DataBase.additionalParams
|
||||
additionalParams.splice(i, 1)
|
||||
$DataBase.additionalParams = additionalParams
|
||||
}}><TrashIcon /></button>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
</Arcodion>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if !$DataBase.promptTemplate}
|
||||
<div class="flex items-center mt-4">
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('claude-1.0')}}>claude-v1.0</button>
|
||||
{/if}
|
||||
</Arcodion>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('reverse_proxy')}}>Reverse Proxy</button>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('reverse_proxy')}}>Custom (OpenAI-compatible)</button>
|
||||
{#if $DataBase.tpo && isTauri}
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={async () => {
|
||||
const selected = await open({
|
||||
@@ -129,6 +129,7 @@
|
||||
{/each}
|
||||
{/await}
|
||||
</Arcodion>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('oaicomp')}}>Custom (OpenAI-compatible)</button>
|
||||
{#if showUnrec}
|
||||
<Arcodion name="WebLLM Local">
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('hf:::Xenova/opt-350m')}}>opt-350m</button>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
import RealmLicense from "./RealmLicense.svelte";
|
||||
import MultiLangDisplay from "../GUI/MultiLangDisplay.svelte";
|
||||
import { tooltip } from "src/ts/gui/tooltip";
|
||||
|
||||
export let openedData:hubType
|
||||
|
||||
@@ -35,7 +36,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
<div class="flex flex-wrap w-full flex-row gap-1 mt-2">
|
||||
<span class="text-textcolor2">
|
||||
<span class="text-textcolor2" use:tooltip={language.popularityLevelDesc}>
|
||||
{language.popularityLevel.replace('{}', openedData.download.toString())}
|
||||
</span>
|
||||
<div class="border-l-selected border-l ml-1 mr-1"></div>
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
if( today.getMonth() === 3 && today.getDate() === 1){
|
||||
specialDay = 'aprilFool'
|
||||
}
|
||||
if( today.getMonth() === 3 && today.getDate() === 14){
|
||||
specialDay = 'anniversary'
|
||||
}
|
||||
if( today.getMonth() === 9 && today.getDate() === 31){
|
||||
specialDay = 'halloween'
|
||||
}
|
||||
let iconAnimation = 0
|
||||
let clicks = 0
|
||||
let score = 0
|
||||
|
||||
@@ -52,7 +52,7 @@ export function getModelName(name:string){
|
||||
case "novellist damsel":
|
||||
return "NovelList Damsel"
|
||||
case 'reverse_proxy':
|
||||
return "Reverse Proxy"
|
||||
return "Custom (OpenAI-compatible)"
|
||||
case 'openrouter':
|
||||
return "OpenRouter"
|
||||
case 'gptvi4_1106':
|
||||
@@ -144,6 +144,12 @@ export function getModelShortName(model:string){
|
||||
return split[split.length-1]
|
||||
}
|
||||
}
|
||||
if(model.startsWith('reverse_proxy')){
|
||||
return 'Custom'
|
||||
}
|
||||
if(model.startsWith('oaicomp')){
|
||||
return 'Custom'
|
||||
}
|
||||
return getModelName(model)
|
||||
|
||||
}
|
||||
28
src/ts/process/memory/termMemory.ts
Normal file
28
src/ts/process/memory/termMemory.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { OpenAIChat } from "..";
|
||||
import { HypaProcesser } from "./hypamemory";
|
||||
|
||||
export async function termMemory(chats:OpenAIChat[]){
|
||||
const processer = new HypaProcesser('MiniLM')
|
||||
processer.addText(chats.map(chat=>chat.content))
|
||||
|
||||
let scoredResults:{[key:string]:number}
|
||||
for(let i=1;i<5;i++){
|
||||
const chat = chats[chats.length-i]
|
||||
if(!chat?.content){
|
||||
continue
|
||||
}
|
||||
const scoredArray = (await processer.similaritySearchScored(chat.content)).map((result) => {
|
||||
return [result[0],result[1]/i] as [string,number]
|
||||
})
|
||||
for(const scored of scoredArray){
|
||||
if(scoredResults[scored[0]]){
|
||||
scoredResults[scored[0]] += scored[1]
|
||||
}else{
|
||||
scoredResults[scored[0]] = scored[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
const result = Object.entries(scoredResults).sort((a,b)=>a[1]-b[1])
|
||||
return result.map(([content,score])=>(content)).join('\n\n')
|
||||
|
||||
}
|
||||
@@ -606,6 +606,43 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
||||
}
|
||||
}
|
||||
|
||||
if(raiModel === 'reverse_proxy'){
|
||||
const additionalParams = db.additionalParams
|
||||
for(let i=0;i<additionalParams.length;i++){
|
||||
let key = additionalParams[i][0]
|
||||
let value = additionalParams[i][1]
|
||||
|
||||
if(!key || !value){
|
||||
continue
|
||||
}
|
||||
|
||||
if(value === '{{none}}'){
|
||||
if(key.startsWith('header::')){
|
||||
key = key.replace('header::', '')
|
||||
delete headers[key]
|
||||
}
|
||||
else{
|
||||
delete body[key]
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if(key.startsWith('header::')){
|
||||
key = key.replace('header::', '')
|
||||
headers[key] = value
|
||||
}
|
||||
else if(isNaN(parseFloat(value))){
|
||||
if(value.startsWith('"') && value.endsWith('"')){
|
||||
value = value.slice(1, -1)
|
||||
}
|
||||
body[key] = value
|
||||
}
|
||||
else{
|
||||
body[key] = parseFloat(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const res = await globalFetch(replacerURL, {
|
||||
body: body,
|
||||
headers: headers,
|
||||
|
||||
@@ -375,6 +375,7 @@ export function setDatabase(data:Database){
|
||||
data.memoryLimitThickness ??= 1
|
||||
data.modules ??= []
|
||||
data.enabledModules ??= []
|
||||
data.additionalParams ??= []
|
||||
|
||||
changeLanguage(data.language)
|
||||
DataBase.set(data)
|
||||
@@ -600,6 +601,7 @@ export interface Database{
|
||||
enabledModules: string[]
|
||||
sideMenuRerollButton?:boolean
|
||||
requestInfoInsideChat?:boolean
|
||||
additionalParams:[string, string][]
|
||||
}
|
||||
|
||||
export interface customscript{
|
||||
|
||||
Reference in New Issue
Block a user