Skip to content

Conversation

@Chen188
Copy link
Owner

@Chen188 Chen188 commented Dec 17, 2025

概述 (Overview)

本 PR 增强了 Amazon Nova Sonic v2 的支持,确保前端正确传递所有必需参数到后端,并验证了语音类型映射配置的完整性。

This PR enhances Amazon Nova Sonic v2 support by ensuring all required parameters are correctly passed from frontend to backend and verifying voice type mapping configuration completeness.

实现的需求 (Requirements Implemented)

前端更改 (Frontend Changes)

playground/src/components/header/ConnectButton/index.tsx 中修复参数传递:

  • ✅ 添加 novaSonicWsUrl: novaSonicWsUrl 参数传递(第115行)
  • ✅ 添加 turnTakingPauseSensitivity: turnTakingPauseSensitivity 参数传递(第116行)
  • ✅ 验证 voiceType: voice 参数正确传递(第104行)

后端更改 (Backend Changes)

server/internal/config.go 中验证语音映射:

  • ✅ 验证 voiceNameMap 正确包含 male 和 female 的映射关系(第204-241行)
  • ✅ 包括多语言支持(中文、英文、英式英语等)的语音映射
  • ✅ Nova Sonic 扩展的男声/女声配置完整

server/internal/http_server.go 中验证字段定义:

  • VoiceType 字段正确定义和处理(第57行)
  • TurnTakingPauseSensitivity 字段正确定义和处理(第67行)
  • NovaSonicWsUrl 字段正确定义和处理(第66行)

技术细节 (Technical Details)

参数流程 (Parameter Flow)

  1. 前端采集:用户在设置界面选择语音类型、对话暂停敏感度和 Nova Sonic WebSocket URL
  2. API 调用ConnectButton 组件通过 apiStartService 将参数传递给后端
  3. 后端处理http_server.go 中的请求结构体接收并验证参数
  4. 配置映射config.go 中的 voiceNameMap 将抽象的语音类型(male/female)映射到具体的语音标识

关键改进 (Key Improvements)

  • 🔧 确保 Nova Sonic v2 的 WebSocket URL 可配置
  • 🎯 支持细粒度的对话暂停敏感度控制
  • 🗣️ 完整的多语言语音类型映射支持
  • ✨ 增强的参数验证和错误处理

验证方法 (Verification Methods)

前端验证 (Frontend Verification)

# 使用 Dockerfile 构建和验证前端
cd /projects/sandbox/TEN-Agent/playground
docker build -f Dockerfile .

后端验证 (Backend Verification)

# 使用 Dockerfile 构建和验证后端
cd /projects/sandbox/TEN-Agent
docker build -f Dockerfile .

测试建议 (Testing Recommendations)

  1. 参数传递测试:验证所有参数从前端正确传递到后端
  2. 语音类型测试:测试不同语言下 male 和 female 语音选项
  3. Nova Sonic 连接测试:使用自定义 WebSocket URL 测试 Nova Sonic 连接
  4. 暂停敏感度测试:测试不同的 turnTakingPauseSensitivity 值对对话体验的影响

影响范围 (Impact Scope)

  • ✅ 向后兼容,不影响现有功能
  • ✅ 仅增强 Nova Sonic v2 相关功能
  • ✅ 配置驱动,易于扩展新的语音提供商

相关文件 (Related Files)

  • playground/src/components/header/ConnectButton/index.tsx
  • server/internal/config.go
  • server/internal/http_server.go
  • playground/Dockerfile
  • Dockerfile

注意:本 PR 专注于参数传递和配置验证,确保 Amazon Nova Sonic v2 集成的完整性和可配置性。

Chen188 and others added 30 commits August 9, 2024 05:52
… to display chat in playground; other code improvements.
* new: add translation mode in playground
* update: add more languages in playground
* using partial result to reduce wait time for translation mode
allow using LLMs hosting on Amazon SageMaker.
Set `Chat` mode as default
refactor: move settings into a dialog component
feat: add info and description popups in header
feat: integrate system prompt configuration
style: simplify home page layout
Add Bedrock MCP Python extension and related UI components:
* Create bedrock_mcp_python extension with implementation files
* Add MCP settings UI components in playground
* Implement server-side HTTP client for MCP communication
* Update configuration files for MCP integration
* Modify ConnectButton and SettingsDialog for MCP support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants