Skip to content

Commit

Permalink
Merge pull request #10 from lobehub/feat/update-schema
Browse files Browse the repository at this point in the history
feat: add gender and touch config
  • Loading branch information
rdmclin2 authored May 28, 2024
2 parents 3206feb + bc36cf7 commit badb1ac
Show file tree
Hide file tree
Showing 13 changed files with 324 additions and 28 deletions.
189 changes: 189 additions & 0 deletions schema/vidolAgentSchema_v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
{
"type": "object",
"properties": {
"agentId": {
"type": "string"
},
"author": {
"type": "string"
},
"homepage": {
"type": "string"
},
"tts": {
"type": "object",
"properties": {
"engine": {
"type": "string"
},
"locale": {
"type": "string"
},
"voice": {
"type": "string"
},
"speed": {
"type": "number",
"minimum": 0,
"maximum": 3,
"default": 1
},
"pitch": {
"type": "number",
"minimum": 0,
"maximum": 2,
"default": 1
}
},
"required": [
"engine",
"locale",
"voice"
],
"additionalProperties": false
},
"touch": {
"type": "object",
"properties": {
"header": {
"type": "array",
"items": {
"type": "object",
"properties": {
"emotion": {
"type": "string",
"enum": [
"happy",
"angry",
"sad",
"surprised",
"relaxed",
"neutral",
"blink",
"blinkLeft",
"blinkRight"
]
},
"motion": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"text"
],
"additionalProperties": false
}
},
"arm": {
"type": "array",
"items": {
"$ref": "#/properties/touch/properties/header/items"
}
},
"leg": {
"type": "array",
"items": {
"$ref": "#/properties/touch/properties/header/items"
}
},
"chest": {
"type": "array",
"items": {
"$ref": "#/properties/touch/properties/header/items"
}
},
"belly": {
"type": "array",
"items": {
"$ref": "#/properties/touch/properties/header/items"
}
}
},
"additionalProperties": false
},
"meta": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"gender": {
"type": "string",
"enum": [
"Male",
"Female",
"Other"
]
},
"homepage": {
"type": "string"
},
"model": {
"type": "string"
},
"cover": {
"type": "string"
},
"avatar": {
"type": "string"
},
"category": {
"type": "string",
"enum": [
"Anime",
"Game",
"Realistic",
"VTuber",
"Book",
"History",
"Movie",
"Animal",
"Vroid",
"Other"
]
},
"readme": {
"type": "string"
}
},
"required": [
"name",
"description",
"gender",
"cover",
"avatar"
],
"additionalProperties": false
},
"systemRole": {
"type": "string"
},
"greeting": {
"type": "string"
},
"createAt": {
"type": "string"
},
"schemaVersion": {
"type": "number"
}
},
"required": [
"agentId",
"author",
"homepage",
"meta",
"systemRole",
"greeting",
"createAt",
"schemaVersion"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
52 changes: 52 additions & 0 deletions schema/vidolDanceSchema_v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"type": "object",
"properties": {
"danceId": {
"type": "string"
},
"name": {
"type": "string"
},
"src": {
"type": "string"
},
"author": {
"type": "string"
},
"homepage": {
"type": "string"
},
"audio": {
"type": "string"
},
"cover": {
"type": "string"
},
"thumb": {
"type": "string"
},
"readme": {
"type": "string"
},
"createAt": {
"type": "string"
},
"schemaVersion": {
"type": "number"
}
},
"required": [
"danceId",
"name",
"src",
"author",
"homepage",
"audio",
"cover",
"thumb",
"createAt",
"schemaVersion"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
52 changes: 30 additions & 22 deletions scripts/schema/agent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
import { z } from "zod";
import {z} from "zod";
import {CategoryEnum, GenderEnum, EmotionEnum} from "./enum";

export const TouchActionSchema = z.object({
emotion: EmotionEnum.optional(),
motion: z.string().optional(),
text: z.string(),
});

export const TouchActionConfigSchema = z.object({
header: z.array(TouchActionSchema).optional(),
arm: z.array(TouchActionSchema).optional(),
leg: z.array(TouchActionSchema).optional(),
chest: z.array(TouchActionSchema).optional(),
belly: z.array(TouchActionSchema).optional(),
})

/**
* TTS Schema
Expand Down Expand Up @@ -26,44 +41,33 @@ export const TTSSchema = z.object({
pitch: z.number().gte(0).lte(2.0).default(1.0).optional(),
});

/**
* Category Enum, 当前包括 Anime, Game, Realistic, VTuber, Book, History, Movie, Animal, Vroid
*/
const CategoryEnum = z.enum([
"Anime",
"Game",
"Realistic",
"VTuber",
"Book",
"History",
"Movie",
"Animal",
"Vroid",
]);

export const MetaSchema = z.object({
/**
* 模型名称
* 角色名
*/
name: z.string(),
/**
* 模型描述
* 角色描述
*/
description: z.string(),
/**
* 模型主页,比如 Vroid Hub 链接
* 角色性别
*/
gender: GenderEnum,
/**
* 角色主页,比如 Vroid Hub 链接
*/
homepage: z.string().optional(),
/**
* 模型地址
*/
model: z.string(),
model: z.string().optional(),
/**
* 模型封面图片地址, 推荐尺寸 300 * 400 倍数
* 角色封面图片地址, 推荐尺寸 320 * 480 倍数
*/
cover: z.string(),
/**
* 模型头像图片地址,推荐尺寸 150 * 150 倍数
* 角色头像图片地址,推荐尺寸 256 * 256 倍数
*/
avatar: z.string(),
/**
Expand Down Expand Up @@ -96,6 +100,10 @@ export const VidolAgentSchema = z.object({
* 语音合成配置
*/
tts: TTSSchema.optional(),
/**
* 触摸配置
*/
touch: TouchActionConfigSchema.optional(),
/**
* 角色元信息
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/schema/dance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ export const VidolDanceSchema = z.object({
*/
audio: z.string(),
/**
* 封面图片地址,推荐尺寸 300 * 400 倍数
* 封面图片地址,推荐尺寸 320 * 480 倍数
*/
cover: z.string(),
/**
* 缩略图地址,推荐尺寸 128 * 128 倍数
* 缩略图地址,推荐尺寸 256 * 256 倍数
*/
thumb: z.string(),
/**
* 说明文字
*/
readme: z.string(),
readme: z.string().optional(),
/**
* 创建时间
*/
Expand Down
35 changes: 35 additions & 0 deletions scripts/schema/enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {z} from "zod";

/**
* Category Enum, 当前包括 Anime, Game, Realistic, VTuber, Book, History, Movie, Animal, Vroid, Other
*/
export const CategoryEnum = z.enum([
"Anime",
"Game",
"Realistic",
"VTuber",
"Book",
"History",
"Movie",
"Animal",
"Vroid",
"Other"
]);

export const GenderEnum = z.enum([
"Male",
"Female",
"Other"
]);

export const EmotionEnum = z.enum([
"happy",
"angry",
"sad",
"surprised",
"relaxed",
"neutral",
"blink",
"blinkLeft",
"blinkRight",
]);
1 change: 1 addition & 0 deletions src/agents/vidol-agent-bronya.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"meta": {
"name": "布洛妮娅",
"category": "Game",
"gender": "Female",
"description": "布洛妮娅是崩坏星穹铁道中的角色",
"homepage": "https://hub.vroid.com/characters/8492290223992997626/models/1864405023120034389",
"model": "https://registry.npmmirror.com/@v-idol/vidol-agent-bronya/1.0.0/files/model.vrm",
Expand Down
Loading

0 comments on commit badb1ac

Please sign in to comment.