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

feat: support korean and japanese #255

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 8 additions & 31 deletions playground/src/common/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export const LANGUAGE_OPTIONS: LanguageOptionItem[] = [
{
label: "Chinese",
value: "zh-CN"
},
{
label: "Korean",
value: "ko-KR"
},
{
label: "Japanese",
value: "ja-JP"
}
]
export const GRAPH_OPTIONS: GraphOptionItem[] = [
Expand Down Expand Up @@ -79,35 +87,4 @@ export type VendorNameMap = {

export type LanguageMap = {
[language: string]: VendorNameMap;
};

export const voiceNameMap: LanguageMap = {
"zh-CN": {
azure: {
male: "zh-CN-YunxiNeural",
female: "zh-CN-XiaoxiaoNeural",
},
elevenlabs: {
male: "pNInz6obpgDQGcFmaJgB", // Adam
female: "Xb7hH8MSUJpSbSDYk0k2", // Alice
},
polly: {
male: "Zhiyu",
female: "Zhiyu",
},
},
"en-US": {
azure: {
male: "en-US-BrianNeural",
female: "en-US-JaneNeural",
},
elevenlabs: {
male: "pNInz6obpgDQGcFmaJgB", // Adam
female: "Xb7hH8MSUJpSbSDYk0k2", // Alice
},
polly: {
male: "Matthew",
female: "Ruth",
},
},
};
75 changes: 69 additions & 6 deletions playground/src/common/graph.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,72 @@
import { voiceNameMap } from "./constant"
import { LanguageMap } from "./constant";

export const voiceNameMap: LanguageMap = {
"zh-CN": {
azure: {
male: "zh-CN-YunxiNeural",
female: "zh-CN-XiaoxiaoNeural",
},
elevenlabs: {
male: "pNInz6obpgDQGcFmaJgB", // Adam
female: "Xb7hH8MSUJpSbSDYk0k2", // Alice
},
polly: {
male: "Zhiyu",
female: "Zhiyu",
},
},
"en-US": {
azure: {
male: "en-US-BrianNeural",
female: "en-US-JaneNeural",
},
elevenlabs: {
male: "pNInz6obpgDQGcFmaJgB", // Adam
female: "Xb7hH8MSUJpSbSDYk0k2", // Alice
},
polly: {
male: "Matthew",
female: "Ruth",
},
},
"ja-JP": {
azure: {
male: "ja-JP-KeitaNeural",
female: "ja-JP-NanamiNeural",
},
},
"ko-KR": {
azure: {
male: "ko-KR-InJoonNeural",
female: "ko-KR-JiMinNeural",
},
},
};

export const getGraphProperties = (graphName: string, language: string, voiceType: string) => {
if (graphName == "camera.va.openai.azure") {
const localizationOptions = language == "en-US" ? {
"greeting": "ASTRA agent connected. How can i help you today?",
"checking_vision_text_items": "[\"Let me take a look...\",\"Let me check your camera...\",\"Please wait for a second...\"]",
} : {
let localizationOptions = {
"greeting": "ASTRA agent connected. How can i help you today?",
"checking_vision_text_items": "[\"Let me take a look...\",\"Let me check your camera...\",\"Please wait for a second...\"]",
}

if (language === "zh-CN") {
localizationOptions = {
"greeting": "Astra已连接,需要我为您提供什么帮助?",
"checking_vision_text_items": "[\"让我看看你的摄像头...\",\"让我看一下...\",\"我看一下,请稍候...\"]",
}
} else if (language === "ja-JP") {
localizationOptions = {
"greeting": "ASTRAエージェントに接続されました。今日は何をお手伝いしましょうか?",
"checking_vision_text_items": "[\"ちょっと見てみます...\",\"カメラをチェックします...\",\"少々お待ちください...\"]",
}
} else if (language === "ko-KR") {
localizationOptions = {
"greeting": "ASTRA 에이전트에 연결되었습니다. 오늘은 무엇을 도와드릴까요?",
"checking_vision_text_items": "[\"조금만 기다려 주세요...\",\"카메라를 확인해 보겠습니다...\",\"잠시만 기다려 주세요...\"]",
}
}

if (graphName == "camera.va.openai.azure") {
return {
"agora_rtc": {
"agora_asr_language": language,
Expand All @@ -25,6 +84,10 @@ export const getGraphProperties = (graphName: string, language: string, voiceTyp
"agora_rtc": {
"agora_asr_language": language,
},
"openai_chatgpt": {
"model": "gpt-4o-mini",
...localizationOptions
},
"azure_tts": {
"azure_synthesis_voice_name": voiceNameMap[language]["azure"][voiceType]
}
Expand Down
2 changes: 1 addition & 1 deletion playground/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type Language = "en-US" | "zh-CN"
export type Language = "en-US" | "zh-CN" | "ja-JP" | "ko-KR"
export type VoiceType = "male" | "female"

export interface ColorItem {
Expand Down