ten / create_tmp_agents.sh
3v324v23's picture
Добавление автономного прокси-сервера и создание файлов во временной директории для обхода проблем с правами доступа в HF Space
967b096
#!/bin/bash
TMP_DIR="/tmp/ten-agent"
mkdir -p $TMP_DIR
echo "Creating temporary agent files in $TMP_DIR..."
# Create voice_agent.json
cat > $TMP_DIR/voice_agent.json << 'EOL'
{
"nodes": [],
"edges": [],
"groups": [],
"templates": [],
"root": null
}
EOL
# Create chat_agent.json
cat > $TMP_DIR/chat_agent.json << 'EOL'
{
"nodes": [],
"edges": [],
"groups": [],
"templates": [],
"root": null
}
EOL
# Create manifest.json
cat > $TMP_DIR/manifest.json << 'EOL'
{
"name": "default",
"agents": [
{
"name": "voice_agent",
"description": "A simple voice agent"
},
{
"name": "chat_agent",
"description": "A text chat agent"
}
]
}
EOL
# Run the Python script to create property.json
python3 temp_property_json.py
echo "All temporary agent files created successfully."
echo "Files created:"
ls -la $TMP_DIR
# Create symbolic links to make API find these files
ln -sf $TMP_DIR/property.json /app/agents/property.json.tmp || echo "Failed to create symlink for property.json"
ln -sf $TMP_DIR/voice_agent.json /app/agents/voice_agent.json.tmp || echo "Failed to create symlink for voice_agent.json"
ln -sf $TMP_DIR/chat_agent.json /app/agents/chat_agent.json.tmp || echo "Failed to create symlink for chat_agent.json"
ln -sf $TMP_DIR/manifest.json /app/agents/manifest.json.tmp || echo "Failed to create symlink for manifest.json"