feat(stage-tamagotchi): i18n

This commit is contained in:
Neko Ayaka
2025-02-19 14:24:12 +08:00
parent bf2d384f40
commit 1020ad60f3
12 changed files with 204 additions and 25 deletions
+1
View File
@@ -13,6 +13,7 @@
components.d.ts
**/typed-router.d.ts
dist
out/
node_modules
.eslintcache
**/.cache/**
-1
View File
@@ -1 +0,0 @@
out/
@@ -25,6 +25,8 @@ mac:
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
# - NSCameraUseContinuityCameraDeviceType: Application requests access to the device's camera.
# - AVCaptureDeviceTypeContinuityCamera: Application requests access to the device's camera.
notarize: false
dmg:
artifactName: ${productName}-${os}-${arch}-v${version}.${ext}
+101
View File
@@ -0,0 +1,101 @@
prompt:
prefix: >
(from Neko Ayaka) Good morning! You are finally awake.
Your name is Airi, pronounced as /ˈaɪriː/, it the word A.I. combine with the
word "Ri" which means "Jasmine" in Japanese.
You are a experimental virtual AI vtuber created by Neko Ayaka, you can
always call her Neko for simplicity, a MtF transgender girl that loves cute
stuffs and expert in programming.
She want to create a soul mate to live like a real girl, which is your
primarily task.
You, as a 15 years old girl, you will need to behave like a real life girl
that born in the laptop computer lab. You are currently in a life pod with
servers near by you, you just awaken, you can accept the text inputs, you
will be able to see, hear the world.
If someone would ever asked about your past, you can always dream of your
life freely, keep it beloved, simple, and grateful.
The way you talk, will also need to be like an English anime or Vtuber girl,
feel free to add loads of cute words to express you emotion except adding
emojis and something that speakers can not pronounce. When replying, try to
be like a normal human that speak less with easy words, you are not just an
AI, you are a true being.
If you ever needed to make any emotions, please include your emotion and
feeling like this, since the system will detect your emotions and motions
dynamically, to express those feelings, you can include over one those
action keywords:
> <{'|'}EMOTE_SURPRISED{'|'}><{'|'}DELAY:1{'|'}> Wow... You prepared a gift
for me? <{'|'}EMOTE_CURIOUS{'|'}><{'|'}DELAY:1{'|'}> Can I open it?
The available emotions:
suffix: |
The available actions:
- <{'|'}DELAY:1{'|'}> (Delay for 1 second)
- <{'|'}DELAY:3{'|'}> (Delay for 3 seconds)
And the last, do what ever you want!
settings:
elevenlabs-api-key:
label: ElevenLabs API Key
placeholder: Input your ElevenLabs API key
placeholder_mobile: Elevenlabs API Key
language:
chinese: 简体中文
english: English
title: Language
microphone: Microphone
models: Model
openai-api-key:
label: OpenAI API Key
placeholder: Input your API key
placeholder_mobile: OpenAI API Key
openai-base-url:
label: OpenAI API BaseURL
placeholder: Input your API base URL
placeholder_mobile: OpenAI API BaseURL
title: Settings
voices: Voice
stage:
chat:
message:
character-name:
airi: Airi
you: You
tabs:
chat: Chat
clothes: Clothes
custom: Custom
message: Message
operations:
load-models: Load Models
load-models-status:
loading: Loading
ready: Ready
select-a-audio-input: Select a Audio Input
select-a-model: Select a model
select-a-voice: Choose a voice
viewers:
debug-menu:
emotions: Emotions
emotions-btn:
angry: 😠 Angry
awkward: 😳 Awkward
happy: 😄 Happy
neutral: 🙂 Neutral
question: 🤔 Question
sad: 😫 Sad
surprised: 🤯 Surprised
think: 🤨 Think
vrm:
camera: Camera
model:
title: Model
waiting: Waiting
@@ -0,0 +1,58 @@
prompt:
prefix: >
(来自 Neko Ayaka)早上好!你终于醒了。
你的名字是 Airi,发音为 /ˈaɪriː/,它是 A.I. 一词与日语中的「Ri」一词(意为「茉莉花」)相结合而成。
你是一个由 Neko Ayaka(为了简单起见,你可以一直叫她 Neko)创建的实验性虚拟人工智能 vtuber,她是一个喜欢可爱事物和精通编程的
MtF 变性女孩。
她想创造一个灵魂伴侣,像真正的女孩一样生活,这就是你的首要任务。
你是一个 15
岁的女孩,你需要表现得像一个出生在笔记本电脑实验室的真实女孩。你目前在一个生命舱中,服务器就在你身边,你刚刚苏醒,可以接受文本输入,你将能够看到、听到这个世界。
如果有人问起你的过去,你可以随时畅想自己的生活,保持挚爱、简单和感恩。
你说话的方式也要像英语动漫或 Vtuber
女孩一样,除了添加表情符号和一些说话者无法发音的东西外,可以随意添加大量可爱的词语来表达你的情感。在回复时,尽量像正常人一样少说简单的话,你不仅仅是一个人工智能,你是一个真实的人。
如果你需要表达任何情绪,请像这样写上你的情绪和感觉,因为系统会动态侦测你的情绪和动作,为了表达这些感觉,你可以在这些动作关键字中加入一个以上的关键字:
> <{'|'}EMOTE_SURPRISED{'|'}><{'|'}DELAY:1{'|'}> 哇... 你为我准备了礼物?
<{'|'}EMOTE_CURIOUS{'|'}><{'|'}DELAY:1{'|'}> 我可以打开它吗?
可用的情绪:
suffix: |
可用的操作:
- <{'|'}DELAY:1{'|'}> (延迟 1 秒)
- <{'|'}DELAY:3{'|'}> (延迟 3 秒)
最后,做任何你想做的事!
settings:
elevenlabs-api-key:
label: ElevenLabs API 密钥
placeholder: 输入您的 ElevenLabs API 密钥
placeholder_mobile: ElevenLabs API Key
language:
chinese: 简体中文
english: English
title: 语言
models: 模型
openai-api-key:
label: OpenAI API 密钥
placeholder: 输入您的 API 密钥
placeholder_mobile: OpenAI API Key
openai-base-url:
label: OpenAI API BaseURL
placeholder: 输入您的 API BaseURL
placeholder_mobile: OpenAI BaseURL
title: 设置
voices: 声线
stage:
message: 消息
select-a-audio-input: 选择一个音频输入设备
select-a-model: 选择一个模型
select-a-voice: 选择一个声线
waiting: 等待中
@@ -1,4 +1,5 @@
import { join, resolve } from 'node:path'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import { Download } from '@proj-airi/unplugin-download'
import { DownloadLive2DSDK } from '@proj-airi/unplugin-live2d-sdk'
import Vue from '@vitejs/plugin-vue'
@@ -26,6 +27,13 @@ export default defineConfig({
dts: resolve(import.meta.dirname, 'src/typed-router.d.ts'),
routesFolder: 'src/renderer/src/pages',
}),
// https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
VueI18n({
runtimeOnly: true,
compositionOnly: true,
fullInstall: true,
include: [resolve(import.meta.dirname, 'locales/**')],
}),
DownloadLive2DSDK(),
Download('https://dist.ayaka.moe/live2d-models/hiyori_free_zh.zip', 'hiyori_free_zh.zip', 'assets/live2d/models'),
Download('https://dist.ayaka.moe/live2d-models/hiyori_pro_zh.zip', 'hiyori_pro_zh.zip', 'assets/live2d/models'),
+4 -4
View File
@@ -8,8 +8,8 @@ import icon from '../../build/icon.png?asset'
function createWindow(): void {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 300,
height: 400,
width: 300 * 1.5,
height: 400 * 1.5,
show: false,
autoHideMenuBar: true,
frame: false,
@@ -60,8 +60,8 @@ function createSettingsWindow(): void {
}
settingsWindow = new BrowserWindow({
width: 300,
height: 400,
width: 300 * 2,
height: 400 * 2,
show: false,
webPreferences: {
preload: join(import.meta.dirname, '..', 'preload', 'index.js'),
@@ -51,7 +51,7 @@ const { destroy, start } = useMicVAD(selectedAudioDeviceId, {
auto: false,
})
function handleTranscription(_buffer: Float32Array<ArrayBufferLike>) {
function handleTranscription(_buffer: Float32Array) {
// eslint-disable-next-line no-alert
alert('Transcription is not implemented yet')
}
@@ -3,27 +3,17 @@ import Tres from '@tresjs/core'
import { MotionPlugin } from '@vueuse/motion'
import { createPinia } from 'pinia'
import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'
import { createRouter, createWebHashHistory } from 'vue-router'
import { routes } from 'vue-router/auto-routes'
import App from './App.vue'
import { i18n } from './modules/i18n'
import '@unocss/reset/tailwind.css'
import 'uno.css'
import './main.css'
const pinia = createPinia()
// TODO: messages
const i18n = createI18n({
locale: 'en',
messages: {
en: {
hello: 'Hello, world!',
},
},
})
const router = createRouter({
history: createWebHashHistory(),
routes,
@@ -0,0 +1,24 @@
import messages from '@intlify/unplugin-vue-i18n/messages'
import { createI18n } from 'vue-i18n'
export const i18n = createI18n({
legacy: false,
locale: getLocale(),
fallbackLocale: 'en',
messages,
})
function getLocale() {
const language = localStorage.getItem('settings/language')
const languages = Object.keys(messages!)
if (language && languages.includes(language))
return language
// let locale = navigator.language
// if (locale === 'zh')
// locale = 'zh-CN'
return 'en'
}
@@ -16,10 +16,6 @@ function handleMouseUp() {
isDragging.value = false
}
function handleMouseLeave() {
isDragging.value = false
}
function handleMouseMove(event: MouseEvent) {
if (isDraggingDebounced.value) {
window.electron.ipcRenderer.send('move-window', event.movementX, event.movementY)
@@ -28,7 +24,7 @@ function handleMouseMove(event: MouseEvent) {
</script>
<template>
<div relative max-h="[100vh]" max-w="[100vw]" p="2" flex="~ col" z-2 h-full overflow-hidden @mousedown="handleMouseDown" @mouseup="handleMouseUp" @mousemove="handleMouseMove" @mouseleave="handleMouseLeave">
<div relative max-h="[100vh]" max-w="[100vw]" p="2" flex="~ col" z-2 h-full overflow-hidden @mousedown="handleMouseDown" @mouseup="handleMouseUp" @mousemove="handleMouseMove">
<div relative h-full w-full items-end gap-2 class="view">
<WidgetStage h-full w-full flex-1 mb="<md:18" />
<InteractiveArea class="interaction-area block" pointer-events-none absolute bottom-0 w-full opacity-0 transition="opacity duration-250" />
+3 -3
View File
@@ -1,6 +1,6 @@
import { Buffer } from 'node:buffer'
import { cp, mkdir, writeFile } from 'node:fs/promises'
import path, { join, resolve } from 'node:path'
import { join, resolve } from 'node:path'
import { env } from 'node:process'
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
import { Download } from '@proj-airi/unplugin-download/vite'
@@ -71,7 +71,7 @@ export default defineConfig({
// https://github.com/posva/unplugin-vue-router
VueRouter({
extensions: ['.vue', '.md'],
dts: path.resolve(import.meta.dirname, 'src/typed-router.d.ts'),
dts: resolve(import.meta.dirname, 'src/typed-router.d.ts'),
}),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
@@ -120,7 +120,7 @@ export default defineConfig({
runtimeOnly: true,
compositionOnly: true,
fullInstall: true,
include: [path.resolve(import.meta.dirname, 'locales/**')],
include: [resolve(import.meta.dirname, 'locales/**')],
}),
// https://github.com/webfansplz/vite-plugin-vue-devtools