add alert warning in charx
This commit is contained in:
@@ -654,4 +654,5 @@ export const languageEnglish = {
|
||||
font: "Font",
|
||||
lineHeight: "Line Height",
|
||||
loadAutoServerBackup: "Load Auto Server Backup",
|
||||
notCharxWarn: "This character uses multiple assets. it is recommended to export this character as a CharX format for better compatibility.",
|
||||
}
|
||||
@@ -5,20 +5,19 @@
|
||||
import { ParseMarkdown } from '../../ts/parser';
|
||||
import BarIcon from '../SideBars/BarIcon.svelte';
|
||||
import { ChevronRightIcon, User } from 'lucide-svelte';
|
||||
import { hubURL } from 'src/ts/characterCards';
|
||||
import { hubURL, isCharacterHasAssets } from 'src/ts/characterCards';
|
||||
import TextInput from '../UI/GUI/TextInput.svelte';
|
||||
import { openURL } from 'src/ts/storage/globalApi';
|
||||
import Button from '../UI/GUI/Button.svelte';
|
||||
import { XIcon } from "lucide-svelte";
|
||||
import SelectInput from "../UI/GUI/SelectInput.svelte";
|
||||
import { CCLicenseData } from "src/ts/creation/license";
|
||||
import OptionInput from "../UI/GUI/OptionInput.svelte";
|
||||
import { language } from 'src/lang';
|
||||
import { getFetchData } from 'src/ts/storage/globalApi';
|
||||
import { CurrentChat } from "src/ts/stores";
|
||||
import { CurrentChat, CurrentCharacter } from "src/ts/stores";
|
||||
import { tokenize } from "src/ts/tokenizer";
|
||||
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
|
||||
import ModuleChatMenu from "../Setting/Pages/Module/ModuleChatMenu.svelte";
|
||||
import ModuleChatMenu from "../Setting/Pages/Module/ModuleChatMenu.svelte";
|
||||
let btn
|
||||
let input = ''
|
||||
let cardExportType = 'realm'
|
||||
@@ -399,6 +398,9 @@
|
||||
<span class="text-textcolor2 text-sm">{language.risupresetDesc}</span>
|
||||
{:else}
|
||||
<span class="text-textcolor2 text-sm">{language.ccv3Desc}</span>
|
||||
{#if cardExportType2 !== 'charx' && isCharacterHasAssets($CurrentCharacter)}
|
||||
<span class="text-red-500 text-sm">{language.notCharxWarn}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{:else if cardExportType === 'json'}
|
||||
<span class="text-textcolor2 text-sm">{language.jsonDesc}</span>
|
||||
@@ -417,7 +419,10 @@
|
||||
<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>
|
||||
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>JSON</button>
|
||||
{:else}
|
||||
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === 'realm'} on:click={() => {cardExportType = 'realm'}}>RisuRealm</button>
|
||||
<button class="bg-bgcolor px-2 py-4 rounded-lg flex-1" class:ring-1={cardExportType === 'realm'} on:click={() => {
|
||||
cardExportType = 'realm'
|
||||
cardExportType2 = isCharacterHasAssets($CurrentCharacter) ? 'charx' : ''
|
||||
}}>RisuRealm</button>
|
||||
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === ''} on:click={() => {cardExportType = ''}}>Character Card V3</button>
|
||||
<button class="bg-bgcolor px-2 py-4 rounded-lg ml-2 flex-1" class:ring-1={cardExportType === 'ccv2'} on:click={() => {cardExportType = 'ccv2'}}>Character Card V2</button>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { get, writable, type Writable } from "svelte/store"
|
||||
import { alertCardExport, alertConfirm, alertError, alertInput, alertMd, alertNormal, alertSelect, alertStore, alertTOS, alertWait } from "./alert"
|
||||
import { DataBase, defaultSdDataFunc, type character, setDatabase, type customscript, type loreSettings, type loreBook, type triggerscript, importPreset } from "./storage/database"
|
||||
import { DataBase, defaultSdDataFunc, type character, setDatabase, type customscript, type loreSettings, type loreBook, type triggerscript, importPreset, type groupChat } from "./storage/database"
|
||||
import { checkNullish, decryptBuffer, encryptBuffer, isKnownUri, selectFileByDom, selectMultipleFile, sleep } from "./util"
|
||||
import { language } from "src/lang"
|
||||
import { v4 as uuidv4, v4 } from 'uuid';
|
||||
@@ -1309,6 +1309,25 @@ export async function getHubResources(id:string) {
|
||||
return Buffer.from(await (res).arrayBuffer())
|
||||
}
|
||||
|
||||
export function isCharacterHasAssets(char:character|groupChat){
|
||||
if(char.type === 'group'){
|
||||
return false
|
||||
}
|
||||
|
||||
if(char.additionalAssets && char.additionalAssets.length > 0){
|
||||
return true
|
||||
}
|
||||
|
||||
if(char.emotionImages && char.emotionImages.length > 0){
|
||||
return true
|
||||
}
|
||||
|
||||
if(char.ccAssets && char.ccAssets.length > 0){
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
type CharacterCardV2Risu = {
|
||||
|
||||
Reference in New Issue
Block a user