Skip to content

feat: 3Dアバター機能 Phase 2/3 + VRMアップロード + 音声モデル選択 + 会話UI刷新#55

Open
fsatsuki wants to merge 40 commits intoaws-samples:mainfrom
fsatsuki:feature/avatar-phase2
Open

feat: 3Dアバター機能 Phase 2/3 + VRMアップロード + 音声モデル選択 + 会話UI刷新#55
fsatsuki wants to merge 40 commits intoaws-samples:mainfrom
fsatsuki:feature/avatar-phase2

Conversation

@fsatsuki
Copy link
Copy Markdown
Contributor

概要

3Dアバター機能のPhase 2〜3、VRMアップロード・Polly音声モデル選択、会話画面UI/UXリデザインを含む大型機能追加PRです。

主な変更内容

3Dアバター Phase 2(標準実装)

  • Amazon Polly Visemeによる母音リップシンク
  • AI感情分析(realtime-scoring)による表情自動連動
  • 複数アバター切り替え対応
  • ExpressionControllerによるスムーズな感情トランジション

3Dアバター Phase 3(拡張実装)

  • AI駆動ジェスチャーアニメーション(うなずき・首かしげ)
  • 感情トランジションの高度化(中間状態、速度調整)
  • アイドルモーション(視線移動、体の揺れ)
  • アバター管理インフラ(S3 + DynamoDB + Lambda)
  • レスポンシブレイアウト対応

VRMアップロード + Polly音声モデル選択

  • シナリオNPC設定内VRMファイルアップロードUI
  • Polly音声モデル選択ドロップダウン(言語別動的フィルタリング)
  • エンジン自動選択ロジック(generative優先)
  • CloudFrontアバターS3オリジン追加
  • manifest.json廃止・DynamoDB + S3管理に統一
  • 技術的負債解消(未使用コード・API削除)

会話画面UI/UXリデザイン

  • ConversationPage全面改修(アバター中心レイアウト)
  • メトリクスオーバーレイ、右側パネル、コーチングヒントバー
  • 既存コンポーネント削除・改修

README更新

  • 主要機能・技術スタック・プロジェクト構造を最新状態に更新
  • 日本語版・英語版の両方を同期

その他

  • AgentCore Runtime移行
  • E2Eテスト追加
  • NPC設定の多様化(性別表現)
  • 絵文字制限のプロンプト追加

テスト

  • フロントエンドリント・型チェック通過
  • デプロイ・動作確認済み

- Workspace Detection完了
- Reverse Engineering完了(8成果物)
- Requirements Analysis完了(要件定義書作成)
- Workflow Planning完了(実行計画書作成)
- NFR Requirements計画作成・回答完了

移行対象:
- Bedrock Lambda → AgentCore Runtime
- Scoring Lambda → AgentCore Runtime
- AudioAnalysis Lambda → AgentCore Runtime
- API認証: API Gateway + Cognito → AgentCore Identity Inbound Auth
- NFR設計パターン定義(レジリエンス、スケーラビリティ、パフォーマンス、セキュリティ、可観測性)
- 論理コンポーネント設計(5エージェント、認証フロー、データフロー)
- AgentCore Memory 365日間保持(Short-Term Memory)
- LLMモデルをClaude 4.5 Haikuに更新
- インフラストラクチャ設計書作成(PUBLIC、VPCなし)
- デプロイメントアーキテクチャ定義
- Code Generation計画(17ステップ)作成
## 主な変更内容

### AgentCore Runtime移行
- 5つのエージェントをAgentCore Runtimeに移行
  - npc-conversation: NPC会話応答生成
  - realtime-scoring: リアルタイムスコアリング
  - feedback-analysis: フィードバック分析
  - video-analysis: 動画分析
  - audio-analysis: 音声分析
- AgentCore Memory統合(セッション状態管理)
- Strands Agents SDK + Pydantic構造化出力

### プロンプト分離リファクタリング
- 各エージェントのプロンプトをprompts.pyに分離
- Pydanticモデルをmodels.pyに分離
- Lambda関数のプロンプトも同様に分離
  - cdk/lambda/audioAnalysis/prompts.py
  - cdk/lambda/sessionAnalysis/prompts.py

### コードクリーンアップ
- infrastructure-stack.ts: 不要なコメント削除
- api.ts: 冗長なコメント削除
- api-gateway.ts: 古いNoteコメント削除

### ドキュメント更新
- cdk/README.md: AgentCore Runtime対応
- docs/cost/コスト試算.md: AgentCore Memory費用追加
GitHub Advanced Securityで検出された問題を修正:
- 例外のスタックトレース情報が外部ユーザーに露出する問題を解消
- エラー詳細はログに記録し、外部には一般的なエラーメッセージのみを返却
- 対象ファイル:
  - cdk/agents/audio-analysis/agent.py
  - cdk/agents/feedback-analysis/agent.py
  - cdk/agents/npc-conversation/agent.py
  - cdk/agents/realtime-scoring/agent.py
  - cdk/agents/video-analysis/agent.py
- Strands Agents SDKのmax_iterationsパラメータを削除(存在しないパラメータ)
- goalUpdates形式を { goalId, achieved, reason } に統一
- フロントエンドの旧形式サポートコードを削除
- GoalStatus型にreasonフィールドを追加
- AgentCoreService.ts: デバッグログ4件削除
- ApiService.ts: デバッグログ10件削除
- ResultPage.tsx: デバッグログ約20件削除

console.errorは維持(エラーログは有用)
バックエンドのlogger.info/debugは維持(適切なログ出力)
- セキュリティ修正: エラーレスポンスから詳細情報を削除
- リントエラー修正: 未使用変数の警告を解消
- steering更新: プッシュ前のローカルCIチェック必須化を追加
- Create prompts package with __init__.py to centralize prompt exports
- Add feedback_prompts.py with build_feedback_prompt() for dynamic prompt construction
- Implement get_structured_output_prompt() for Strands Agents structured output
- Add create_default_feedback() for error handling with fallback values
- Support bilingual prompts (Japanese and English) for international usage
- Update custom_rules.md to enforce AWS environment changes through CDK only
- Prevent direct AWS CLI modifications to Lambda, DynamoDB, and S3 resources
- すべてのエージェントDockerfileに--platform=linux/arm64を追加
- BedrockAgentCore Runtimeはarm64のみサポートのため必須対応
- 対象: audio-analysis, feedback-analysis, npc-conversation, realtime-scoring, video-analysis

修正内容:
FROM public.ecr.aws/docker/library/python:3.11-slim
↓
FROM --platform=linux/arm64 public.ecr.aws/docker/library/python:3.11-slim

エラー解決:
Architecture incompatible for uri. Supported architectures: [arm64]
コンフリクト解決:
- Dockerfileのarm64対応を維持
- package-lock.jsonの更新を取り込み
変更内容:
- Dockerfileから--platform=linux/arm64フラグを削除
- AgentCoreRuntimeコンストラクトでPlatform.LINUX_ARM64を指定
- ecr_assetsモジュールをインポート

理由:
- CodeBuild環境(amd64)でのクロスプラットフォームビルドエラーを解決
- CDKのDockerイメージアセット機能を使用してプラットフォームを指定
- BedrockAgentCore Runtimeのarm64要件に対応

エラー解決:
exec /bin/sh: exec format error
FromPlatformFlagConstDisallowed警告
変更内容:
- CodeBuildイメージをx86_64からaarch64に変更
- コンテナタイプをLINUX_CONTAINERからARM_CONTAINERに変更
- イメージ: amazonlinux-aarch64-standard:3.0を使用

理由:
- BedrockAgentCore Runtimeはarm64アーキテクチャのみサポート
- x86_64環境でarm64イメージをビルドするとexec format errorが発生
- ARM64ネイティブ環境でビルドすることでクロスコンパイル問題を解決

参考:
- AWS CodeBuild ARM-based workloads support
- https://aws.amazon.com/blogs/devops/build-arm-based-applications-using-codebuild/
- auth.ts: CheckEmailDomain関数にarchitecture: Architecture.ARM_64を追加
- transcribe-websocket.ts: 3つのWebSocketハンドラ関数にARM64アーキテクチャを追加
- scenario-initializer.ts: ScenarioInitializer関数にARM64アーキテクチャを追加
- api.ts: TextToSpeechFunction関数にARM64アーキテクチャを追加(前回コミット)

これにより、すべてのLambda関数がBedrockAgentCore Runtimeと同じARM64アーキテクチャで実行されます。
- bedrock-lambda.ts: ARM64アーキテクチャを追加
- session-lambda.ts: ARM64アーキテクチャを追加
- scoring-lambda.ts: ARM64アーキテクチャを追加
- scenario-lambda.ts: ARM64アーキテクチャを追加
- videos-lambda.ts: ARM64アーキテクチャを追加
- evaluation-api.ts: ARM64アーキテクチャを追加
- guardrails-lambda.ts: ARM64アーキテクチャを追加
- rankings-lambda.ts: ARM64アーキテクチャを追加
- audio-analysis-lambda.ts: createFunction内でARM64アーキテクチャを追加
- session-analysis-lambda.ts: createFunction内でARM64アーキテクチャを追加

ARM64 CodeBuild環境でのビルドに対応するため、すべてのLambda関数を統一
- cdk/lambda/bedrock/ ディレクトリを削除(レガシー実装)
- BedrockLambdaConstruct と /bedrock/conversation エンドポイントを削除
- AgentCoreService.ts で環境変数名の不一致を修正
  - CDKデプロイ時: VITE_AGENTCORE_NPC_CONVERSATION_ARN
  - ローカル開発時: VITE_NPC_CONVERSATION_RUNTIME_ARN
- ApiService.ts からレガシーフォールバックを削除
- 会話履歴はAgentCore Memoryに一元化
- Phase 2-6, 8-9のE2Eテストを実装
- テストヘルパー関数(認証、ナビゲーション)を追加
- steeringルールにE2Eテスト実行ガイドラインを追加
- QAテスト計画ドキュメントを追加
- カメラアクセス失敗時に録画なしで商談開始できるように変更
- cameraError状態を追加してエラーハンドリングを改善
- i18nキーを追加(日英対応)
- アクセシビリティ改善(role, aria-live, aria-label属性追加)
- Amazon Polly Visemeによる母音ベースリップシンク実装
- AI感情分析(realtime-scoring)による表情自動連動
- 複数アバター切り替え対応(manifest.json管理)
- TextToSpeech Lambda: visemeデータ返却対応
- realtime-scoring agent: directEmotion出力追加
- AvatarTestPage: Phase 2テスト機能追加
- E2Eテスト: アバター感情表現テスト追加・修正
- リントエラー修正(PollyService, ApiService, AvatarContext)
- GestureType型定義追加(nod, headTilt)
- AnimationController: うなずき・首かしげジェスチャー、Tポーズから自然な立ち姿勢への初期ポーズ設定
- ExpressionController: 感情トランジション強化
- LipSyncController: Visemeベースの母音リップシンク
- VRMAvatar/VRMAvatarContainer: ジェスチャーデータのパススルー
- ConversationPage: ジェスチャーデータフロー統合
- Add VRM file upload functionality for avatar management with S3 + DynamoDB + CloudFront integration
- Implement Polly voice model selection in scenario NPC settings (neural/generative models per language)
- Decouple voice models from avatars to scenario-level NPC configuration
- Add Phase 3 voice execution plan and requirement verification documents
- Enhance devil's advocate code review skill with comprehensive i18n validation rules
- Add feedback classification tests for session analysis results
- Create Polly voices configuration with supported voice models per language
- Update scenario initialization and avatar/session Lambda handlers for voice model support
- Refactor avatar management UI components (remove standalone management, integrate into scenario creation)
- Add scenario edit page tests and goal results section tests
- Update conversation page and result page for voice model integration
- Maintain backward compatibility with existing manifest.json-based avatars
- Update AIDLC state documentation to reflect Phase 3 voice feature scope
- Add comprehensive i18n locale entries for new voice selection UI elements
- Add constraint to prevent emoji and emoticon usage in English NPC responses
- Add constraint to prevent emoji and emoticon usage in Japanese NPC responses
- Ensures consistent text-only output for NPC conversation agents across both language variants
- Delete unused feedback_service.py Lambda function from sessions module
- Update Playwright configuration for improved test execution
- Refactor avatar emotion E2E test suite with enhanced assertions
- Update avatar Phase3 E2E test with improved VRM and gesture validation
- Fix username unit test for better reliability
- Consolidate test infrastructure and remove legacy feedback generation logic
…ar API fetch

- Move NPC voice ID setting before avatar API call to prevent voice synthesis fallback
- Ensure scenario voice ID is available for initial message synthesis immediately
- Prevent default voice model (Takumi/male) from being used when custom voice is configured
- Update ResultPage to reflect goal results and final score when analysis completes
- Handle goalResults data mapping with proper type conversion and null checking
- Sync session state with complete analysis data including goal statuses and scores
- Add comprehensive AI-DLC workflow validation skill for checking plan-to-code alignment
- Implement three-phase parallel checking: plan vs code, TODO/mock detection, requirement fulfillment
- Include detailed checklist for identifying unintended TODOs, mocks, stubs, and incomplete implementations
- Add cross-cutting concern validation (i18n, accessibility, security, error handling)
- Provide structured output format with severity classification (critical/warning/info)
- Enable efficient scope narrowing via aidlc-state.md and audit.md to focus on recent work
- Support parallel subagent execution with file-based result aggregation to prevent context overflow
- Change "鈴木" (Suzuki) to "美咲" (Misaki) for super-salty-youth character
- Update super-salty-youth description from "若者" (youth) to "若い女性" (young woman)
- Replace male business avatars (👨‍💼) with female equivalents (👩‍💼) across multiple personas
- Replace male tech avatars (🧑‍💻, 🧓, 👔) with female business avatar (👩‍💼) for consistency
- Update tech-director scenario: change "Michael Chen" to "Sarah Chen" with voice ID from "Kazuha" to "Danielle"
- Change healthcare-manager name from "鈴木院長" (Suzuki Director) to "松本院長" (Matsumoto Director)
- Ensure gender-diverse representation across all NPC personas in both Japanese and English scenarios
…hases

- Mark AIDLC state as IDLE with all phases completed (Phase 1-3, VRM upload, voice selection, conversation UI, AgentCore migration)
- Add comprehensive completed work summary documenting all delivered features across phases
- Update Phase 2 execution plan: mark Workflow Planning, Code Generation, Build and Test, and Operations as completed
- Update Phase 3 Voice execution plan: mark Code Planning, Code Generation, Build and Test, and Operations as completed
- Update Phase 3 execution plan flowchart and checklist: mark Workflow Planning, Application Design, Units Generation, Functional Design as completed
- Consolidate project status from CONSTRUCTION to IDLE, indicating readiness for next user request
- Update Amazon Bedrock Claude model from 3.5 Haiku to 4.5 Haiku in tech.md
- Update Claude model version in Japanese README.md
- Update Claude model version in English README_en.md
- Reflects latest AI model capability updates in technical stack documentation
- Replace Architecture_en.png reference with unified Architecture.png in README_en.md
- Update Architecture.png with latest system design diagram
- Simplify image asset management by using single architecture diagram for all languages
…nality

- Add enableAvatar flag to scenario data model with default value handling
- Implement avatar On/Off toggle switch in NPC info step during scenario creation/editing
- Update ConversationPage to conditionally render AvatarStage based on enableAvatar setting
- Hide VRM upload UI when avatar is disabled to streamline user experience
- Add i18n translations for avatar toggle labels in English and Japanese
- Update Lambda backend to handle enableAvatar field in scenario operations
- Rename SessionSettingsPanel component for consistency
- Update type definitions across API, components, and index files
- Add avatar toggle code generation plan documentation
- Update project state documentation to reflect completed avatar toggle feature
- Add Architecture_new.pptx to gitignore for presentation assets
- Ensure backward compatibility for existing scenarios without enableAvatar setting
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.

1 participant