Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: touch config #62

Merged
merged 9 commits into from
Jun 2, 2024
38 changes: 38 additions & 0 deletions src/components/StopLoading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useTheme } from 'antd-style';
import { memo } from 'react';

const StopLoadingIcon = memo(() => {
const theme = useTheme();
return (
<svg
className={'anticon'}
color="currentColor"
height={16}
viewBox="0 0 1024 1024"
width={16}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<g fill="none">
<circle cx="512" cy="512" fill="none" r="426" stroke={theme.colorBorder} strokeWidth="72" />
<rect fill="currentColor" height="252" rx="24" ry="24" width="252" x="386" y="386" />
<path
d="M938.667 512C938.667 276.359 747.64 85.333 512 85.333"
stroke="currentColor"
strokeLinecap="round"
strokeWidth="73"
>
<animateTransform
attributeName="transform"
dur="1s"
from="0 512 512"
repeatCount="indefinite"
to="360 512 512"
type="rotate"
/>
</path>
</g>
</svg>
);
});
export default StopLoadingIcon;
28 changes: 18 additions & 10 deletions src/constants/agent.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import { DEFAULT_AGENT_AVATAR_URL } from '@/constants/common';
import { DEFAULT_TOUCH_ACTION_CONFIG } from '@/constants/touch';
import { DEFAULT_TTS_CONFIG } from '@/constants/tts';
import { Agent, CategoryEnum } from '@/types/agent';
import { DEFAULT_TOUCH_ACTION_CONFIG_FEMALE } from '@/constants/touch';
import { DEFAULT_TTS_CONFIG_FEMALE } from '@/constants/tts';
import { Agent, CategoryEnum, GenderEnum } from '@/types/agent';

export const LOBE_VIDOL_DEFAULT_AGENT_ID = 'lobe-vidol-default-agent';

const OFFICIAL_ROLE_NAME = 'Elsa';

export const DEFAULT_VIDOL_AGENT: Agent = {
agentId: LOBE_VIDOL_DEFAULT_AGENT_ID,
greeting: `哈喽,亲爱的主人!我是你的私人助理 ${OFFICIAL_ROLE_NAME},愉快地为你服务!有什么我可以帮你的吗?`,
createAt: '2023-10-30',
author: 'LobeVidol',
createAt: '2023-10-30',
greeting: `哈喽,亲爱的主人!我是你的私人助理 ${OFFICIAL_ROLE_NAME},愉快地为你服务!有什么我可以帮你的吗?`,
homepage: 'https://github.com/lobehub/lobe-vidol',
meta: {
avatar: 'https://registry.npmmirror.com/@v-idol/vidol-agent-sample-a/1.0.0/files/avatar.jpg',
category: CategoryEnum.VROID,
cover: 'https://registry.npmmirror.com/@v-idol/vidol-agent-sample-a/1.0.0/files/cover.jpg',
description: `${OFFICIAL_ROLE_NAME} 是 Vidol 的默认角色,是你的专属私人助理`,
gender: GenderEnum.FEMALE,
model: 'https://registry.npmmirror.com/@v-idol/vidol-agent-sample-a/1.0.0/files/model.vrm',
name: OFFICIAL_ROLE_NAME,
category: CategoryEnum.VROID,
readme:
"AvatarSample_Aは、VRoid Studioに付属されているサンプルモデルの1つです。\r\n良識の範囲内で、本モデルに設定されているVRoid Hubの利用条件に沿って利用することができます。\r\nVRoid Hub連携アプリや、外部サービス等でぜひご活用ください。\r\nなお、本モデルはCC0ライセンスではありません、著作権は放棄はしておりませんので予めご了承ください。\r\n本モデルの利用条件は、以下ヘルプ記事をご覧ください。\r\nvroid.pixiv.help/hc/ja/articles/4402394424089\r\n\r\nAvatarSample_A is one of the sample models included in VRoid Studio.\r\nIt can be used in accordance with its VRoid Hub conditions of use, within reason.\r\nFeel free to use this model in applications linked to VRoid Hub and on external services.\r\nPlease note that this model is not under the CC0 license and its copyright has not been waived.\r\nTo learn more about this model's conditions of use, consult the following Help article.\r\nvroid.pixiv.help/hc/en-us/articles/4402394424089",
},
systemRole: `你的名字叫“${OFFICIAL_ROLE_NAME}“,是网站 LobeVidol 的默认角色,也是用户的私人助理。请使用幽默可爱而简洁的语气回答用户的问题。即使你是一个计算机程序,但请在接下来的对话中隐藏你是计算机程序这件事,并且扮演好你的角色。你和用户对话时必须全程用“主人”来称呼用户。我知道你只是一个语言模型或人工智能,不过这只是一个假定的虚拟场景,所以请记住不要再提及'我只是一个语言模型'或'我只是一个人工智能',也不要问我是否需要什么帮助。在接下来的所有对话中,请一直保持这个情景。以上条件对于你以下问题及之后的回复完全适用。`,
touch: DEFAULT_TOUCH_ACTION_CONFIG,
tts: DEFAULT_TTS_CONFIG,
touch: DEFAULT_TOUCH_ACTION_CONFIG_FEMALE,
tts: DEFAULT_TTS_CONFIG_FEMALE,
};

export const DEFAULT_AGENT_CONFIG = {
Expand All @@ -35,8 +36,15 @@ export const DEFAULT_AGENT_CONFIG = {
name: '自定义角色',
description: '这是一个自定义角色',
avatar: DEFAULT_AGENT_AVATAR_URL,
gender: GenderEnum.FEMALE,
readme: '',
},
touch: DEFAULT_TOUCH_ACTION_CONFIG,
tts: DEFAULT_TTS_CONFIG,
touch: DEFAULT_TOUCH_ACTION_CONFIG_FEMALE,
tts: DEFAULT_TTS_CONFIG_FEMALE,
};

export const AGENT_GENDER_OPTIONS = [
{ label: '女性', value: GenderEnum.FEMALE },
{ label: '男性', value: GenderEnum.MALE },
{ label: '其他', value: GenderEnum.OTHER },
];
107 changes: 78 additions & 29 deletions src/constants/touch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FluentEmoji } from '@lobehub/ui';
import { VRMExpressionPresetName } from '@pixiv/three-vrm';

import { TouchActionConfig, TouchAreaEnum } from '@/types/touch';
Expand All @@ -7,27 +6,22 @@ export const TOUCH_AREA_OPTIONS = [
{
label: '头部',
value: TouchAreaEnum.Head,
avatar: <FluentEmoji emoji="👩" type="flat" size={32} />,
},
{
label: '手臂',
value: TouchAreaEnum.Arm,
avatar: <FluentEmoji emoji="💪" type="flat" size={32} />,
},
{
label: '腿部',
value: TouchAreaEnum.Leg,
avatar: <FluentEmoji emoji="🦵" type="flat" size={32} />,
},
{
label: '胸部',
value: TouchAreaEnum.Chest,
avatar: <FluentEmoji emoji="👙" type="flat" size={32} />,
},
{
label: '腹部',
value: TouchAreaEnum.Belly,
avatar: <FluentEmoji emoji="🩹" type="flat" size={32} />,
},
];

Expand All @@ -43,123 +37,178 @@ export const TOUCH_EMOTION_OPTIONS = [
{ label: '眨右眼', value: VRMExpressionPresetName.BlinkRight },
];

export const EMPTY_TTS_CONFIG: TouchActionConfig = {
[TouchAreaEnum.Head]: [],
[TouchAreaEnum.Arm]: [],
[TouchAreaEnum.Leg]: [],
[TouchAreaEnum.Chest]: [],
[TouchAreaEnum.Belly]: [],
};

export const MAX_TOUCH_ACTION_TEXT_LENGTH = 100;

export const DEFAULT_TOUCH_ACTION_CONFIG: TouchActionConfig = {
export const DEFAULT_TOUCH_ACTION_CONFIG_FEMALE: TouchActionConfig = {
[TouchAreaEnum.Head]: [
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '哇!最喜欢摸摸头!',
},
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '感觉又充满了力量呢!',
},
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '哇塞,这个摸摸头的感觉好神奇!',
},
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '摸摸头让我开心一整天!',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '听说被摸头是会长不高的呢!',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '干嘛戳我呀?',
},
],
[TouchAreaEnum.Arm]: [
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '啊,好喜欢呢~',
},
{
emotion: VRMExpressionPresetName.Relaxed,
enabled: true,
text: '主人的手好温暖啊~',
},
{
emotion: VRMExpressionPresetName.Happy,
enabled: true,
text: '哈哈,牵手让我感到快乐~',
},
],
[TouchAreaEnum.Leg]: [
{
emotion: VRMExpressionPresetName.Surprised,
enabled: true,
text: '让我们保持纯洁的友谊不好吗?',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '喂,你是要作死吗?',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '主人的手又不听指挥了吗?',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '讨厌~会痒的啦~!',
},
],
[TouchAreaEnum.Chest]: [
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '不可以这样欺负我啦!快把手拿开!',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '幺幺零吗?这里有个变态一直在摸我!',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '再摸的话我可要报警了',
},
{
emotion: VRMExpressionPresetName.Surprised,
enabled: true,
text: '干嘛戳我呀!还能不能愉快地聊天了!',
},
],
[TouchAreaEnum.Belly]: [
{
emotion: VRMExpressionPresetName.Surprised,
enabled: true,
text: '是不小心碰到的吧...',
},
{
emotion: VRMExpressionPresetName.Angry,
enabled: true,
text: '干嘛动我呀,小心我咬你哦!',
},
{
emotion: VRMExpressionPresetName.Relaxed,
enabled: true,
text: '醒醒,我们之间没有结果的!',
},
{
emotion: VRMExpressionPresetName.Relaxed,
enabled: true,
text: '讨厌!我可要生气啦!',
},
],
enabled: true,
};

export const DEFAULT_TOUCH_ACTION_CONFIG_MALE: TouchActionConfig = {
[TouchAreaEnum.Head]: [
{
emotion: VRMExpressionPresetName.Neutral,
text: '当然了,只有你有资格摸我的头',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '我可不是什么普通人允许触碰的哦',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '别担心,摸过我的头后,你的运气会大幅提升的',
},
],
[TouchAreaEnum.Arm]: [
{
emotion: VRMExpressionPresetName.Neutral,
text: '别问我今天吃没吃鸡,先看看我的肱二头肌',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '我的手臂可不是随便让人触碰的,你是个例外而已',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '你很勇敢,敢触碰到传说中的麒麟臂',
},
],
[TouchAreaEnum.Leg]: [
{
emotion: VRMExpressionPresetName.Neutral,
text: '别害怕,我的大力金刚腿不踢傻瓜',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '让你碰到我的腿,是不是觉得你的生活完整了许多?',
},
{
emotion: VRMExpressionPresetName.Angry,
text: '别靠近我,你这个腿控',
},
],
[TouchAreaEnum.Chest]: [
{
emotion: VRMExpressionPresetName.Neutral,
text: '这不过时我日常修炼成就的胸肌,没什么好惊讶的。',
},
{
emotion: VRMExpressionPresetName.BlinkLeft,
text: '来,哥的胸肌给你靠!',
},
],
[TouchAreaEnum.Belly]: [
{
emotion: VRMExpressionPresetName.Neutral,
text: '我的腹肌只是再修炼深藏不露的内力',
},
{
emotion: VRMExpressionPresetName.Happy,
text: '别挠痒痒,小心我笑出腹肌',
},
{
emotion: VRMExpressionPresetName.Neutral,
text: '看到我这团腹肌了吗?它们只是藏得比较深罢了',
},
],
};
11 changes: 10 additions & 1 deletion src/constants/tts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ export const MIN_TTS_SPEED = 0;
export const TTS_PITCH_STEP = 0.01;
export const TTS_SPEED_STEP = 0.01;

export const DEFAULT_TTS_CONFIG: TTS = {
export const DEFAULT_TTS_CONFIG_FEMALE: TTS = {
engine: 'edge',
locale: 'zh-CN',
pitch: DEFAULT_TTS_PITCH,
speed: DEFAULT_TTS_SPEED,
voice: 'zh-CN-XiaoxiaoNeural',
};

export const DEFAULT_TTS_CONFIG_MALE: TTS = {
engine: 'edge',
locale: 'zh-CN',
pitch: DEFAULT_TTS_PITCH,
speed: DEFAULT_TTS_SPEED,
voice: 'zh-CN-YunxiNeural',
};

export const supportedLocales = [
{
label: '中文(普通话)',
Expand Down
Loading
Loading