[feat] protrait
This commit is contained in:
@@ -440,5 +440,6 @@ export const languageEnglish = {
|
|||||||
additionalText: 'Additional Description',
|
additionalText: 'Additional Description',
|
||||||
seed: "Seed",
|
seed: "Seed",
|
||||||
charjs: "CharacterJS",
|
charjs: "CharacterJS",
|
||||||
depthPrompt: "Depth Prompt"
|
depthPrompt: "Depth Prompt",
|
||||||
|
largePortrait: "Large Portrait"
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
import { risuChatParser } from "src/ts/process/scripts";
|
import { risuChatParser } from "src/ts/process/scripts";
|
||||||
export let message = ''
|
export let message = ''
|
||||||
export let name = ''
|
export let name = ''
|
||||||
|
export let largePortrait = false
|
||||||
export let isLastMemory:boolean
|
export let isLastMemory:boolean
|
||||||
export let img:string|Promise<string> = ''
|
export let img:string|Promise<string> = ''
|
||||||
export let idx = -1
|
export let idx = -1
|
||||||
@@ -80,8 +81,13 @@
|
|||||||
<div class="shadow-lg bg-textcolor2 mt-2" style={`height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
<div class="shadow-lg bg-textcolor2 mt-2" style={`height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
||||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
|
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
|
||||||
{:then m}
|
{:then m}
|
||||||
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
{#if largePortrait && (!$DataBase.roundIcons)}
|
||||||
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
|
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100 / 0.75}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
||||||
|
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
|
||||||
|
{:else}
|
||||||
|
<div class="shadow-lg bg-textcolor2 mt-2" style={m + `height:${$DataBase.iconsize * 3.5 / 100}rem;width:${$DataBase.iconsize * 3.5 / 100}rem;min-width:${$DataBase.iconsize * 3.5 / 100}rem`}
|
||||||
|
class:rounded-md={!$DataBase.roundIcons} class:rounded-full={$DataBase.roundIcons} />
|
||||||
|
{/if}
|
||||||
{/await}
|
{/await}
|
||||||
<span class="flex flex-col ml-4 w-full max-w-full min-w-0">
|
<span class="flex flex-col ml-4 w-full max-w-full min-w-0">
|
||||||
<div class="flexium items-center chat">
|
<div class="flexium items-center chat">
|
||||||
|
|||||||
@@ -450,6 +450,7 @@
|
|||||||
unReroll={unReroll}
|
unReroll={unReroll}
|
||||||
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
|
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
|
||||||
character={$CurrentSimpleCharacter}
|
character={$CurrentSimpleCharacter}
|
||||||
|
largePortrait={$CurrentCharacter.largePortrait}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<Chat
|
<Chat
|
||||||
@@ -462,6 +463,7 @@
|
|||||||
img={getCharImage(findCharacterbyId(chat.saying).image, 'css')}
|
img={getCharImage(findCharacterbyId(chat.saying).image, 'css')}
|
||||||
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
|
isLastMemory={$CurrentChat.lastMemory === (chat.chatId ?? 'none') && $CurrentShowMemoryLimit}
|
||||||
character={chat.saying}
|
character={chat.saying}
|
||||||
|
largePortrait={findCharacterbyId(chat.saying).largePortrait}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
@@ -485,6 +487,7 @@
|
|||||||
img={getCharImage($CurrentCharacter.image, 'css')}
|
img={getCharImage($CurrentCharacter.image, 'css')}
|
||||||
idx={-1}
|
idx={-1}
|
||||||
altGreeting={$CurrentCharacter.alternateGreetings.length > 0}
|
altGreeting={$CurrentCharacter.alternateGreetings.length > 0}
|
||||||
|
largePortrait={$CurrentCharacter.largePortrait}
|
||||||
onReroll={() => {
|
onReroll={() => {
|
||||||
const cha = $CurrentCharacter
|
const cha = $CurrentCharacter
|
||||||
if(cha.type !== 'group'){
|
if(cha.type !== 'group'){
|
||||||
|
|||||||
@@ -283,14 +283,20 @@
|
|||||||
{#if currentChar.data.image === ''}
|
{#if currentChar.data.image === ''}
|
||||||
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" />
|
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" />
|
||||||
{:else}
|
{:else}
|
||||||
{#await getCharImage(currentChar.data.image, 'css')}
|
{#await getCharImage(currentChar.data.image, (currentChar.type === 'character' && currentChar.data.largePortrait) ? 'lgcss' : 'css')}
|
||||||
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500"></div>
|
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500"></div>
|
||||||
{:then im}
|
{:then im}
|
||||||
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" style={im} />
|
<div class="rounded-md h-32 w-32 shadow-lg bg-textcolor2 cursor-pointer hover:text-green-500" style={im} />
|
||||||
{/await}
|
{/await}
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
{#if currentChar.type === 'character' && currentChar.data.image !== ''}
|
||||||
|
<div class="flex items-center mt-4">
|
||||||
|
<Check bind:check={currentChar.data.largePortrait} name={language.largePortrait}/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if currentChar.type === 'group'}
|
{#if currentChar.type === 'group'}
|
||||||
<button
|
<button
|
||||||
on:click={makeGroupImage}
|
on:click={makeGroupImage}
|
||||||
|
|||||||
@@ -360,7 +360,8 @@ async function importSpecv2(card:CharacterCardV2, img?:Uint8Array, mode?:'hub'|'
|
|||||||
private: data?.extensions?.risuai?.private ?? false,
|
private: data?.extensions?.risuai?.private ?? false,
|
||||||
additionalText: data?.extensions?.risuai?.additionalText ?? '',
|
additionalText: data?.extensions?.risuai?.additionalText ?? '',
|
||||||
virtualscript: data?.extensions?.risuai?.virtualscript ?? '',
|
virtualscript: data?.extensions?.risuai?.virtualscript ?? '',
|
||||||
extentions: ext ?? {}
|
extentions: ext ?? {},
|
||||||
|
largePortrait: data?.extensions?.risuai?.largePortrait ?? (!data?.extensions?.risuai),
|
||||||
}
|
}
|
||||||
|
|
||||||
db.characters.push(char)
|
db.characters.push(char)
|
||||||
@@ -442,6 +443,7 @@ async function createBaseV2(char:character) {
|
|||||||
triggerscript: char.triggerscript,
|
triggerscript: char.triggerscript,
|
||||||
additionalText: char.additionalText,
|
additionalText: char.additionalText,
|
||||||
virtualscript: char.virtualscript,
|
virtualscript: char.virtualscript,
|
||||||
|
largePortrait: char.largePortrait,
|
||||||
},
|
},
|
||||||
depth_prompt: char.depth_prompt
|
depth_prompt: char.depth_prompt
|
||||||
}
|
}
|
||||||
@@ -722,6 +724,7 @@ type CharacterCardV2 = {
|
|||||||
private?:boolean
|
private?:boolean
|
||||||
additionalText?:string
|
additionalText?:string
|
||||||
virtualscript?:string
|
virtualscript?:string
|
||||||
|
largePortrait?:boolean
|
||||||
}
|
}
|
||||||
depth_prompt?: { depth: number, prompt: string }
|
depth_prompt?: { depth: number, prompt: string }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function createNewGroup(){
|
|||||||
return db.characters.length - 1
|
return db.characters.length - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCharImage(loc:string, type:'plain'|'css'|'contain') {
|
export async function getCharImage(loc:string, type:'plain'|'css'|'contain'|'lgcss') {
|
||||||
if(!loc || loc === ''){
|
if(!loc || loc === ''){
|
||||||
if(type ==='css'){
|
if(type ==='css'){
|
||||||
return ''
|
return ''
|
||||||
@@ -60,6 +60,11 @@ export async function getCharImage(loc:string, type:'plain'|'css'|'contain') {
|
|||||||
else if(type ==='css'){
|
else if(type ==='css'){
|
||||||
return `background: url("${filesrc}");background-size: cover;`
|
return `background: url("${filesrc}");background-size: cover;`
|
||||||
}
|
}
|
||||||
|
else if(type ='lgcss'){
|
||||||
|
return `background: url("${filesrc}");background-size: cover;height: 10.66rem;`
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
else{
|
else{
|
||||||
return `background: url("${filesrc}");background-size: contain;background-repeat: no-repeat;background-position: center;`
|
return `background: url("${filesrc}");background-size: contain;background-repeat: no-repeat;background-position: center;`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -581,6 +581,7 @@ export interface character{
|
|||||||
scriptstate?:{[key:string]:string|number|boolean}
|
scriptstate?:{[key:string]:string|number|boolean}
|
||||||
depth_prompt?: { depth: number, prompt: string }
|
depth_prompt?: { depth: number, prompt: string }
|
||||||
extentions?:{[key:string]:any}
|
extentions?:{[key:string]:any}
|
||||||
|
largePortrait?:boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user