| #!/bin/bash |
|
|
| |
| echo "===== Starting TEN-Agent on HuggingFace Space =====" |
| echo "$(date)" |
| echo "Current directory: $(pwd)" |
|
|
| |
| echo "===== Environment Information =====" |
| echo "User: $(whoami)" |
| echo "Groups: $(groups)" |
| echo "Home directory: $HOME" |
|
|
| |
| echo "===== Checking Directory Permissions =====" |
| echo "Temp directory permissions:" |
| ls -la /tmp |
| echo "App directory permissions:" |
| ls -la /app |
|
|
| |
| if [ -f .env ]; then |
| echo "✅ .env file found" |
| cat .env | grep -v "KEY\|CERTIFICATE\|PASSWORD\|SECRET" | sed 's/=.*/=***/' |
| else |
| echo "⚠️ Warning: .env file not found, will use environment variables" |
| fi |
|
|
| |
| echo "===== Creating required directories =====" |
| mkdir -p /tmp/ten_user |
| mkdir -p /tmp/ten_user/agents |
| mkdir -p /tmp/ten_user/logs |
| mkdir -p /tmp/ten_user/rag_data |
| chmod -R 755 /tmp/ten_user |
|
|
| |
| echo "===== Testing file creation in /tmp =====" |
| TEST_FILE="/tmp/test_write_$(date +%s).txt" |
| if touch $TEST_FILE; then |
| echo "✅ Can create files in /tmp" |
| echo "Test content" > $TEST_FILE |
| cat $TEST_FILE |
| rm $TEST_FILE |
| else |
| echo "❌ Cannot create files in /tmp - this will cause problems!" |
| fi |
|
|
| |
| echo "===== Checking required components =====" |
| if [ -f /app/fallback.py ]; then |
| echo "✅ Fallback script found" |
| else |
| echo "❌ Fallback script missing!" |
| fi |
|
|
| if [ -f /app/api_wrapper.py ]; then |
| echo "✅ API wrapper found" |
| else |
| echo "❌ API wrapper missing!" |
| fi |
|
|
| if [ -d /app/playground ]; then |
| echo "✅ Playground directory found" |
| ls -la /app/playground |
| else |
| echo "❌ Playground directory missing!" |
| fi |
|
|
| |
| echo "===== Starting TEN-Agent via fallback script =====" |
| echo "Due to permission issues in Hugging Face Space, we'll use the fallback script" |
| echo "This will create necessary files in /tmp where we have write access" |
|
|
| |
| export HF_SPACE=true |
| export INTERFACE_PORT=7860 |
| export API_PORT=8080 |
| export TEN_AGENT_DIR=/tmp/ten_user/agents |
| export AGENT_SERVER_URL=http://localhost:8080 |
| export NEXT_PUBLIC_EDIT_GRAPH_MODE=true |
| export NEXT_PUBLIC_DISABLE_CAMERA=true |
| export PYTHONUNBUFFERED=1 |
|
|
| |
| exec python3 /app/fallback.py |