|
|
import{W as e,at as t,b as n}from"./vue.runtime.esm-bundler-_ZPRHVd_.js";import{a as r,i,t as a}from"./resettable-CbXzRviW.js";import{d as o,r as s,t as c}from"./speech-6W29lyZ_.js";import{n as l}from"./vue-i18n.runtime-Dah5zGm4.js";import{n as u}from"./index.browser-Dc5HQ32a.js";const d=i(`airi-card`,()=>{let[i,d]=a(`airi-cards`,new Map),[f,p]=a(`airi-card-active-id`,`default`),m=n(()=>i.value.get(f.value)),h=s(),g=c(),{activeModel:_}=r(h),{activeSpeechVoiceId:v,activeSpeechModel:y}=r(g),b=e=>{let t=u();return i.value.set(t,w(e)),t},x=e=>{i.value.delete(e)},S=e=>i.value.get(e);function C(e){let t=`data`in e?e.data?.extensions?.airi:e.extensions?.airi,n={consciousness:{model:_.value},speech:{model:y.value,voice_id:v.value}};return t?{modules:{consciousness:{model:t.modules?.consciousness?.model??n.consciousness.model},speech:{model:t.modules?.speech?.model??n.speech.model,voice_id:t.modules?.speech?.voice_id??n.speech.voice_id,pitch:t.modules?.speech?.pitch,rate:t.modules?.speech?.rate,ssml:t.modules?.speech?.ssml,language:t.modules?.speech?.language},vrm:t.modules?.vrm,live2d:t.modules?.live2d},agents:t.agents??{}}:{modules:n,agents:{}}}function w(e){if(`data`in e){let t=e;return{name:t.data.name,version:t.data.character_version??`1.0.0`,description:t.data.description??``,creator:t.data.creator??``,notes:t.data.creator_notes??``,notesMultilingual:t.data.creator_notes_multilingual,personality:t.data.personality??``,scenario:t.data.scenario??``,greetings:[t.data.first_mes,...t.data.alternate_greetings??[]],greetingsGroupOnly:t.data.group_only_greetings??[],systemPrompt:t.data.system_prompt??``,postHistoryInstructions:t.data.post_history_instructions??``,messageExample:t.data.mes_example?t.data.mes_example.split(`<START> |
|
|
`).map(e=>{if(e.startsWith(`{{char}}:`)||e.startsWith(`{{user}}:`))return e;throw Error(`Invalid message example format: ${e}`)})):[],tags:t.data.tags??[],extensions:{airi:C(t),...t.data.extensions}}}return{...e,extensions:{airi:C(e),...e.extensions}}}e(()=>{let{t:e}=l();i.value.set(`default`,w({name:`ReLU`,version:`1.0.0`,description:o(e(`base.prompt.prefix`),e(`base.prompt.suffix`)).content}))}),t(m,e=>{if(!e)return;let t=C(e);t&&(_.value=t?.modules?.consciousness?.model,y.value=t?.modules?.speech?.model,v.value=t?.modules?.speech?.voice_id)});function T(){p(),d()}return{cards:i,activeCard:m,activeCardId:f,addCard:b,removeCard:x,getCard:S,resetState:T,currentModels:n(()=>({consciousness:{model:_.value},speech:{model:y.value,voice_id:v.value}})),systemPrompt:n(()=>{let e=m.value;return e?[e.systemPrompt,e.description,e.personality].filter(Boolean).join(` |