Skip to content

Commit 797a1e7

Browse files
authored
1.105.0 (#437)
# 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
2 parents 41dd0bb + 2287d2e commit 797a1e7

16 files changed

+237
-83
lines changed

src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "RisuAI",
11-
"version": "1.104.0"
11+
"version": "1.105.0"
1212
},
1313
"tauri": {
1414
"allowlist": {

src/App.svelte

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script lang="ts">
22
import Sidebar from './lib/SideBars/Sidebar.svelte';
3-
import {ArrowRight} from 'lucide-svelte'
4-
import { DynamicGUI, settingsOpen, sideBarStore } from './ts/stores';
3+
import { DynamicGUI, settingsOpen, sideBarStore, ShowRealmFrameStore } from './ts/stores';
54
import { DataBase, loadedStore } from './ts/storage/database';
65
import ChatScreen from './lib/ChatScreens/ChatScreen.svelte';
76
import AlertComp from './lib/Others/AlertComp.svelte';
@@ -11,6 +10,7 @@
1110
import WelcomeRisu from './lib/Others/WelcomeRisu.svelte';
1211
import Settings from './lib/Setting/Settings.svelte';
1312
import { showRealmInfoStore } from './ts/characterCards';
13+
import RealmFrame from './lib/UI/Realm/RealmFrame.svelte';
1414
1515
let didFirstSetup: boolean = false
1616
let gridOpen = false
@@ -60,4 +60,7 @@
6060
{#if $showRealmInfoStore}
6161
<RealmPopUp bind:openedData={$showRealmInfoStore} />
6262
{/if}
63+
{#if $ShowRealmFrameStore}
64+
<RealmFrame />
65+
{/if}
6366
</main>

src/etc/patchNote.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
export const patchNote = {
2-
version: "1.104",
2+
version: "1.105",
33
content:
44
`
5-
# Update 1.104
6-
- Added experimental Hypamemory V2
7-
- Added catalog list menu
8-
- Added catalog trash menu
9-
- Added trash
10-
- Now if you delete a character, it will be moved to the trash instead of being deleted permanently
11-
- You can restore the character from the trash
12-
- Characters in the trash will be deleted permanently after 3 days
5+
# Update 1.105
6+
- Reworked RisuRealm share screen
7+
- Now it uses RisuRealm iframe instead of GUI provided by app
8+
- Added RisuRealm preset sharing support
9+
- Added new preset sharing screen
10+
- Added {{first_msg_index}} CBS #436
11+
- Removed RisuRCC dude to low usage
1312
`
1413
}
1514

src/lang/en.ts

+4
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ export const languageEnglish = {
529529
memoryLimitThickness: "Memory Limit Thickness",
530530
inputCardPassword: "Input Card Password",
531531
ccv2Desc: 'Character Card V2 is is a format widely used in chatbot programs.',
532+
realmDesc: 'RisuRealm is a content sharing platform for RisuAI. you can share your character to other users.',
532533
rccDesc: 'Risu Refined Character Card is a format with additional features like password, integrity check and etc.',
533534
password: "Password",
534535
license: "License",
@@ -599,4 +600,7 @@ export const languageEnglish = {
599600
list: "List",
600601
trash: "Trash",
601602
trashDesc: "Deleted characters are moved to trash. you can restore or delete them permanently. deleted characters are automatically purged after 3 days.",
603+
shareExport: "Share/Export",
604+
risupresetDesc: "Risupreset format is a format specifically designed for RisuAI presets.",
605+
jsonDesc: "JSON format is a format that is easy to read and write for both humans and machines.",
602606
}

src/lib/Others/AlertComp.svelte

+25-23
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@
2424
let cardExportPassword = ''
2525
let cardLicense = ''
2626
let generationInfoMenuIndex = 0
27-
$: (() => {
27+
$: {
2828
if(btn){
2929
btn.focus()
3030
}
3131
if($alertStore.type !== 'input'){
3232
input = ''
3333
}
34-
35-
})()
34+
if($alertStore.type !== 'cardexport'){
35+
cardExportType = ''
36+
cardExportPassword = ''
37+
cardLicense = ''
38+
}
39+
}
3640
3741
const beautifyJSON = (data:string) =>{
3842
try {
@@ -372,7 +376,7 @@
372376
<div class="bg-darkbg rounded-md p-4 max-w-full flex flex-col w-2xl" on:click|stopPropagation>
373377
<h1 class="font-bold text-2xl w-full">
374378
<span>
375-
Export Character
379+
{language.shareExport}
376380
</span>
377381
<button class="float-right text-textcolor2 hover:text-green-500" on:click={() => {
378382
alertStore.set({
@@ -387,29 +391,27 @@
387391
<XIcon />
388392
</button>
389393
</h1>
390-
<span class="text-textcolor mt-4">Type</span>
394+
<span class="text-textcolor mt-4">{language.type}</span>
391395
{#if cardExportType === ''}
392-
<span class="text-textcolor2 text-sm">{language.ccv2Desc}</span>
396+
{#if $alertStore.submsg !== 'preset'}
397+
<span class="text-textcolor2 text-sm">{language.risupresetDesc}</span>
398+
{:else}
399+
<span class="text-textcolor2 text-sm">{language.ccv2Desc}</span>
400+
{/if}
401+
{:else if cardExportType === 'json'}
402+
<span class="text-textcolor2 text-sm">{language.jsonDesc}</span>
393403
{:else}
394-
<span class="text-textcolor2 text-sm">{language.rccDesc}</span>
404+
<span class="text-textcolor2 text-sm">{language.realmDesc}</span>
395405
{/if}
396406
<div class="flex items-center flex-wrap mt-2">
397-
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V2</button>
398-
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'rcc'} on:click={() => {cardExportType = 'rcc'}}>Risu RCC</button>
407+
{#if $alertStore.submsg === 'preset'}
408+
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Risupreset</button>
409+
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'json'} on:click={() => {cardExportType = 'json'}}>JSON</button>
410+
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'realm'} on:click={() => {cardExportType = 'realm'}}>RisuRealm</button>
411+
{:else}
412+
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V2</button>
413+
{/if}
399414
</div>
400-
{#if cardExportType === 'rcc'}
401-
<span class="text-textcolor mt-4">{language.password}</span>
402-
<span class="text-textcolor2 text-sm">{language.passwordDesc}</span>
403-
<TextInput placeholder="" bind:value={cardExportPassword} />
404-
<span class="text-textcolor mt-4">{language.license}</span>
405-
<span class="text-textcolor2 text-sm">{language.licenseDesc}</span>
406-
<SelectInput bind:value={cardLicense}>
407-
<OptionInput value="">None</OptionInput>
408-
{#each Object.keys(CCLicenseData) as ccl}
409-
<OptionInput value={ccl}>{CCLicenseData[ccl][2]} ({CCLicenseData[ccl][1]})</OptionInput>
410-
{/each}
411-
</SelectInput>
412-
{/if}
413415
<Button className="mt-4" on:click={() => {
414416
alertStore.set({
415417
type: 'none',
@@ -419,7 +421,7 @@
419421
license: cardLicense
420422
})
421423
})
422-
}}>{language.export}</Button>
424+
}}>{cardExportType === 'realm' ? language.shareCloud : language.export}</Button>
423425
</div>
424426
</div>
425427

src/lib/Setting/botpreset.svelte

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<script>
2-
import { alertConfirm, alertError } from "../../ts/alert";
1+
<script lang="ts">
2+
import { alertCardExport, alertConfirm, alertError } from "../../ts/alert";
33
import { language } from "../../lang";
4-
import { DataBase, changeToPreset, copyPreset, downloadPreset, importPreset, presetTemplate } from "../../ts/storage/database";
5-
import { CopyIcon, DownloadIcon, EditIcon, FolderUpIcon, PlusIcon, TrashIcon, XIcon } from "lucide-svelte";
4+
import { DataBase, changeToPreset, copyPreset, downloadPreset, importPreset } from "../../ts/storage/database";
5+
import { CopyIcon, Share2Icon, PencilIcon, FolderUpIcon, PlusIcon, TrashIcon, XIcon } from "lucide-svelte";
66
import TextInput from "../UI/GUI/TextInput.svelte";
77
import { prebuiltPresets } from "src/ts/process/templates/templates";
8+
import { ShowRealmFrameStore } from "src/ts/stores";
89
910
let editMode = false
1011
export let close = () => {}
@@ -43,12 +44,26 @@
4344
}}>
4445
<CopyIcon size={18}/>
4546
</button>
46-
<button class="text-textcolor2 hover:text-green-500 cursor-pointer mr-2" on:click={(e) => {
47+
<button class="text-textcolor2 hover:text-green-500 cursor-pointer mr-2" on:click={async (e) => {
4748
e.stopPropagation()
48-
downloadPreset(i)
49+
const data = await alertCardExport('preset')
50+
console.log(data.type)
51+
if(data.type === ''){
52+
downloadPreset(i, 'risupreset')
53+
}
54+
if(data.type === 'json'){
55+
downloadPreset(i, 'json')
56+
}
57+
if(data.type === 'realm'){
58+
if(!$DataBase.account){
59+
alertError(language.notLoggedIn)
60+
return
61+
}
62+
$ShowRealmFrameStore = `preset:${i}`
63+
}
4964
}}>
5065

51-
<DownloadIcon size={18} />
66+
<Share2Icon size={18} />
5267
</button>
5368
<button class="text-textcolor2 hover:text-green-500 cursor-pointer" on:click={async (e) => {
5469
e.stopPropagation()
@@ -89,7 +104,7 @@
89104
<button class="text-textcolor2 hover:text-green-500 cursor-pointer" on:click={() => {
90105
editMode = !editMode
91106
}}>
92-
<EditIcon size={18}/>
107+
<PencilIcon size={18}/>
93108
</button>
94109
</div>
95110
<span class="text-textcolor2 text-sm">{language.quickPreset}</span>

src/lib/SideBars/CharConfig.svelte

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { language } from "../../lang";
33
import { tokenizeAccurate } from "../../ts/tokenizer";
44
import { DataBase, saveImage as saveAsset, type Database, type character, type groupChat } from "../../ts/storage/database";
5-
import { selectedCharID } from "../../ts/stores";
5+
import { ShowRealmFrameStore, selectedCharID } from "../../ts/stores";
66
import { PlusIcon, SmileIcon, TrashIcon, UserIcon, ActivityIcon, BookIcon, User, CurlyBraces, Volume2Icon } from 'lucide-svelte'
77
import Check from "../UI/GUI/CheckInput.svelte";
88
import { addCharEmotion, addingEmotion, getCharImage, rmCharEmotion, selectCharImg, makeGroupImage, removeChar } from "../../ts/characters";
@@ -17,7 +17,6 @@
1717
import { getElevenTTSVoices, getWebSpeechTTSVoices, getVOICEVOXVoices, oaiVoices, getNovelAIVoices, FixNAITTS } from "src/ts/process/tts";
1818
import { checkCharOrder, getFileSrc } from "src/ts/storage/globalApi";
1919
import { addGroupChar, rmCharFromGroup } from "src/ts/process/group";
20-
import RealmUpload from "../UI/Realm/RealmUpload.svelte";
2120
import TextInput from "../UI/GUI/TextInput.svelte";
2221
import NumberInput from "../UI/GUI/NumberInput.svelte";
2322
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
@@ -30,11 +29,9 @@
3029
import { updateInlayScreen } from "src/ts/process/inlayScreen";
3130
import { registerOnnxModel } from "src/ts/process/transformers";
3231
import MultiLangInput from "../UI/GUI/MultiLangInput.svelte";
33-
import { shareRealmCard } from "src/ts/realm";
3432
3533
3634
let subMenu = 0
37-
let openHubUpload = false
3835
let emos:[string, string][] = []
3936
let tokens = {
4037
desc: 0,
@@ -833,7 +830,7 @@
833830
|| $DataBase.tpo
834831
}
835832
<Button size="lg" on:click={async () => {
836-
exportChar($selectedCharID)
833+
const res = await exportChar($selectedCharID)
837834
}} className="mt-2">{language.exportCharacter}</Button>
838835
{/if}
839836

@@ -846,8 +843,7 @@
846843
return
847844
}
848845
if(await alertTOS()){
849-
// openHubUpload = true
850-
shareRealmCard()
846+
$ShowRealmFrameStore = 'character'
851847
}
852848
}} className="mt-2">
853849
{#if currentChar.data.realmId}
@@ -857,10 +853,6 @@
857853
{/if}
858854
</Button>
859855
{/if}
860-
861-
{#if openHubUpload}
862-
<RealmUpload bind:char={currentChar.data} close={() => {openHubUpload=false}}/>
863-
{/if}
864856
{:else}
865857
{#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4 || currentChar.data.supaMemory}
866858
<span class="text-textcolor">{language.SuperMemory}</span>

src/lib/UI/Realm/RealmFrame.svelte

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<script lang="ts">
2+
import { alertMd } from "src/ts/alert";
3+
import { shareRealmCardData } from "src/ts/realm";
4+
import { DataBase, downloadPreset } from "src/ts/storage/database";
5+
import { CurrentCharacter, ShowRealmFrameStore } from "src/ts/stores";
6+
import { sleep } from "src/ts/util";
7+
import { onDestroy, onMount } from "svelte";
8+
9+
const close = () => {
10+
$ShowRealmFrameStore = ''
11+
}
12+
let iframe: HTMLIFrameElement = null
13+
const tk = $DataBase?.account?.token;
14+
const id = $DataBase?.account?.id
15+
let loadingStage = 0
16+
let pongGot = false
17+
18+
const pmfunc = (e:MessageEvent) => {
19+
if(e.data.type === 'filedata' && e.data.success){
20+
loadingStage = 2
21+
}
22+
if(e.data.type === 'pong'){
23+
pongGot = true
24+
}
25+
if(e.data.type === 'close'){
26+
close()
27+
}
28+
if(e.data.type === 'success'){
29+
alertMd(`## Upload Success\n\nYour character has been uploaded to Realm successfully.\n\n${"```\nhttps://realm.risuai.net/character/" + e.data.id + "\n```"}`)
30+
if($ShowRealmFrameStore.startsWith('preset')){
31+
//TODO, add preset edit
32+
}
33+
else if($CurrentCharacter.type === 'character'){
34+
loadingStage = 0
35+
$CurrentCharacter.realmId = e.data.id
36+
}
37+
close()
38+
}
39+
}
40+
41+
const waitPing = async () => {
42+
if(iframe){
43+
while(!pongGot){
44+
iframe.contentWindow.postMessage({
45+
type: 'ping'
46+
}, '*')
47+
await sleep(300)
48+
}
49+
}
50+
}
51+
52+
onMount(async () => {
53+
window.addEventListener('message', pmfunc)
54+
55+
let data:{
56+
data: ArrayBuffer,
57+
name: ArrayBuffer
58+
}
59+
60+
if($ShowRealmFrameStore.startsWith('preset')){
61+
const predata = await downloadPreset(Number($ShowRealmFrameStore.split(':')[1]), 'return')
62+
const encodedPredata = predata.buf
63+
const encodedPredataName = new TextEncoder().encode(predata.data.name + '.risupreset')
64+
data = {
65+
data: encodedPredata.buffer,
66+
name: encodedPredataName.buffer
67+
}
68+
}
69+
else{
70+
data = await shareRealmCardData()
71+
}
72+
73+
if(iframe){
74+
await waitPing()
75+
loadingStage = 1
76+
iframe.contentWindow.postMessage({
77+
type: 'filedata',
78+
buf: [data.data, data.name]
79+
}, '*', [data.data, data.name])
80+
}
81+
})
82+
83+
const getUrl = () => {
84+
let url = `https://realm.risuai.net/upload?token=${tk}&token_id=${id}`
85+
if($ShowRealmFrameStore.startsWith('preset')){
86+
//TODO, add preset edit
87+
}
88+
else if($CurrentCharacter.type === 'character' && $CurrentCharacter.realmId){
89+
url += `&edit=${$CurrentCharacter.realmId}&edit-type=normal`
90+
}
91+
url += '#noLayout'
92+
return url
93+
}
94+
95+
onDestroy(() => {
96+
window.removeEventListener('message', pmfunc)
97+
})
98+
</script>
99+
100+
<div class="top-0 left-0 z-50 fixed w-full h-full flex flex-col justify-center items-center text-textcolor bg-white">
101+
<div class="bg-darkbg border-b border-b-darkborderc w-full flex p-2">
102+
<h1 class="text-2xl font-bold max-w-full overflow-hidden whitespace-nowrap text-ellipsis">Upload to Realm</h1>
103+
<button class="text-textcolor text-lg hover:text-red-500 ml-auto" on:click={close}>&times;</button>
104+
</div>
105+
{#if loadingStage < 1}
106+
<div class="w-full flex justify-center items-center p-4 flex-1">
107+
<div class="loadmove"/>
108+
</div>
109+
{/if}
110+
<iframe bind:this={iframe}
111+
src={getUrl()}
112+
title="upload" class="w-full flex-1" class:hidden={loadingStage < 1}
113+
/>
114+
</div>

0 commit comments

Comments
 (0)