Skip to content

Commit

Permalink
1.87,0 (#321)
Browse files Browse the repository at this point in the history
# PR Checklist
- [ ] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [ ] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions?
- [ ] Did you added a type def?

# Description
  • Loading branch information
kwaroran authored Mar 20, 2024
2 parents 4fe614e + d69b54e commit db9149b
Show file tree
Hide file tree
Showing 22 changed files with 203 additions and 46 deletions.
Binary file added public/_be501c44-234b-456c-83d8-30a7c60e68ca.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "RisuAI",
"version": "1.86.1"
"version": "1.87.0"
},
"tauri": {
"allowlist": {
Expand Down
14 changes: 6 additions & 8 deletions src/etc/patchNote.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
export const patchNote = {
version: "1.86",
version: "1.87",
content:
`
# Update 1.86
- Added 'Request info inside chat' option
- Added response info for streamed chat
- Added color scheme customization
- Added color scheme export and import
- Added {{previous_chat_log::A}} syntax
- Minor bug fixes
# Update 1.87
- Changed name of Reverse Proxy to Custom (OpenAI-Compatible)
- Added Additional Parameters to Custom (OpenAI-Compatible)
- Added Height mode option
- Fixed file post not working on Custom (OpenAI-Compatible)
`
}

Expand Down
2 changes: 1 addition & 1 deletion src/lang/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const languageChinese = {
"loadDataFromAccount": "从帐户加载数据",
"saveCurrentDataToAccount": "将当前数据保存到帐户",
"chatAssumed": "",
"proxyAPIKey": "代理API密钥/密码",
"proxyAPIKey": "API密钥/密码",
"proxyRequestModel": "代理请求模型",
"officialWiki": "官方Wiki",
"officialWikiDesc": "RisuAI的官方Wiki,随意查看。",
Expand Down
4 changes: 2 additions & 2 deletions src/lang/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`. if you want value as json, you can put `json::` in front of the value like `json::{\"key\":\"value\"}`. otherwise, type of the value would be determined automatically.",
},
setup: {
chooseProvider: "Choose AI Provider",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -547,4 +548,7 @@ 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",
heightMode: "Height Mode",
}
4 changes: 2 additions & 2 deletions src/lang/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ export const languageKorean = {
loadDataFromAccount: "계정에서 데이터 불러오기",
saveCurrentDataToAccount: "계정에 데이터 현재 덮어쓰기",
chatAssumed: "",
proxyAPIKey: "프록시 키/패스워드",
proxyRequestModel: "프록시 요청 모델",
proxyAPIKey: "키/패스워드",
proxyRequestModel: "요청 모델",
officialWiki: "공식 위키",
officialWikiDesc: "리스AI의 공식 위키. 자유롭게 보세요.",
officialDiscord: "공식 디스코드",
Expand Down
2 changes: 1 addition & 1 deletion src/lang/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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é.",
Expand Down
10 changes: 10 additions & 0 deletions src/lib/Setting/Pages/AdvancedSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
<OptionInput value="high">High</OptionInput>
</SelectInput>

<span class="text-textcolor mt-4">{language.heightMode}</span>
<SelectInput bind:value={$DataBase.heightMode}>
<OptionInput value="normal">Normal</OptionInput>
<OptionInput value="percent">Percent</OptionInput>
<OptionInput value="vh">VH</OptionInput>
<OptionInput value="dvh">DVH</OptionInput>
<OptionInput value="svh">SVH</OptionInput>
<OptionInput value="lvh">LVH</OptionInput>
</SelectInput>

<div class="flex items-center mt-4">
<Check bind:check={$DataBase.useSayNothing} name={language.sayNothing}> <Help key="sayNothing"/></Check>
</div>
Expand Down
42 changes: 41 additions & 1 deletion src/lib/Setting/Pages/BotSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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} />
Expand Down Expand Up @@ -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">
Expand Down
3 changes: 2 additions & 1 deletion src/lib/UI/ModelList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/UI/Realm/RealmPopUp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions src/lib/UI/Title.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body{
--risu-theme-textcolor2: #64748b;
--risu-theme-darkborderc: #4b5563;
--risu-theme-darkbutton: #374151;
--risu-height-size: 100%;

}

Expand All @@ -36,7 +37,7 @@ body{
}

html, body{
height: 100%
height: var(--risu-height-size);
}

.chattext p{
Expand Down
15 changes: 2 additions & 13 deletions src/ts/characterCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ export async function characterURLImport() {
url.searchParams.delete('realm');
window.history.pushState(null, '', url.toString());

const res = await fetch(`${hubURL}/hub/info`,{
method: "POST",
body: JSON.stringify({
id: realmPath
})
})
const res = await fetch(`${hubURL}/hub/info/${realmPath}`)
if(res.status !== 200){
alertError(await res.text())
return
Expand Down Expand Up @@ -826,13 +821,7 @@ export async function downloadRisuHub(id:string) {
type: "wait",
msg: "Downloading..."
})
const res = await fetch(hubURL + '/hub/get', {
method: "POST",
body: JSON.stringify({
id: id,
apiver: 3
})
})
const res = await fetch(hubURL + '/hub/get/' + id)
if(res.status !== 200){
alertError(await res.text())
return
Expand Down
8 changes: 7 additions & 1 deletion src/ts/model/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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)

}
11 changes: 9 additions & 2 deletions src/ts/process/files/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ export async function getInlayImage(id: string){

export function supportsInlayImage(){
const db = get(DataBase)
return db.aiModel.startsWith('gptv') || (db.aiModel === 'reverse_proxy' && db.proxyRequestModel?.startsWith('gptv')) || db.aiModel === 'gemini-pro-vision'
|| db.aiModel.startsWith('claude-3') || db.proxyRequestModel?.startsWith('claude-3')
return db.aiModel.startsWith('gptv') || db.aiModel === 'gemini-pro-vision' || db.aiModel.startsWith('claude-3') ||
(db.aiModel === 'reverse_proxy' && (
db.proxyRequestModel?.startsWith('gptv') || db.proxyRequestModel === 'gemini-pro-vision' || db.proxyRequestModel?.startsWith('claude-3') ||
db.proxyRequestModel === 'custom' && (
db.customProxyRequestModel?.startsWith('gptv') ||
db.customProxyRequestModel === 'gemini-pro-vision' ||
db.customProxyRequestModel?.startsWith('claude-3')
)
))
}

export async function reencodeImage(img:Uint8Array){
Expand Down
28 changes: 28 additions & 0 deletions src/ts/process/memory/termMemory.ts
Original file line number Diff line number Diff line change
@@ -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')

}
40 changes: 40 additions & 0 deletions src/ts/process/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,46 @@ 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(value.startsWith('json::')){
value = value.replace('json::', '')
try {
body[key] = JSON.parse(value)
} catch (error) {}
}
else if(isNaN(parseFloat(value))){
body[key] = value
}
else{
body[key] = parseFloat(value)
}
}
}

const res = await globalFetch(replacerURL, {
body: body,
headers: headers,
Expand Down
Loading

0 comments on commit db9149b

Please sign in to comment.