Skip to content

Commit

Permalink
Add persona portraits with lesser change (#289)
Browse files Browse the repository at this point in the history
# PR Checklist
- [x] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [x] 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?
- [x] Did you added a type def?

# Description

![image](https://github.com/kwaroran/RisuAI/assets/157843588/11d2347e-5957-4e2d-bce0-fcf8c670410c)

![image](https://github.com/kwaroran/RisuAI/assets/157843588/a3c222a1-8adb-4ec9-a016-1baeee918e6f)
  • Loading branch information
kwaroran authored Feb 6, 2024
2 parents 2b223b2 + 28bdea7 commit ca31eaf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ export const languageEnglish = {
license: "License",
licenseDesc: "You can choose license for the downloaders to limit the usages of your card's prompt.",
passwordDesc: "You can set a password to protect your card from unauthorized access.",
largePersonaPortrait: "Persona Portrait",
module: "Module",
modules: "Modules",
noModules: "No modules has been installed.",
Expand Down
1 change: 1 addition & 0 deletions src/lang/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,5 @@ export const languageKorean = {
template: "템플릿",
editTranslationDisplay: "번역문 수정",
memoryLimitThickness: "기억 한계선 두께",
largePersonaPortrait: "페르소나 세로 이미지",
}
1 change: 1 addition & 0 deletions src/lib/ChatScreens/DefaultChatScreen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@
message={chat.data}
img={getCharImage($CurrentUserIcon, 'css')}
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
largePortrait={$DataBase.personas[$DataBase.selectedPersona].largePortrait}
/>
{/if}
{/each}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/Setting/Pages/PersonaSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { language } from "src/lang";
import BaseRoundedButton from "src/lib/UI/BaseRoundedButton.svelte";
import Button from "src/lib/UI/GUI/Button.svelte";
import Check from "src/lib/UI/GUI/CheckInput.svelte";
import TextAreaInput from "src/lib/UI/GUI/TextAreaInput.svelte";
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
import { alertConfirm, alertError, alertSelect } from "src/ts/alert";
Expand Down Expand Up @@ -69,7 +70,7 @@
{#if $DataBase.userIcon === ''}
<div class="rounded-md h-28 w-28 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" />
{:else}
{#await getCharImage($DataBase.userIcon, 'css')}
{#await getCharImage($DataBase.userIcon, $DataBase.personas[$DataBase.selectedPersona].largePortrait ? 'lgcss' : 'css')}
<div class="rounded-md h-28 w-28 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" />
{:then im}
<div class="rounded-md h-28 w-28 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" style={im} />
Expand Down Expand Up @@ -99,6 +100,7 @@
changeUserPersona(0, 'noSave')
}
}}>{language.remove}</Button>
<Check bind:check={$DataBase.personas[$DataBase.selectedPersona].largePortrait}>{language.largePortrait}</Check>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion src/ts/persona.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export function saveUserPersona() {
db.personas[db.selectedPersona] = {
name: db.username,
icon: db.userIcon,
personaPrompt: db.personaPrompt
personaPrompt: db.personaPrompt,
largePortrait: db.personas[db.selectedPersona]?.largePortrait,
}
setDatabase(db)
}
Expand Down
1 change: 1 addition & 0 deletions src/ts/storage/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ export interface Database{
personaPrompt:string
name:string
icon:string
largePortrait?:boolean
}[]
assetWidth:number
animationSpeed:number
Expand Down

0 comments on commit ca31eaf

Please sign in to comment.