teto_ai/test/docker-voice-test.sh
Mikolaj Wojciech Gorski 44b45b7212 Major refactor: Transform into AI-powered Kasane Teto companion bot
🎭 Core Transformation:
- Reframe project as AI companion bot with Kasane Teto personality
- Focus on natural conversation, multimodal interaction, and character roleplay
- Position video recording as one tool in AI toolkit rather than main feature

🏗️ Architecture Improvements:
- Refactor messageCreate.js into modular command system (35 lines vs 310+)
- Create dedicated videoRecording service with clean API
- Implement commandHandler for extensible command routing
- Add centralized configuration system (videoConfig.js)
- Separate concerns: events, services, config, documentation

📚 Documentation Overhaul:
- Consolidate scattered READMEs into organized docs/ directory
- Create comprehensive documentation covering:
  * AI architecture and capabilities
  * Natural interaction patterns and personality
  * Setup guides for AI services and Docker deployment
  * Commands reference focused on conversational AI
  * Troubleshooting and development guidelines
- Transform root README into compelling AI companion overview

🤖 AI-Ready Foundation:
- Document integration points for:
  * Language models (GPT-4/Claude) for conversation
  * Vision models (GPT-4V/CLIP) for image analysis
  * Voice synthesis (ElevenLabs) for speaking
  * Memory systems for conversation continuity
  * Personality engine for character consistency

🔧 Technical Updates:
- Integrate custom discord.js-selfbot-v13 submodule with enhanced functionality
- Update package.json dependencies for AI and multimedia capabilities
- Maintain Docker containerization with improved architecture
- Add development and testing infrastructure

📖 New Documentation Structure:
docs/
├── README.md (documentation hub)
├── setup.md (installation & AI configuration)
├── interactions.md (how to chat with Teto)
├── ai-architecture.md (technical AI systems overview)
├── commands.md (natural language interactions)
├── personality.md (character understanding)
├── development.md (contributing guidelines)
├── troubleshooting.md (problem solving)
└── [additional specialized guides]

 This update transforms the project from a simple recording bot into a foundation for an engaging AI companion that can naturally interact through text, voice, and visual content while maintaining authentic Kasane Teto personality traits.
2025-07-26 13:08:47 +02:00

211 lines
7 KiB
Bash
Executable file

#!/bin/bash
# Docker Video Recording Test Script
# Tests the video recording functionality in the Teto Discord bot container
set -e # Exit on any error
echo "🐳 Docker Video Recording Test Script"
echo "===================================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Test 1: Check if Docker is running
print_status "Checking Docker availability..."
if ! docker --version >/dev/null 2>&1; then
print_error "Docker is not installed or not running"
exit 1
fi
print_success "Docker is available"
# Test 2: Check if docker-compose is available
print_status "Checking Docker Compose availability..."
if ! docker-compose --version >/dev/null 2>&1; then
print_error "Docker Compose is not installed"
exit 1
fi
print_success "Docker Compose is available"
# Test 3: Check if required environment variables are set
print_status "Checking environment variables..."
if [[ -z "${USER_TOKEN}" ]]; then
print_warning "USER_TOKEN environment variable is not set"
print_warning "Video recording tests will be limited without a valid Discord token"
fi
# Test 4: Check if output directory exists
print_status "Checking output directory..."
if [[ ! -d "./output" ]]; then
print_warning "Output directory doesn't exist, creating it..."
mkdir -p ./output
fi
print_success "Output directory is ready: $(pwd)/output"
# Test 5: Build the container (dev version for testing)
print_status "Building Docker container with video recording dependencies..."
if docker-compose -f docker-compose.dev.yml build --no-cache; then
print_success "Container built successfully"
else
print_error "Failed to build container"
exit 1
fi
# Test 6: Start the container
print_status "Starting container for testing..."
docker-compose -f docker-compose.dev.yml up -d
# Wait for container to be ready
sleep 5
# Test 7: Check if container is running
print_status "Checking if container is running..."
if docker-compose -f docker-compose.dev.yml ps | grep -q "Up"; then
print_success "Container is running"
else
print_error "Container failed to start"
docker-compose -f docker-compose.dev.yml logs
exit 1
fi
# Test 8: Check FFmpeg installation in container
print_status "Verifying FFmpeg installation in container..."
if docker exec teto_ai_dev which ffmpeg >/dev/null 2>&1; then
FFMPEG_VERSION=$(docker exec teto_ai_dev ffmpeg -version | head -n1)
print_success "FFmpeg is installed: $FFMPEG_VERSION"
else
print_error "FFmpeg is not installed in container"
exit 1
fi
# Test 9: Check Opus codec support
print_status "Checking Opus codec support..."
if docker exec teto_ai_dev ffmpeg -codecs 2>/dev/null | grep -q opus; then
print_success "Opus codec is supported"
else
print_error "Opus codec is not supported"
exit 1
fi
# Test 9b: Check libsodium for encryption
print_status "Checking libsodium encryption library..."
if docker exec teto_ai_dev ldconfig -p 2>/dev/null | grep -q sodium; then
print_success "libsodium encryption library is available"
else
print_warning "libsodium may not be properly installed"
fi
# Test 10: Check Node.js dependencies
print_status "Checking Node.js dependencies..."
if docker exec teto_ai_dev npm list opusscript >/dev/null 2>&1; then
print_success "opusscript dependency is installed"
else
print_warning "opusscript dependency may not be properly installed"
fi
# Test 11: Check output directory mount
print_status "Testing output directory mount..."
TEST_FILE="docker-test-$(date +%s).txt"
docker exec teto_ai_dev sh -c "echo 'Docker mount test' > /tmp/output/$TEST_FILE"
if [[ -f "./output/$TEST_FILE" ]]; then
print_success "Volume mount is working correctly"
rm "./output/$TEST_FILE" # Clean up test file
else
print_error "Volume mount is not working correctly"
exit 1
fi
# Test 12: Check container permissions
print_status "Checking container user permissions..."
CONTAINER_USER=$(docker exec teto_ai_dev whoami)
if [[ "$CONTAINER_USER" == "bot" ]]; then
print_success "Container is running as correct user: $CONTAINER_USER"
else
print_warning "Container is running as unexpected user: $CONTAINER_USER"
fi
# Test 13: Check if bot process can start
print_status "Testing bot process startup..."
docker exec teto_ai_dev timeout 10s node -e "
const { Client } = require('discord.js-selfbot-v13');
const client = new Client({ checkUpdate: false });
console.log('✅ Discord.js-selfbot-v13 loaded successfully');
process.exit(0);
" || print_warning "Bot process test had issues (may be normal without valid token)"
# Test 14: Check video processing capabilities
print_status "Testing video processing capabilities..."
if docker exec teto_ai_dev ffmpeg -f lavfi -i testsrc2=duration=1:size=320x240:rate=30 -f matroska /tmp/output/video-test.mkv -y >/dev/null 2>&1; then
if [[ -f "./output/video-test.mkv" ]]; then
print_success "Video processing test passed"
rm "./output/video-test.mkv" # Clean up
else
print_error "Video file was not created in mounted volume"
fi
else
print_error "Video processing test failed"
fi
# Test 15: Display container information
print_status "Container information:"
echo " Container Name: $(docker-compose -f docker-compose.dev.yml ps --services)"
echo " Container Status: $(docker inspect teto_ai_dev --format='{{.State.Status}}')"
echo " Container IP: $(docker inspect teto_ai_dev --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')"
echo " Host Output Dir: $(pwd)/output"
echo " Container Output Dir: /tmp/output"
# Test 16: Show container logs (last 20 lines)
print_status "Recent container logs:"
docker-compose -f docker-compose.dev.yml logs --tail=20
# Cleanup option
echo ""
read -p "🗑️ Do you want to stop and remove the test container? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
print_status "Stopping and removing test container..."
docker-compose -f docker-compose.dev.yml down
print_success "Test container removed"
else
print_status "Test container left running for further testing"
echo " - Access container: docker exec -it teto_ai_dev bash"
echo " - View logs: docker-compose -f docker-compose.dev.yml logs -f"
echo " - Stop container: docker-compose -f docker-compose.dev.yml down"
fi
echo ""
print_success "🎉 Docker video recording test completed!"
echo ""
echo "📋 Test Summary:"
echo " ✅ Docker environment ready"
echo " ✅ Container builds and runs"
echo " ✅ FFmpeg, Opus, and libsodium support verified"
echo " ✅ Volume mount working"
echo " ✅ Video processing functional"
echo ""
echo "🎥 Video recording functionality is ready for use!"
echo " Use 'xbox record that' in Discord to test recording"
echo " Check ./output/ directory for saved video files (.mkv format)"
echo ""