diff --git a/playground/src/common/constant.ts b/playground/src/common/constant.ts index 2d8f809b..a2b2db83 100644 --- a/playground/src/common/constant.ts +++ b/playground/src/common/constant.ts @@ -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[] = [ @@ -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", - }, - }, }; \ No newline at end of file diff --git a/playground/src/common/graph.ts b/playground/src/common/graph.ts index 7312f1f4..523ee14b 100644 --- a/playground/src/common/graph.ts +++ b/playground/src/common/graph.ts @@ -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, @@ -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] } diff --git a/playground/src/types/index.ts b/playground/src/types/index.ts index 099e7069..02c6bd70 100644 --- a/playground/src/types/index.ts +++ b/playground/src/types/index.ts @@ -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 {